diff --git a/addons/point_of_sale/i18n/point_of_sale.pot b/addons/point_of_sale/i18n/point_of_sale.pot index 2067c6a928c088bf61d84beca855717dbe91e6ce..dbf186e92ce81b81e59d0a73eadb37dd53026d78 100644 --- a/addons/point_of_sale/i18n/point_of_sale.pot +++ b/addons/point_of_sale/i18n/point_of_sale.pot @@ -2157,6 +2157,13 @@ msgstr "" msgid "Please define income account for this product: \"%s\" (id:%d)." msgstr "" +#. module: point_of_sale +#. openerp-web +#: code:addons/point_of_sale/static/src/js/screens.js:2017 +#, python-format +msgid "Please print the invoice from the backend" +msgstr "" + #. module: point_of_sale #: code:addons/point_of_sale/models/pos_order.py:446 #, python-format @@ -3051,6 +3058,13 @@ msgstr "" msgid "The order could not be sent to the server due to an unknown error" msgstr "" +#. module: point_of_sale +#. openerp-web +#: code:addons/point_of_sale/static/src/js/screens.js:2018 +#, python-format +msgid "The order has been synchronized earlier. Please make the invoice from the backend for the order: " +msgstr "" + #. module: point_of_sale #: model:ir.model.fields,help:point_of_sale.field_pos_config_iface_precompute_cash msgid "The payment input will behave similarily to bank payment input, and will be prefilled with the exact due amount" diff --git a/addons/point_of_sale/static/src/js/models.js b/addons/point_of_sale/static/src/js/models.js index fa6215ee0e87f1ad4eb86a06d2ea19c2458c3e84..2fe1efe8bfa25149c4f5cfa2a530f169b595d088 100644 --- a/addons/point_of_sale/static/src/js/models.js +++ b/addons/point_of_sale/static/src/js/models.js @@ -741,12 +741,20 @@ exports.PosModel = Backbone.Model.extend({ transfer.pipe(function(order_server_id){ // generate the pdf and download it - self.chrome.do_action('point_of_sale.pos_invoice_report',{additional_context:{ - active_ids:order_server_id, - }}).done(function () { - invoiced.resolve(); - done.resolve(); - }); + if (order_server_id.length) { + self.chrome.do_action('point_of_sale.pos_invoice_report',{additional_context:{ + active_ids:order_server_id, + }}).done(function () { + invoiced.resolve(); + done.resolve(); + }); + } else { + // The order has been pushed separately in batch when + // the connection came back. + // The user has to go to the backend to print the invoice + invoiced.reject({code:401, message:'Backend Invoice', data:{order: order}}); + done.reject(); + } }); return done; diff --git a/addons/point_of_sale/static/src/js/screens.js b/addons/point_of_sale/static/src/js/screens.js index 82e6fa0e7b25f2b0a2c5963a01a8c08d21f3c08d..2b397e10a2e21065222aa4082e0fa84a497ba080 100644 --- a/addons/point_of_sale/static/src/js/screens.js +++ b/addons/point_of_sale/static/src/js/screens.js @@ -2012,6 +2012,17 @@ var PaymentScreenWidget = ScreenWidget.extend({ self.gui.show_screen('clientlist'); }, }); + } else if (error.message === 'Backend Invoice') { + self.gui.show_popup('confirm',{ + 'title': _t('Please print the invoice from the backend'), + 'body': _t('The order has been synchronized earlier. Please make the invoice from the backend for the order: ') + error.data.order.name, + confirm: function () { + this.gui.show_screen('receipt'); + }, + cancel: function () { + this.gui.show_screen('receipt'); + }, + }); } else if (error.code < 0) { // XmlHttpRequest Errors self.gui.show_popup('error',{ 'title': _t('The order could not be sent'),