fix: GL values in transaction currency via JV (#38914)

This commit is contained in:
Deepesh Garg
2023-12-31 20:00:03 +05:30
committed by GitHub
parent 877cc7255d
commit 3f9693b31f
2 changed files with 27 additions and 3 deletions

View File

@@ -922,7 +922,7 @@ class AccountsController(TransactionBase):
# Update details in transaction currency
gl_dict.update(
{
"transaction_currency": self.get("currency") or self.company_currency,
"transaction_currency": args.get("currency") or self.get("currency") or self.company_currency,
"transaction_exchange_rate": self.get("conversion_rate", 1),
"debit_in_transaction_currency": self.get_value_in_transaction_currency(
account_currency, args, "debit"
@@ -955,10 +955,10 @@ class AccountsController(TransactionBase):
return self.doctype
def get_value_in_transaction_currency(self, account_currency, args, field):
if account_currency == self.get("currency"):
if account_currency == args.get("currency") or self.get("currency"):
return args.get(field + "_in_account_currency")
else:
return flt(args.get(field, 0) / self.get("conversion_rate", 1))
return flt(args.get(field, 0) / (args.get("conversion_rate") or self.get("conversion_rate", 1)))
def validate_qty_is_not_zero(self):
if self.doctype == "Purchase Receipt":