48d60151254045768d5aac1b29c5acf84b70cef2
Goal: Fix the tax details results when interacting with misc entry containing 2 opposite lines with the same tax. The bug: Wrong mapping in tax details query results in wrong amount in the global tax report. reproduction step pre-requisite: - a simple sale tax A - miscellaneous contains 2 lines, - amount X debit with sale tax A - amount Y credit with purchase tax A - 2 tax lines gets automatically created Before this commit: The global tax report will display a base amount of 2*(X-Y) which is wrong. After this commit: The global tax report will display a base amount of (X-Y) which is correct. Context: When the tax details was made, it wasn't taken into account that there could be 2 tax line (account_move_line) for the same tax in the same account_move if the move is a miscellaneous entry (move_type = 'entry'). As a misc can contain both refund and invoice line at the same time (Due to a PoS order for example), there could be tax_line created by the invoice_repartition_line and another one created by the refund_repartition_line. This results in a mapping in which there are some wrong results that should have been filtered out. The wrong results are the following match: invoice_base_line -> refund_tax_line refund_base_line -> invoice_tax_line Solution: 1) To avoid the confusion we just need to filter out the wrong results. 2) In a misc entry, what makes a tax considering the base line as an invoice or a refund is its balance. 3) In a misc entry, the sign of the tax line balance is the result of a transformation of the base line sign. This transformation is just a multiplication by the sign of the tax rate and the sign of the factor_percent of the tax line repartition line. This means that we can re apply this transformation to the base_line or the inverse of it to the tax_line and check if it matches. If it doesn't, we can confidently discard the match because the tax_line balance can't be the result of a transformation applied to this base_line balance. This is only valid for misc entry. In misc entry, negative base_line and positive base_line are segragated for their tax line creation. Additional notes: A test is added to the enterprise repository to check the global tax report result. closes odoo/odoo#90563 Ticket: 2832745 Community-pr: https://github.com/odoo/odoo/pull/90399 Enterprise-pr: https://github.com/odoo/enterprise/pull/26827 X-original-commit: 690ef4e526b26911678ca872e7eb481215017f1c Related: odoo/enterprise#26961 Signed-off-by: Laurent Smet <las@odoo.com> Signed-off-by: Brice Bartoletti <bib@odoo.com>
…
…
Odoo
Odoo is a suite of web based open source business apps.
The main Odoo Apps include an Open Source CRM, Website Builder, eCommerce, Warehouse Management, Project Management, Billing & Accounting, Point of Sale, Human Resources, Marketing, Manufacturing, ...
Odoo Apps can be used as stand-alone applications, but they also integrate seamlessly so you get a full-featured Open Source ERP when you install several Apps.
Getting started with Odoo
For a standard installation please follow the Setup instructions from the documentation.
To learn the software, we recommend the Odoo eLearning, or Scale-up, the business game. Developers can start with the developer tutorials
Languages
Python
49.6%
JavaScript
47.8%
SCSS
2%
CSS
0.3%
HTML
0.2%