Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: net_amount calculation #44231

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

blaggacao
Copy link
Collaborator

@blaggacao blaggacao commented Nov 20, 2024

depends on:

This PR ensures that item_tax_rate is populated from the doc-wide template, if available and if no item wise tax has been set.

This is necessary to match net_amounts to account heads in taxes and totals.

fixes: #44219


Before NOK

❯ tail -f erpnext.controllers.taxes_and_totals.log
2024-11-20 00:10:43,131 DEBUG erpnext.controllers.taxes_and_totals Sales Invoice (FUP00006) ...
2024-11-20 00:10:43,132 DEBUG erpnext.controllers.taxes_and_totals  Item 0: ALMBOT1050
2024-11-20 00:10:43,132 DEBUG erpnext.controllers.taxes_and_totals   net_amount: 50420.17             tax_amount: 9579.83              - IVA @ 19
2024-11-20 00:10:43,132 DEBUG erpnext.controllers.taxes_and_totals   net_amount: 50420.17             tax_amount: 0.0                  - 240805 - IVA Descontable
2024-11-20 00:10:43,132 DEBUG erpnext.controllers.taxes_and_totals   net_amount: 50420.17             tax_amount: 26.82                - Gastos de personal (fijo)
2024-11-20 00:10:43,132 DEBUG erpnext.controllers.taxes_and_totals  Item 1: ARAN500 - {'240801 - IVA Generado - P': 0.0, '240805 - IVA Descontable - P': 0.0}
2024-11-20 00:10:43,133 DEBUG erpnext.controllers.taxes_and_totals   net_amount: 100000.0             tax_amount: 0.0                  - IVA @ 19
2024-11-20 00:10:43,133 DEBUG erpnext.controllers.taxes_and_totals   net_amount: 100000.0             tax_amount: 0.0                  - 240805 - IVA Descontable
2024-11-20 00:10:43,134 DEBUG erpnext.controllers.taxes_and_totals   net_amount: 100000.0             tax_amount: 53.18                - Gastos de personal (fijo)

Now OK
compare net_amount of ALMBOT1050 for 240805 - IVA Descontable and also note the new item rate {'240801 - IVA Generado - P': 19.0} addition

❯ tail -f erpnext.controllers.taxes_and_totals.log
2024-11-20 02:48:38,133 DEBUG erpnext.controllers.taxes_and_totals Sales Invoice (FUP00006) ...
2024-11-20 02:48:38,135 DEBUG erpnext.controllers.taxes_and_totals  Item 0: ALMBOT1050 - {'240801 - IVA Generado - P': 19.0}
2024-11-20 02:48:38,135 DEBUG erpnext.controllers.taxes_and_totals   net_amount: 50420.17             tax_amount: 9579.83              - IVA @ 19
2024-11-20 02:48:38,136 DEBUG erpnext.controllers.taxes_and_totals   net_amount: 0.0                  tax_amount: 0.0                  - 240805 - IVA Descontable
2024-11-20 02:48:38,136 DEBUG erpnext.controllers.taxes_and_totals   net_amount: 50420.17             tax_amount: 26.82                - Gastos de personal (fijo)
2024-11-20 02:48:38,136 DEBUG erpnext.controllers.taxes_and_totals  Item 1: ARAN500 - {'240801 - IVA Generado - P': 0.0, '240805 - IVA Descontable - P': 0.0}
2024-11-20 02:48:38,137 DEBUG erpnext.controllers.taxes_and_totals   net_amount: 100000.0             tax_amount: 0.0                  - IVA @ 19
2024-11-20 02:48:38,137 DEBUG erpnext.controllers.taxes_and_totals   net_amount: 100000.0             tax_amount: 0.0                  - 240805 - IVA Descontable
2024-11-20 02:48:38,138 DEBUG erpnext.controllers.taxes_and_totals   net_amount: 100000.0             tax_amount: 53.18                - Gastos de personal (fijo)

@blaggacao blaggacao removed the needs-tests This PR needs automated unit-tests. label Nov 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Net amount calculated incorrectly
1 participant