mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-26 08:24:47 +00:00
fix: Patch to fix the incorrect debit and credit in transaction currency
This commit is contained in:
@@ -364,3 +364,4 @@ erpnext.stock.doctype.delivery_note.patches.drop_unused_return_against_index # 2
|
|||||||
erpnext.patches.v14_0.set_maintain_stock_for_bom_item
|
erpnext.patches.v14_0.set_maintain_stock_for_bom_item
|
||||||
erpnext.patches.v15_0.delete_orphaned_asset_movement_item_records
|
erpnext.patches.v15_0.delete_orphaned_asset_movement_item_records
|
||||||
erpnext.patches.v15_0.remove_cancelled_asset_capitalization_from_asset
|
erpnext.patches.v15_0.remove_cancelled_asset_capitalization_from_asset
|
||||||
|
erpnext.patches.v15_0.fix_debit_credit_in_transaction_currency
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
import frappe
|
||||||
|
|
||||||
|
|
||||||
|
def execute():
|
||||||
|
# update debit and credit in transaction currency:
|
||||||
|
# if transaction currency is same as account currency,
|
||||||
|
# then debit and credit in transaction currency is same as debit and credit in account currency
|
||||||
|
# else debit and credit divided by exchange rate
|
||||||
|
|
||||||
|
# nosemgrep
|
||||||
|
frappe.db.sql(
|
||||||
|
"""
|
||||||
|
UPDATE `tabGL Entry`
|
||||||
|
SET
|
||||||
|
debit_in_transaction_currency = IF(transaction_currency = account_currency, debit_in_account_currency, debit / transaction_exchange_rate),
|
||||||
|
credit_in_transaction_currency = IF(transaction_currency = account_currency, credit_in_account_currency, credit / transaction_exchange_rate)
|
||||||
|
WHERE
|
||||||
|
transaction_exchange_rate > 0
|
||||||
|
and transaction_currency is not null
|
||||||
|
"""
|
||||||
|
)
|
||||||
Reference in New Issue
Block a user