From f5067bc4728e0fd5a04a4e5e2c03db670bc508ed Mon Sep 17 00:00:00 2001 From: pedrambiria Date: Fri, 10 Mar 2023 16:22:07 +0000 Subject: [PATCH] [FIX] point_of_sale: show the promotion line for the refund Before this commit: if you wanted to refund an order that contains a promotion line, it did not show the promotion line to refund. The problem was that, during the initialization of an order from JSON, it calls `set_partner` and `set_pricelist`. It causes a call to `_updateRewards()` inside the `pos_loyalty`, which will remove the promotion line. But it doesn't need to update the rewards when it creates the order object from JSON. The solution is to prevent calling `set_partner` and `set_pricelist` when it creates the order object from the JSON. opw-3111578 closes odoo/odoo#116236 X-original-commit: a03fa619f1388fb8033128a44eeb5451ef150890 Signed-off-by: Trinh Jacky (trj) Signed-off-by: Pedram Bi Ria (pebr) --- addons/point_of_sale/static/src/js/models.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/point_of_sale/static/src/js/models.js b/addons/point_of_sale/static/src/js/models.js index fdaa350008b..a3e817a2399 100644 --- a/addons/point_of_sale/static/src/js/models.js +++ b/addons/point_of_sale/static/src/js/models.js @@ -2810,7 +2810,6 @@ export class Order extends PosModel { this.pos_session_id = this.pos.pos_session.id; this.cashier = this.pos.get_cashier(); this.finalized = false; // if true, cannot be modified. - this.set_pricelist(this.pos.default_pricelist); this.shippingDate = null; this.partner = null; @@ -2832,6 +2831,7 @@ export class Order extends PosModel { if (options.json) { this.init_from_JSON(options.json); } else { + this.set_pricelist(this.pos.default_pricelist); this.sequence_number = this.pos.pos_session.sequence_number++; this.access_token = uuidv4(); // unique uuid used to identify the authenticity of the request from the QR code. this.ticketCode = this._generateTicketCode(); // 5-digits alphanum code shown on the receipt @@ -2906,7 +2906,7 @@ export class Order extends PosModel { } else { partner = null; } - this.set_partner(partner); + this.partner = partner; this.temporary = false; // FIXME this.to_invoice = false; // FIXME