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 #41523

Closed ruthra-kumar closed 1 month ago

ruthra-kumar 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