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.template
Compute Method: _compute_margin
| Inputs | Method | Outputs |
|---|---|---|
|
+ for template in self: + template.list_price_vat_excl = template.taxes_id.compute_all( + template.list_price, product=template + )["total_excluded"] + template.standard_margin = ( + template.list_price_vat_excl - template.standard_price + ) + if template.list_price_vat_excl == 0: + template.standard_margin_rate = 999.0 + else: + template.standard_margin_rate = ( + (template.list_price_vat_excl - template.standard_price) + / template.list_price_vat_excl + * 100 + ) + if template.standard_price == 0: + template.standard_markup_rate = 999.0 + else: + template.standard_markup_rate = ( + (template.list_price_vat_excl - template.standard_price) + / template.standard_price + * 100 + ) |
|
