[FIX] point_of_sale: offline invoicing => backend printing
In a pos session:
OFFLINE
make an order with invoicing , try to validate
The order stays there because it needs to be validated by the server
make another non invoiced order, validate
ONLINE
make another order
At validation, all orders will be pushed to the server
Before this commit, when trying to validate the invoiced order
the report download couldn't find the order id, and crashed
This was because the order in question was already pushed
but treated as a non invoiced order
After this commit, an "warning" message is displayed to the customer
saying he/she has to print the invoice from the backend.
In most cases it is enough and acceptable, since a customer would actually leave the premises
and come back later for the invoice
It is also safer in terms of data consistency to keep pushing all orders once the connection is back
OPW 1918044
closes odoo/odoo#30485
This commit is contained in:
@@ -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"
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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'),
|
||||
|
||||
Reference in New Issue
Block a user