fix: update loyalty discount calculation to use tax-inclusive price and correct reward line display price logic

This commit is contained in:
Suherdy Yacob 2026-05-21 16:38:37 +07:00
parent ec1141bddc
commit 56af841052
2 changed files with 9 additions and 2 deletions

View File

@ -241,7 +241,10 @@ patch(PosOrder.prototype, {
taxIds = this.pos.taxes.filter((tax) => taxIds.includes(tax.id));
}
var discount_amount = -(Math.min(this.priceExcl, entry[1]) * discountFactor);
var discount_amount = -(Math.min(this.priceIncl, entry[1]) * discountFactor);
console.log("DEBUG LOYALTY:", {
discountable, maxDiscount, discountFactor, priceIncl: this.priceIncl, entry_1: entry[1], discount_amount
});
// OVERRIDE: Inject JSON variables (will be automatically assigned in Odoo 19 extraFields, we must make sure these properties are forwarded)
lst.push({
product_id: discountProduct,

View File

@ -62,11 +62,15 @@ patch(PosOrderline.prototype, {
let totalDisplayPrice = 0;
for (const line of groupLines) {
totalDisplayPrice += line.displayPrice;
totalDisplayPrice += line.priceExcl;
}
return formatCurrency(totalDisplayPrice, this.currency.id);
}
if (this.is_reward_line) {
return formatCurrency(this.priceExcl, this.currency.id);
}
return super.currencyDisplayPrice;
},