Hello everyone,
We have a requirement (similar to construction/contracting scenarios) where sales and invoices must support several structural percentage adjustments, such as:
-
General expenses (%)
-
Industrial benefit (%)
-
Subcontractor commission (%)
-
A global sale discount (%) applied without modifying unit prices of individual lines
Functional rules
-
The surcharge percentages (general expenses, industrial benefit, subcontractor commission) must be applied to the untaxed amount of the sale/invoice regular lines.
-
The global discount must be applied after those surcharges, on the resulting amount.
-
Taxes must be calculated on the amounts resulting from these computations.
-
The behavior must remain consistent across different invoicing scenarios. If the untaxed amount changes (for example, in partial invoicing), the amounts computed from the percentages must adjust accordingly.
Proposed approach
Instead of overriding total calculations at the sale level, we are considering generating additional sale/invoice lines representing the calculated surcharge and discount amounts.
The idea would be:
-
Compute the surcharges based on the untaxed amount of the regular lines.
-
Create explicit lines for those surcharge/discount amounts.
-
Let Tryton handle taxes and totals using its standard mechanisms.
-
Fill those lines with a specific product so they can be easily filtered and handled differently in reports or custom logic if needed.
For example:
-
Line 1: 600 EUR
-
Line 2: 400 EUR
If an industrial benefit of 6% is applied:
-
Industrial benefit line:
- Quantity: 0.06
- Unit Price: 1,000
- Amount: 60 EUR
Untaxed amount: 1,060 EUR
Tax amount (e.g. 21%): 222.60 EUR
Total amount: 1,282.60 EUR
Is representing these structural adjustments as explicit lines considered the recommended pattern in Tryton?
Any guidance would be greatly appreciated.
Thank you!