Skip to content

Commit

Permalink
[MIG] product_variant_sale_price: Migration to 16.0
Browse files Browse the repository at this point in the history
  • Loading branch information
RabbitJon-S73 committed Feb 16, 2023
1 parent bd120c9 commit 0cb268f
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 9 deletions.
2 changes: 1 addition & 1 deletion product_variant_sale_price/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
{
"name": "Product Variant Sale Price",
"summary": "Allows to write fixed prices in product variants",
"version": "15.0.1.0.0",
"version": "16.0.1.0.0",
"category": "Product Management",
"website": "https://github.com/OCA/product-variant",
"author": "Tecnativa, " "Odoo Community Association (OCA)",
Expand Down
14 changes: 6 additions & 8 deletions product_variant_sale_price/models/product_product.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,20 +34,18 @@ def _compute_lst_price(self):
uom_model = self.env["uom.uom"]
for product in self:
price = product.fix_price or product.list_price
if "uom" in self.env.context:
price = product.uom_id._compute_price(
price, uom_model.browse(self.env.context["uom"])
)
if self.env.context.get("uom"):
context_uom = uom_model.browse(self.env.context.get("uom"))
price = product.uom_id._compute_price(price, context_uom)
product.lst_price = price

def _compute_list_price(self):
uom_model = self.env["uom.uom"]
for product in self:
price = product.fix_price or product.product_tmpl_id.list_price
if "uom" in self.env.context:
price = product.uom_id._compute_price(
price, uom_model.browse(self.env.context["uom"])
)
if self.env.context.get("uom"):
context_uom = uom_model.browse(self.env.context.get("uom"))
price = product.uom_id._compute_price(price, context_uom)
product.list_price = price

def _inverse_product_lst_price(self):
Expand Down
6 changes: 6 additions & 0 deletions setup/product_variant_sale_price/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import setuptools

setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)

0 comments on commit 0cb268f

Please sign in to comment.