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: specify precision for net_amount (backport #39481) #42817

Merged
merged 4 commits into from
Aug 24, 2024

Conversation

mergify[bot]
Copy link
Contributor

@mergify mergify bot commented Aug 19, 2024

Continuation of #38141
Removed optional grand total adjustment functionality, rather it is always adjusted for inclusive taxes.


This is an automatic backport of pull request #39481 done by Mergify.

* fix: specify precision for net_amount

* fix: correct existing test to account for precision

* fix: rounding issue in test cases

* fix: optional grand total manipulation

* fix: use `grand_total_diff` for manipulation

* fix: patch to set default for grand total manipulation

* fix: wrong rounding assertion for USD

* fix: undefined this.frm error

* chore: linters

* fix: `net_amount` percision and method rename

* fix: missing frm reference

* chore: minor cleanups and depr message

* refactor: remove optional adjusting of grand total

(cherry picked from commit 50d56db)

# Conflicts:
#	erpnext/public/js/controllers/accounts.js
#	erpnext/public/js/controllers/taxes_and_totals.js
@mergify mergify bot added the conflicts label Aug 19, 2024
Copy link
Contributor Author

mergify bot commented Aug 19, 2024

Cherry-pick of 50d56db has failed:

On branch mergify/bp/version-14-hotfix/pr-39481
Your branch is up to date with 'origin/version-14-hotfix'.

You are currently cherry-picking commit 50d56db0c2.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Changes to be committed:
	modified:   erpnext/accounts/doctype/accounts_settings/accounts_settings.json
	modified:   erpnext/accounts/doctype/pos_invoice/test_pos_invoice.py
	modified:   erpnext/accounts/doctype/pos_invoice_merge_log/test_pos_invoice_merge_log.py
	modified:   erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py
	modified:   erpnext/controllers/taxes_and_totals.py

Unmerged paths:
  (use "git add <file>..." to mark resolution)
	both modified:   erpnext/public/js/controllers/accounts.js
	both modified:   erpnext/public/js/controllers/taxes_and_totals.js

To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally

@ruthra-kumar
Copy link
Member

UI broken
Screenshot from 2024-08-19 10-37-40

@ruthra-kumar ruthra-kumar force-pushed the mergify/bp/version-14-hotfix/pr-39481 branch from 3e91839 to 9d3f291 Compare August 19, 2024 08:21
@ruthra-kumar ruthra-kumar force-pushed the mergify/bp/version-14-hotfix/pr-39481 branch from 9d3f291 to c5dedab Compare August 19, 2024 08:23
@ruthra-kumar
Copy link
Member

UI broken Screenshot from 2024-08-19 10-37-40

Fixed

@ruthra-kumar
Copy link
Member

@rtdany10
2 test cases, test_rounding_adjustment and test_sales_invoice_discount_amount, which were not failing on the original PR is failing here.

Could you take a look?

@rtdany10
Copy link
Contributor

@ruthra-kumar
The test case test_sales_invoice_discount_amount has wrong assertion.
On develop, it asserts against 0 as grand total itself is an integer and requires on rounding
image

In v14, the asserting is for -0.01 while the grand total is an integer.
image

But apparently grand_total assertion is failing here. I guess we should correct the test case either way

@rtdany10
Copy link
Contributor

image
We will have to correct both the test cases.

I believe this can be attributed to the change in rounding functionality between the versions, 14 and develop. 15 and onwards uses "Banker's Rounding" while 14 uses "Banker's Rounding (legacy)"

@rtdany10
Copy link
Contributor

I do not have write access to this branch, can you correct the test cases please? @ruthra-kumar

@ruthra-kumar ruthra-kumar self-assigned this Aug 21, 2024
@ruthra-kumar ruthra-kumar merged commit 6cf2485 into version-14-hotfix Aug 24, 2024
9 of 10 checks passed
@ruthra-kumar ruthra-kumar deleted the mergify/bp/version-14-hotfix/pr-39481 branch August 24, 2024 02:23
@ruthra-kumar
Copy link
Member

@rtdany10 Merged

@frappe-pr-bot
Copy link
Collaborator

🎉 This issue has been resolved in version 14.73.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 17, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants