Odoo Mindscape. Understand Odoo faster. Explore modules, fields, dependencies and version differences in one place instead of digging through the source code.

Module: Product Margin and Margin Rate

Entity: product.product

Compute Method: _compute_margin

View 18.0
Inputs Method Outputs
  • taxes_id
  • lst_price
  • list_price_vat_excl
  • standard_price
+ for product in self:
+             product.list_price_vat_excl = product.taxes_id.compute_all(
+                 product.lst_price, product=product
+             )["total_excluded"]
+             product.standard_margin = (
+                 product.list_price_vat_excl - product.standard_price
+             )
+             if product.list_price_vat_excl == 0:
+                 product.standard_margin_rate = 999.0
+             else:
+                 product.standard_margin_rate = (
+                     (product.list_price_vat_excl - product.standard_price)
+                     / product.list_price_vat_excl
+                     * 100
+                 )
+             if product.standard_price == 0:
+                 product.standard_markup_rate = 999.0
+             else:
+                 product.standard_markup_rate = (
+                     (product.list_price_vat_excl - product.standard_price)
+                     / product.standard_price
+                     * 100
+                 )
  • list_price_vat_excl
  • standard_margin
  • standard_margin_rate
  • standard_markup_rate

Back to entity