diff --git a/pos_order_mgmt/static/src/js/widgets.js b/pos_order_mgmt/static/src/js/widgets.js index 00deeef5..9503b262 100644 --- a/pos_order_mgmt/static/src/js/widgets.js +++ b/pos_order_mgmt/static/src/js/widgets.js @@ -171,13 +171,6 @@ 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(); @@ -201,6 +194,16 @@ odoo.define('pos_order_mgmt.widgets', function (require) { this.gui.show_screen('receipt'); this.pos.reloaded_order = false; } + + // If it's invoiced, we also print the invoice + if (order_data.to_invoice) { + this.pos.chrome.do_action('point_of_sale.pos_invoice_report', { + additional_context: { active_ids: [order_data.id] } + }) + } + + // Destroy the order so it's removed from localStorage + // Otherwise it will stay there and reappear on browser refresh order.destroy(); },