diff options
Diffstat (limited to 'fixco_api/controllers/api_v1')
| -rw-r--r-- | fixco_api/controllers/api_v1/sale.py | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/fixco_api/controllers/api_v1/sale.py b/fixco_api/controllers/api_v1/sale.py index 7096ccb..a4bc7d0 100644 --- a/fixco_api/controllers/api_v1/sale.py +++ b/fixco_api/controllers/api_v1/sale.py @@ -152,7 +152,6 @@ class Sales(controller.Controller): @http.route(prefix + 'do/confirm', auth='public', methods=['POST', 'OPTIONS'], csrf=False) @controller.Controller.must_authorized() def complete_delivery_order(self, **kw): - # stock_picking.action_assign sale_id = int(kw.get('id', '0')) ref = str(kw.get('ref', '0')) if sale_id == 0 and ref == '0': @@ -180,7 +179,25 @@ class Sales(controller.Controller): 'reserved': reserved, 'validated': str(validated) }) - test = data - print(test) return self.response(data) + @http.route(prefix + 'invoice/create', auth='public', methods=['POST', 'OPTIONS'], csrf=False) + @controller.Controller.must_authorized() + def complete_delivery_order(self, **kw): + print(1) + sale_id = int(kw.get('id', '0')) + ref = str(kw.get('ref', '0')) + if sale_id == 0 and ref == '0': + return self.response(code=500, description='Internal Server Error') + if sale_id > 0: + query = [('id', '=', sale_id)] + else: + query = [('client_order_ref', '=', ref)] + + sales = request.env['sale.order'].search(query) + invoiced = '' + for sale in sales: + invoiced = sale.api_create_invoices(sale.id) + return self.response([{ + 'invoiced': str(invoiced) + }]) |
