From c260117030cf40ebee7f17ef07291bf6648903be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20Todorovich?= Date: Tue, 23 Jul 2019 14:40:38 +0000 Subject: [PATCH] IMP action_print: Print invoice instead of ticket, if the order has one --- pos_order_mgmt/static/src/js/widgets.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pos_order_mgmt/static/src/js/widgets.js b/pos_order_mgmt/static/src/js/widgets.js index 740e1ba3..00deeef5 100644 --- a/pos_order_mgmt/static/src/js/widgets.js +++ b/pos_order_mgmt/static/src/js/widgets.js @@ -171,6 +171,13 @@ odoo.define('pos_order_mgmt.widgets', function (require) { }, action_print: function (order_data, order) { + // If it's invoiced, we just print the invoice + if (order_data.to_invoice) { + return this.pos.chrome.do_action('point_of_sale.pos_invoice_report', { + additional_context: { active_ids: [order_data.id] } + }) + } + // Otherwise, we load the order to generate the ticket // We store temporarily the current order so we can safely compute // taxes based on fiscal position this.pos.current_order = this.pos.get_order();