[FIX] sale: unify both pricelist & sale option to show discount

Sale module has an option to show or hide discounts on order lines.
Pricelist also have a field to include the discount in the price or display the
full price strikethroughed.

Before this commit:
If the sale option was disabled, the pricelist option would be hidden, possibly
left enabled.
This will cause a strange behavior in frontend where user would still see the
strikethroughed price even if the sale module option was disabled.

Now:
If the sale option got disabled, we also disable the pricelist option

Closes #14741
This commit is contained in:
Romain Derie
2018-06-20 16:43:08 +02:00
parent 9cc4c453d6
commit 27825cbf13
@@ -83,6 +83,12 @@ class ResConfigSettings(models.TransientModel):
module_product_email_template = fields.Boolean("Specific Email")
module_sale_coupon = fields.Boolean("Coupons & Promotions")
def set_values(self):
super(ResConfigSettings, self).set_values()
if not self.group_discount_per_so_line:
pl = self.env['product.pricelist'].search([('discount_policy', '=', 'without_discount')])
pl.write({'discount_policy': 'with_discount'})
@api.onchange('multi_sales_price', 'multi_sales_price_method')
def _onchange_sale_price(self):
if self.multi_sales_price and not self.multi_sales_price_method: