[IMP] product_pricelist_total_margin: Add global_margin_type for min/max limits
- Add global_margin_type field in res.config.settings * Options: 'markup' (default) or 'margin' (commercial margin) * Determines how global min/max percentages are interpreted - Refactor _apply_global_margin_limits(): * Now receives price instead of margin percentage * Calculates min/max prices based on global_margin_type * Returns adjusted price instead of adjusted margin * Supports both markup and commercial margin formulas - Update _compute_price() to apply limits after price calculation - Update res_config_settings_views.xml to show global_margin_type selector - Update help texts with examples for both calculation methods - Add 2 new tests to validate global limits with commercial margin type: * test_global_minimum_with_commercial_margin_type * test_global_maximum_with_commercial_margin_type - All 13 tests passing (11 existing + 2 new) Example with global min 25%: - Markup: Min price = Cost × 1.25 - Commercial Margin: Min price = Cost / 0.75 (ensures 25% margin on PVP)
This commit is contained in:
parent
07cc0eb517
commit
449bb75bb6
4 changed files with 180 additions and 25 deletions
|
|
@ -25,6 +25,14 @@
|
|||
/>
|
||||
<field name="total_margin_max_percent" class="oe_inline" />
|
||||
</div>
|
||||
<div class="row">
|
||||
<label
|
||||
string="Calculation Method"
|
||||
for="global_margin_type"
|
||||
class="col-lg-3 o_light_label"
|
||||
/>
|
||||
<field name="global_margin_type" class="oe_inline" />
|
||||
</div>
|
||||
</div>
|
||||
</setting>
|
||||
</xpath>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue