[FIX] sale: do not discard price computation if feature is disabled

The discount must be computed regardless of user groups (computed fields 
should not be dependent of user groups ideally).
Anyway, pricelist discount policy is by default to show the price with 
discount.

Unless the database and user groups are wrongly configured, this 
shouldn't have any impact.

Part-of: odoo/odoo#82374
This commit is contained in:
Victor Feyens
2022-02-21 08:41:31 +00:00
parent d9f9692a2d
commit a985182259
-4
View File
@@ -840,10 +840,6 @@ class SaleOrderLine(models.Model):
@api.depends('product_id', 'product_uom', 'product_uom_qty')
def _compute_discount(self):
if not self.env.user.has_group('product.group_discount_per_so_line'):
# Do not compute discounts if the feature is not enabled.
return
for line in self:
if not line.product_id or line.display_type:
line.discount = 0.0