summaryrefslogtreecommitdiff
path: root/addons
diff options
context:
space:
mode:
authorAntoine Prieels <anp@odoo.com>2020-01-24 08:17:53 +0000
committerAntoine Prieels <anp@odoo.com>2020-01-24 10:51:36 +0000
commitabbbeb571487195c4b4918d4c640c75d9adf0fff (patch)
tree4c4f6a46668989ab5aac184d010b5b8bdf6afffb /addons
parentec3a947f3bfdafbb211f3aae58aa7d5bc7e8e7a8 (diff)
[FIX] point_of_sale,pos_restaurant: Multiprint
Printed receipts are transformed into images by placing them into an hidden `div`. When trying to print multiple orders, we did not wait correctly between rendering the different receipts. Receipts were then overriding one another while they were being rendered, resulting in errors and missing receipts. closes odoo/odoo#43907 X-original-commit: 00ba908d7b3d8b1145e4161ea8d9011ff6eea33d Signed-off-by: Antoine Prieƫls <aprieels@users.noreply.github.com>
Diffstat (limited to 'addons')
-rw-r--r--addons/point_of_sale/static/src/js/printers.js4
-rw-r--r--addons/pos_restaurant/static/src/js/multiprint.js8
2 files changed, 6 insertions, 6 deletions
diff --git a/addons/point_of_sale/static/src/js/printers.js b/addons/point_of_sale/static/src/js/printers.js
index a18e0831427..3e4a21d96a5 100644
--- a/addons/point_of_sale/static/src/js/printers.js
+++ b/addons/point_of_sale/static/src/js/printers.js
@@ -22,14 +22,14 @@ var PrinterMixin = {
function process_next_job() {
if (self.receipt_queue.length > 0) {
var r = self.receipt_queue.shift();
- self.htmlToImg(r)
+ return self.htmlToImg(r)
.then(self.send_printing_job.bind(self))
.then(self._onIoTActionResult.bind(self))
.then(process_next_job)
.guardedCatch(self._onIoTActionFail.bind(self));
}
}
- process_next_job();
+ return process_next_job();
},
/**
diff --git a/addons/pos_restaurant/static/src/js/multiprint.js b/addons/pos_restaurant/static/src/js/multiprint.js
index cfc59661a71..d284917b940 100644
--- a/addons/pos_restaurant/static/src/js/multiprint.js
+++ b/addons/pos_restaurant/static/src/js/multiprint.js
@@ -297,13 +297,13 @@ models.Order = models.Order.extend({
};
},
- printChanges: function(){
+ printChanges: async function(){
var printers = this.pos.printers;
for(var i = 0; i < printers.length; i++){
var changes = this.computeChanges(printers[i].config.product_categories_ids);
if ( changes['new'].length > 0 || changes['cancelled'].length > 0){
var receipt = QWeb.render('OrderChangeReceipt',{changes:changes, widget:this});
- printers[i].print_receipt(receipt);
+ await printers[i].print_receipt(receipt);
}
}
},
@@ -339,10 +339,10 @@ models.Order = models.Order.extend({
var SubmitOrderButton = screens.ActionButtonWidget.extend({
'template': 'SubmitOrderButton',
- button_click: function(){
+ button_click: async function(){
var order = this.pos.get_order();
if(order.hasChangesToPrint()){
- order.printChanges();
+ await order.printChanges();
order.saveChanges();
}
},