diff --git a/sale.py b/sale.py index 528d84b..efdf18b 100644 --- a/sale.py +++ b/sale.py @@ -46,11 +46,26 @@ class Sale(metaclass=PoolMeta): content = {'content': customer_order[1].decode('utf-8')} headers = {"accept": 'application/json', 'Content-Type': 'application/json'} - url = "http://localhost:5000/print_ticket" + url = "http://localhost:5000/order_kitchen" response = requests.post(url, data=json.dumps(content), headers=headers) return response.status_code - + + @classmethod + @ModelView.button + def bar(cls, records): + pool = Pool() + Report = pool.get('sale.customer_order', type='report') + context = Transaction().context + customer_order = Report.execute(records, context) + + content = {'content': customer_order[1].decode('utf-8')} + headers = {"accept": 'application/json', 'Content-Type': 'application/json'} + url = "http://localhost:5000/order_bar" + response = requests.post(url, data=json.dumps(content), headers=headers) + + return response.status_code + class Line(metaclass=PoolMeta): "Sale Line Fast Food" diff --git a/sale.xml b/sale.xml index 2ff4f41..16d75aa 100644 --- a/sale.xml +++ b/sale.xml @@ -22,11 +22,16 @@ Add Pizza - + kitchen Kitchen + + bar + Bar + + Customer Order sale.sale diff --git a/view/sale_form.xml b/view/sale_form.xml index 048d1d7..830650d 100644 --- a/view/sale_form.xml +++ b/view/sale_form.xml @@ -8,5 +8,6 @@