Skip to content

Commit

Permalink
Merge PR #193 into 16.0
Browse files Browse the repository at this point in the history
Signed-off-by dreispt
  • Loading branch information
OCA-git-bot committed Apr 6, 2024
2 parents 8eda52d + 137e3e5 commit 6d71cd0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
4 changes: 2 additions & 2 deletions product_standard_margin/models/product_product.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class ProductProduct(models.Model):

# Compute Section
@api.depends(
"list_price",
"lst_price",
"product_tmpl_id.list_price",
"standard_price",
"taxes_id.price_include",
Expand All @@ -62,7 +62,7 @@ class ProductProduct(models.Model):
def _compute_margin(self):
for product in self:
product.list_price_vat_excl = product.taxes_id.compute_all(
product.list_price, product=product
product.lst_price, product=product
)["total_excluded"]
product.standard_margin = (
product.list_price_vat_excl - product.standard_price
Expand Down
17 changes: 9 additions & 8 deletions product_standard_margin/tests/test_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,19 @@ def setUpClass(cls):

# Custom Section
def _create_product(self, model, standard_price, sale_price, sale_tax_ids):
vals = {
"name": "Demo Product",
"standard_price": standard_price,
"taxes_id": [(6, 0, sale_tax_ids)],
}
if model == "product":
ModelObj = self.ProductProduct
vals.update({"lst_price": sale_price})
else:
ModelObj = self.ProductTemplate
return ModelObj.create(
{
"name": "Demo Product",
"standard_price": standard_price,
"list_price": sale_price,
"taxes_id": [(6, 0, sale_tax_ids)],
}
)
vals.update({"list_price": sale_price})

return ModelObj.create(vals)

# Test Section
def test_01_classic_margin(self):
Expand Down

0 comments on commit 6d71cd0

Please sign in to comment.