[16.0][IMP] account_avatax_[sale]_oca: support multiple taxes appearing on each line instead of one #529
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Context:
The issue addressed in PR involves handling split tax lines from Avalara—where a single invoice line (e.g., $100) might be taxed at multiple rates (e.g., 4% on $75 and 4.5% on $25). however recalculating the rate leads to incorrect rate values as the amounts involved in the recalculation have been rounded by Avalara.
What this PR improves:
This PR enhances the solution with a cleaner and more maintainable approach:
details
directly: Instead of calculating an average rate or recaculate rate, this PR reads each component tax (rate, taxName) directly from the API response.account.tax
record in Odoo, improving traceability and avoiding ambiguity.Local Tax [Code] 4.5%
) and prevents issues caused by auto-generating taxes with obscure rate names (e.g.,9.75**
).Example from PR results and a little review of some issues: We should pay attention to the first line