[FIX] sale: discount in pricelist for negative price

Having :
- a pricelist with 10% of discount for all the products.
- the discount policy in the pricelist set to : "Show public price &
discount to the customer"
- a product with negative price (ex : -$125)
- add the product in a SO with the 10% pricelist

Before this commit, the unit price was the price with the discount
already applied: -$112.5, and not the original price as expected; The
subtotal price was $101,25 (the discount is applied twice) which is
wrong.

Now, the unit price is -$112.5 as expected, in Odoo surcharge are always
included in the display price.

opw-1986582

closes odoo/odoo#33717

Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
This commit is contained in:
Jorge Pinna Puissant
2019-05-28 11:38:55 +00:00
parent 04b2b93143
commit bc3ee30504
+1 -1
View File
@@ -1640,7 +1640,7 @@ class SaleOrderLine(models.Model):
new_list_price, self.order_id.pricelist_id.currency_id,
self.order_id.company_id, self.order_id.date_order or fields.Date.today())
discount = (new_list_price - price) / new_list_price * 100
if discount > 0:
if (discount > 0 and new_list_price > 0) or (discount < 0 and new_list_price < 0):
self.discount = discount
def _is_delivery(self):