refactor: move utility method to controller

(cherry picked from commit d1d06885dc)
This commit is contained in:
ruthra kumar
2025-02-28 17:30:25 +05:30
committed by Mergify
parent 231abab321
commit 615b0c40a3
3 changed files with 7 additions and 6 deletions

View File

@@ -871,14 +871,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"):

View File

@@ -1241,6 +1241,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):

View File

@@ -2758,6 +2758,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):