Merge pull request #36684 from deepeshgarg007/gl_transaction_currency

feat: Transaction currency columns in GL report
This commit is contained in:
Deepesh Garg
2023-08-17 16:06:23 +05:30
committed by GitHub
4 changed files with 94 additions and 4 deletions

View File

@@ -805,8 +805,28 @@ class AccountsController(TransactionBase):
gl_dict, account_currency, self.get("conversion_rate"), self.company_currency
)
# Update details in transaction currency
gl_dict.update(
{
"transaction_currency": 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"
),
"credit_in_transaction_currency": self.get_value_in_transaction_currency(
account_currency, args, "credit"
),
}
)
return gl_dict
def get_value_in_transaction_currency(self, account_currency, args, field):
if account_currency == self.get("currency"):
return args.get(field + "_in_account_currency")
else:
return flt(args.get(field, 0) / self.get("conversion_rate", 1))
def validate_qty_is_not_zero(self):
if self.doctype != "Purchase Receipt":
for item in self.items: