frappe / erpnext

Free and Open Source Enterprise Resource Planning (ERP)
https://erpnext.com
GNU General Public License v3.0
17.42k stars 6.65k forks source link

fix: minor Dr and Cr between Purchase Receipt and Purchase Invoice (backport #41523) #41526

Closed mergify[bot] closed 4 weeks ago

mergify[bot] commented 1 month ago

With Provisional Accounting for Non-Stock Items enabled, with high precision exchange rates and large qty in Purchase Receipt and Purchase Invoice, there will be minor debit and credit differences between them.

Ex: For an exchange rate of 0.014783000, Purchase Receipt of 1000 qty with rate 111.11 and then a Purchase Invoice for it will post below ledger entries. There is a slight difference in Dr and Cr - 0.461. This difference is more pronounced in higher precision exchange rates and large quantities of items.

This is due to the different ways the Dr/Cr amounts are calculated. The Provisional ledger entries created by Purchase Invoice use the individual items' base_rate and qty, while the Purchase Receipt first calculates the total in transaction currency and then converts to base currency.

Without fix:

Account Voucher Type Voucher No Debit Credit
Cost of Goods Sold - DSE Purchase Receipt PR-24-00002-3 0 1643 created by Purchase Invoice
Stock Received But Not Billed - DSE Purchase Receipt PR-24-00002-3 1643 0 created by Purchase Invoice
Cost of Goods Sold - DSE Purchase Receipt PR-24-00002-3 1642.539 0
Stock Received But Not Billed - DSE Purchase Receipt PR-24-00002-3 0 1642.539

With fix:

Account Voucher Type Voucher No Debit Credit
Cost of Goods Sold - DSE Purchase Receipt PR-24-00002-3 0 1642.539 created by Purchase Invoice
Stock Received But Not Billed - DSE Purchase Receipt PR-24-00002-3 1642.539 0 created by Purchase Invoice
Cost of Goods Sold - DSE Purchase Receipt PR-24-00002-3 1642.539 0
Stock Received But Not Billed - DSE Purchase Receipt PR-24-00002-3 0 1642.539
This is an automatic backport of pull request #41523 done by Mergify.
mergify[bot] commented 1 month ago

Cherry-pick of 1c0a24424a1f585c4b3a736fe92b419567b9da1e has failed:

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

You are currently cherry-picking commit 1c0a24424a.
  (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/purchase_invoice/purchase_invoice.py

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

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

frappe-pr-bot commented 3 weeks ago

:tada: This PR is included in version 15.25.0 :tada:

The release is available on GitHub release

Your semantic-release bot :package::rocket: