[FIX] point_of_sale: prevent showing downpayment as discount on receipt
Current behavior: When applying a discount and a downpayment on a product in the PoS the discount line on the receipt would be the sum of the discount and the downpayment. But the downpayment is not a discount. Steps to reproduce: - Install PoS - Change discount policy to Show public price & discount to the customer, in the public pricelist - Create a promotion program that applies 10% discount - Use this promotion program in the PoS - Create a quotation for any product (e.g with a product that cost 1000$) - In the PoS go in the quotation/order and apply a downpayment to this quotation. - Pay the downpayment, and go in the quotation/order again. But this time settle the order. - After the payment on the receipt you will see the discount line value is not correct. It's the sum of the discount + the downpayment opw-2792417 closes odoo/odoo#89213 X-original-commit: fc546e0481ae0159e67791240833bc1e38a4440f Signed-off-by: Masereel Pierre <pim@odoo.com> Signed-off-by: Engels Robin (roen) <roen@odoo.com>
This commit is contained in:
@@ -2724,6 +2724,9 @@ class Order extends PosModel {
|
||||
}
|
||||
get_total_discount() {
|
||||
return round_pr(this.orderlines.reduce((function(sum, orderLine) {
|
||||
if (orderLine.pos.config.down_payment_product_id[0] === orderLine.product.id) {
|
||||
return 0;
|
||||
}
|
||||
sum += (orderLine.get_unit_price() * (orderLine.get_discount()/100) * orderLine.get_quantity());
|
||||
if (orderLine.display_discount_policy() === 'without_discount'){
|
||||
sum += ((orderLine.get_lst_price() - orderLine.get_unit_price()) * orderLine.get_quantity());
|
||||
|
||||
Reference in New Issue
Block a user