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

Net amount calculated incorrectly #44219

Closed
barredterra opened this issue Nov 19, 2024 · 1 comment · Fixed by #44226 or #44231
Closed

Net amount calculated incorrectly #44219

barredterra opened this issue Nov 19, 2024 · 1 comment · Fixed by #44226 or #44231
Assignees
Labels

Comments

@barredterra
Copy link
Collaborator

barredterra commented Nov 19, 2024

Information about bug

On a Sales Invoice containing items with different tax rates, the tax net amount is not calculated correctly.

Item Tax Template "7 %":

item_tax_templat_7

Item Tax Template "19 %":

item_tax_tenplate_19

Sales Invoice:

sales_invoice

Expected: The net amount per tax row is displayed as 100.
Actual: The net amount per tax row is displayed as 200.

Module

accounts

Version

develop

Installation method

None

Relevant log output / Stack trace / Full Error Message.

Likely introduced by #43372

@barredterra barredterra changed the title Net rate calculated incorrectly Net amount calculated incorrectly Nov 19, 2024
@blaggacao
Copy link
Collaborator

blaggacao commented Nov 19, 2024

Investigating...

At least item_wise_tax_detail is correct.

In [4]: for t in si.taxes:
   ...:     print(t.net_amount, t.item_wise_tax_detail)
   ...:
18403.36 {"ALMBOT1050": {"tax_rate": 19.0, "tax_amount": 1596.64, "net_amount": 8403.36}, "ARAN500": {"tax_rate": 0.0, "tax_amount": 0.0, "net_amount": 10000.0}}
18403.36 {"ALMBOT1050": {"tax_rate": 0.0,  "tax_amount": 0.0,     "net_amount": 8403.36}, "ARAN500": {"tax_rate": 0.0, "tax_amount": 0.0, "net_amount": 10000.0}}

With a new logger the issue becomes clearer:

2024-11-19 15:16:35,518 DEBUG erpnext.controllers.taxes_and_totals Item 0 - ALMBOT1050
2024-11-19 15:16:35,518 DEBUG erpnext.controllers.taxes_and_totals   Tax/Charge 0 - IVA @ 19
2024-11-19 15:16:35,519 DEBUG erpnext.controllers.taxes_and_totals   INIT : net_amount: 16806.722689075632   tax_amount: 3193.27731092437
2024-11-19 15:16:35,519 DEBUG erpnext.controllers.taxes_and_totals   FINAL: net_amount: 16806.72             tax_amount: 3193.28
2024-11-19 15:16:35,519 DEBUG erpnext.controllers.taxes_and_totals   Tax/Charge 1 - 240805 - IVA Descontable
2024-11-19 15:16:35,521 DEBUG erpnext.controllers.taxes_and_totals   INIT : net_amount: 16806.722689075632   tax_amount: 0.0
2024-11-19 15:16:35,521 DEBUG erpnext.controllers.taxes_and_totals   FINAL: net_amount: 16806.72             tax_amount: 0.0
2024-11-19 15:16:35,521 DEBUG erpnext.controllers.taxes_and_totals   Tax/Charge 2 - Gastos de personal (fijo)
2024-11-19 15:16:35,521 DEBUG erpnext.controllers.taxes_and_totals   INIT : net_amount: 16806.722689075632   tax_amount: 10.071942677915228
2024-11-19 15:16:35,521 DEBUG erpnext.controllers.taxes_and_totals   FINAL: net_amount: 16806.72             tax_amount: 10.07
2024-11-19 15:16:35,522 DEBUG erpnext.controllers.taxes_and_totals Item 1 - ARAN500
2024-11-19 15:16:35,522 DEBUG erpnext.controllers.taxes_and_totals   Tax/Charge 0 - IVA @ 19
2024-11-19 15:16:35,522 DEBUG erpnext.controllers.taxes_and_totals   INIT : net_amount: 100000.0             tax_amount: 0.0
2024-11-19 15:16:35,523 DEBUG erpnext.controllers.taxes_and_totals   FINAL: net_amount: 100000.0             tax_amount: 0.0
2024-11-19 15:16:35,525 DEBUG erpnext.controllers.taxes_and_totals   Tax/Charge 1 - 240805 - IVA Descontable
2024-11-19 15:16:35,525 DEBUG erpnext.controllers.taxes_and_totals   INIT : net_amount: 100000.0             tax_amount: 0.0
2024-11-19 15:16:35,525 DEBUG erpnext.controllers.taxes_and_totals   FINAL: net_amount: 100000.0             tax_amount: 0.0
2024-11-19 15:16:35,525 DEBUG erpnext.controllers.taxes_and_totals   Tax/Charge 2 - Gastos de personal (fijo)
2024-11-19 15:16:35,525 DEBUG erpnext.controllers.taxes_and_totals   INIT : net_amount: 100000.0             tax_amount: 59.9280589335956
2024-11-19 15:16:35,526 DEBUG erpnext.controllers.taxes_and_totals   FINAL: net_amount: 100000.0             tax_amount: 59.93

blaggacao added a commit to blaggacao/erpnext that referenced this issue Nov 19, 2024
this clarification is a human precondition to being able to fix frappe#44219
blaggacao added a commit to blaggacao/erpnext that referenced this issue Nov 19, 2024
this clarification is a human precondition to being able to fix frappe#44219
blaggacao added a commit to blaggacao/erpnext that referenced this issue Nov 19, 2024
this clarification is a human precondition to being able to fix frappe#44219
blaggacao added a commit to blaggacao/erpnext that referenced this issue Nov 19, 2024
this clarification is a human precondition to being able to fix frappe#44219
blaggacao added a commit to blaggacao/erpnext that referenced this issue Nov 19, 2024
this clarification is a human precondition to being able to fix frappe#44219
@blaggacao blaggacao reopened this Nov 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants