addons-cm/product_pricelist_total_margin/views
snt 0f239601ce [IMP] product_pricelist_total_margin: Add margin_type selector (Markup vs Commercial Margin)
- Add margin_type field to choose between calculation methods:
  * Markup (on cost): PVP = Cost × (1 + markup%)
  * Commercial Margin (on PVP): PVP = Cost / (1 - margin%)
- Update _compute_price() to apply correct formula based on margin_type
- Add safety cap for commercial margin >= 100% (caps at 99%)
- Add detailed logging for both calculation types
- Update views to show margin_type field when use_total_margin is enabled
- Add 2 new tests to validate both calculation methods:
  * test_total_margin_markup_type: validates markup formula
  * test_total_margin_commercial_margin_type: validates commercial margin formula
- All 11 tests passing (9 existing + 2 new)

Example with Commercial Margin:
Base: 4.68€, Total Margin: 20%
- Markup: 4.68 × 1.20 = 5.616€ (margin = 16.67% of PVP)
- Commercial Margin: 4.68 / 0.80 = 5.85€ (margin = 20% of PVP) ✓
2026-02-21 18:54:38 +01:00
..
product_pricelist_item_views.xml [IMP] product_pricelist_total_margin: Add margin_type selector (Markup vs Commercial Margin) 2026-02-21 18:54:38 +01:00
res_config_settings_views.xml [ADD] product_pricelist_total_margin: New module for additive margin calculation 2026-02-21 16:11:13 +01:00