diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py index 7abf810ab36..f5ed57b8e24 100644 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py @@ -873,14 +873,9 @@ class PurchaseInvoice(BuyingController): self.make_payment_gl_entries(gl_entries) self.make_write_off_gl_entry(gl_entries) self.make_gle_for_rounding_adjustment(gl_entries) - self.set_transaction_currency_rate(gl_entries) + self.set_transaction_currency_and_rate_in_gl_map(gl_entries) return gl_entries - def set_transaction_currency_rate(self, gl_entries): - for x in gl_entries: - x["transaction_currency"] = self.currency - x["transaction_exchange_rate"] = self.get("conversion_rate") or 1 - def check_asset_cwip_enabled(self): # Check if there exists any item with cwip accounting enabled in it's asset category for item in self.get("items"): diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py index b7e6ead7653..dd0d52f4fa2 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py @@ -1238,6 +1238,7 @@ class SalesInvoice(SellingController): self.make_write_off_gl_entry(gl_entries) self.make_gle_for_rounding_adjustment(gl_entries) + self.set_transaction_currency_and_rate_in_gl_map(gl_entries) return gl_entries def make_customer_gl_entry(self, gl_entries): diff --git a/erpnext/controllers/accounts_controller.py b/erpnext/controllers/accounts_controller.py index 130475b98ee..2a6824e5f19 100644 --- a/erpnext/controllers/accounts_controller.py +++ b/erpnext/controllers/accounts_controller.py @@ -2782,6 +2782,11 @@ class AccountsController(TransactionBase): elif self.doctype == "Payment Entry": self.make_advance_payment_ledger_for_payment() + def set_transaction_currency_and_rate_in_gl_map(self, gl_entries): + for x in gl_entries: + x["transaction_currency"] = self.currency + x["transaction_exchange_rate"] = self.get("conversion_rate") or 1 + @frappe.whitelist() def get_tax_rate(account_head):