summaryrefslogtreecommitdiff
path: root/addons/pos_restaurant/static/src
diff options
context:
space:
mode:
authorRobin Heinz <rhe@odoo.com>2019-12-05 15:56:38 +0000
committerPierre Masereel <pim@odoo.com>2019-12-24 14:27:11 +0000
commit99615ff6cc0559f6661001e5493876f2d5b69248 (patch)
treeb9e8de05efa147faedcde96dd1dd5a11ca2b21fc /addons/pos_restaurant/static/src
parentdb54055747f235815cd3a9dfea018873f434c2af (diff)
[FIX] pos_restaurant: double printing not allowed.
Before this, when we printed a ticket for the kitchen, if we went back to the table management and go back to the order, we could re print the same product. Now, we can only reprint the order if there is something different. closes odoo/odoo#42208 Task-id: 2123029 X-original-commit: c8f604045eb0d476766641386c4e5e1605b915c3 Signed-off-by: pimodoo <pimodoo@users.noreply.github.com>
Diffstat (limited to 'addons/pos_restaurant/static/src')
-rw-r--r--addons/pos_restaurant/static/src/js/multiprint.js23
1 files changed, 18 insertions, 5 deletions
diff --git a/addons/pos_restaurant/static/src/js/multiprint.js b/addons/pos_restaurant/static/src/js/multiprint.js
index e2fea909c04..582af5142c8 100644
--- a/addons/pos_restaurant/static/src/js/multiprint.js
+++ b/addons/pos_restaurant/static/src/js/multiprint.js
@@ -199,9 +199,17 @@ models.Order = models.Order.extend({
for ( line_hash in current_res) {
var curr = current_res[line_hash];
- var old = old_res[line_hash];
+ var old = {};
+ var found = false;
+ for(var id in old_res) {
+ if(old_res[id].product_id === curr.product_id){
+ found = true;
+ old = old_res[id];
+ break;
+ }
+ }
- if (typeof old === 'undefined') {
+ if (!found) {
add.push({
'id': curr.product_id,
'name': this.pos.db.get_product_by_id(curr.product_id).display_name,
@@ -229,7 +237,12 @@ models.Order = models.Order.extend({
}
for (line_hash in old_res) {
- if (typeof current_res[line_hash] === 'undefined') {
+ var found = false;
+ for(var id in current_res) {
+ if(current_res[id].product_id === old_res[line_hash].product_id)
+ found = true;
+ }
+ if (!found) {
var old = old_res[line_hash];
rem.push({
'id': old.product_id,
@@ -315,12 +328,12 @@ models.Order = models.Order.extend({
},
export_as_JSON: function(){
var json = _super_order.export_as_JSON.apply(this,arguments);
- json.multiprint_resume = this.saved_resume;
+ json.multiprint_resume = JSON.stringify(this.saved_resume);
return json;
},
init_from_JSON: function(json){
_super_order.init_from_JSON.apply(this,arguments);
- this.saved_resume = json.multiprint_resume;
+ this.saved_resume = JSON.parse(json.multiprint_resume);
},
});