Skip to content

Commit

Permalink
[IMP] Apply suggested changes from FrankC013 to put price_extra to 0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ecino committed Jun 20, 2023
1 parent bfccc61 commit 943ffb7
Showing 1 changed file with 21 additions and 8 deletions.
29 changes: 21 additions & 8 deletions product_variant_sale_price/models/product_product.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,26 @@ def write(self, vals):
template._update_fix_price(vals)
return res

def _get_combination_info(self, combination=False, product_id=False, add_qty=1, pricelist=False,
parent_combination=False, only_template=False):
res = super()._get_combination_info(combination, product_id, add_qty, pricelist,
parent_combination, only_template)
res['price_extra'] = 0.0
return res


class ProductProduct(models.Model):
_inherit = "product.product"

lst_price = fields.Float(
compute="_compute_lst_price",
inverse="_inverse_product_lst_price",
)
list_price = fields.Float(
compute="_compute_list_price",
)
fix_price = fields.Float()

@api.depends("fix_price")
def _compute_lst_price(self):
uom_model = self.env["uom.uom"]
Expand Down Expand Up @@ -71,11 +87,8 @@ def _inverse_product_lst_price(self):
).list_price = min(fix_prices)
product.write(vals)

lst_price = fields.Float(
compute="_compute_lst_price",
inverse="_inverse_product_lst_price",
)
list_price = fields.Float(
compute="_compute_list_price",
)
fix_price = fields.Float()
def _compute_product_price_extra(self):
"""the sale.order.line module calculates the price_unit by adding the value of price_extra and this can
generate inconsistencies if the field has old data stored."""
for product in self:
product.price_extra = 0.0

0 comments on commit 943ffb7

Please sign in to comment.