You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[REF] point_of_sale, pos_*: improve tax computation in PoS
*: l10n_es_pos, l10n_sa_pos, point_of_sale, pos_discount,
pos_loyalty, pos_razorpay, pos_restaurant, pos_self_order
Before this commit taxes computation was a mess in PoS, with differents
implementations in different places, and some of them not taking into
account all the complexity of the tax system (taxes included in price,
taxes on taxes, etc.).
This commit aims to unify all the tax computation logic in a single
place, and to make it more robust and easier to understand.
---
What's changes:
Rounding methods available in PoS are now:
1) Rounding applied only on cash payments
In this case the remaining due is rounded only if there is at least
one cash payment line and the remaining due is less than the
rounding tolerance.
2) Rounding applied on all payment methods
In this case the remaining due is always rounded even if a card
payment method is used. The remaining due is rounded if it is less
than the rounding tolerance. No payment method is rounded in this
case, the whole order is rounded instead.
Taxes computation is now done globally on the order, and not on each
line. This way we ensure that the total tax amount is always correct,
even if there is some rounding issues on the lines.
---
Changes in tests:
`test_cash_rounding_down_add_invoice_line_not_only_round_cash_method_with_residual_rounding`
`test_cash_rounding_up_add_invoice_line_not_only_round_cash_method`
Are removed because the tested behavior is not longer present. Now when
rounding is enabled with only_round_cash_method=False, the whole order
is always rounded.
Accounting tests are now principally tested with Hoot instead of tours.
---
Developer note:
No prices should be calculated manually in the code base. Getters have
been created for this purpose in the following files:
- `product_template_accounting.js`
- `pos_order_accounting.js`
- `pos_order_line_accounting.js`
In the future, all PRs containing tax calculations must justify them.
closesodoo#229683
Taskid: 5143758
Related: odoo/enterprise#96123
Signed-off-by: David Monnom (moda) <[email protected]>
0 commit comments