[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) <trj@odoo.com> Signed-off-by: Pedram Bi Ria (pebr) <pebr@odoo.com>
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user