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: Allocate tax loss to tax account head on early payment discount (backport #34287) #34730

Merged

Conversation

mergify[bot]
Copy link
Contributor

@mergify mergify bot commented Apr 4, 2023

This is an automatic backport of pull request #34287 done by Mergify.
Cherry-pick of 9abf0ef has failed:

On branch mergify/bp/version-13-hotfix/pr-34287
Your branch is ahead of 'origin/version-13-hotfix' by 9 commits.
  (use "git push" to publish your local commits)

You are currently cherry-picking commit 9abf0ef615.
  (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)

Unmerged paths:
  (use "git add <file>..." to mark resolution)
	both modified:   erpnext/accounts/doctype/payment_entry/test_payment_entry.py

no changes added to commit (use "git add" and/or "git commit -a")

Cherry-pick of d6d0163 has failed:

On branch mergify/bp/version-13-hotfix/pr-34287
Your branch is ahead of 'origin/version-13-hotfix' by 11 commits.
  (use "git push" to publish your local commits)

You are currently cherry-picking commit d6d0163514.
  (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/payment_entry/test_payment_entry.py
	modified:   erpnext/accounts/doctype/sales_invoice/sales_invoice.js

Unmerged paths:
  (use "git add <file>..." to mark resolution)
	both modified:   erpnext/accounts/doctype/payment_entry/payment_entry.py
	both modified:   erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js
	both modified:   erpnext/buying/doctype/purchase_order/purchase_order.js
	both modified:   erpnext/public/js/controllers/transaction.js

Cherry-pick of 216a46b has failed:

On branch mergify/bp/version-13-hotfix/pr-34287
Your branch is ahead of 'origin/version-13-hotfix' by 12 commits.
  (use "git push" to publish your local commits)

You are currently cherry-picking commit 216a46bd66.
  (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/payment_entry/payment_entry.py
	modified:   erpnext/accounts/doctype/payment_entry/test_payment_entry.py

Unmerged paths:
  (use "git add <file>..." to mark resolution)
	both modified:   erpnext/accounts/doctype/accounts_settings/accounts_settings.json

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


Mergify commands and options

More conditions and actions can be found in the documentation.

You can also trigger Mergify actions by commenting on this pull request:

  • @Mergifyio refresh will re-evaluate the rules
  • @Mergifyio rebase will rebase this PR on its base branch
  • @Mergifyio update will merge the base branch into this PR
  • @Mergifyio backport <destination> will backport this PR on <destination> branch

Additionally, on Mergify dashboard you can:

  • look at your merge queues
  • generate the Mergify configuration with the config editor.

Finally, you can contact us on https://mergify.com

- Deductions in payment entry must be split into income loss and tax loss
- Compute total discount in percentage, makes discounting different amounts proportionately easier

(cherry picked from commit 768c3a4)
- Use field precision to get more accurate values

(cherry picked from commit dc2998f)
- Discount value was always trated as a percentage on back updation

(cherry picked from commit 2ae5834)
- Even via JS, deductions amount is always in company currency
- Since there is nothing dynamic about this field, set it in the doctype spec itself
- fixed: Inconsistency between label currency and field currency formatted value

(cherry picked from commit 7f2e7ba)
- misc: better docstring

(cherry picked from commit f02fc8a)
- Accounting is in the same currency if party currency and company currency is the same
- If accounting is in the same currency, paid and recvd amount is in the base currency
- Then, discount amount must also be in the base currency as it is deducted from paid amount
- Received amount must be in base currency if not multi currency
- cleanup: Deductions setting broken into smaller functions

(cherry picked from commit 761f68d)
- Return total discount loss in base currency
- Allocate payment based on terms: Set allocated amount in references table in base currency if accounting is in that currency
- Allocate payment based on terms: While back updating set paid amount (payment schedule) in transaction currency always
- minor: discount msgprint in correct currency

(cherry picked from commit b09c238)
…rency accounting + Early payment discount

(cherry picked from commit 9abf0ef)

# Conflicts:
#	erpnext/accounts/doctype/payment_entry/test_payment_entry.py
- Round off pending discount loss to avoid miniscule losses rounded to 0.0 that are added in deductions
- Use base amounts to calculate base losses instead of using conversion factor which increases rounding error
- Round of total base loss instead of individual income and tax losses to reduce rounding error
- Use default round off account for pending rounding loss in deductions

(cherry picked from commit caa1a3d)
… late

- Party could have paid on time but payment is recorded late
- Prompt for reference date so that discount is applied while mapping
- Prompt only if discount in payment schedule of valid doctypes
- test: Reference date and impact on PE
- `make_payment_entry` (JS) must be able to access `this`

(cherry picked from commit d6d0163)

# Conflicts:
#	erpnext/accounts/doctype/payment_entry/payment_entry.py
#	erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js
#	erpnext/buying/doctype/purchase_order/purchase_order.js
#	erpnext/public/js/controllers/transaction.js
- Checkbox in Accounts Settings
- Apply checkbox in PE deductions setting logic
- Adjust tests

(cherry picked from commit 216a46b)

# Conflicts:
#	erpnext/accounts/doctype/accounts_settings/accounts_settings.json
@marination
Copy link
Collaborator

@deepeshgarg007 hoping this can go in the v13 release 🤞

- Make sure check uses this field only for eligible documents
@deepeshgarg007 deepeshgarg007 merged commit 92a26dd into version-13-hotfix Apr 5, 2023
@mergify mergify bot deleted the mergify/bp/version-13-hotfix/pr-34287 branch April 5, 2023 06:26
@frappe-pr-bot
Copy link
Collaborator

🎉 This PR is included in version 13.49.12 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

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

Successfully merging this pull request may close these issues.

3 participants