Merge pull request #5131 from shreyasp/creditnote-print-format
[Fix] Correct amount shown in credit note print format
This commit is contained in:
commit
62be8dfd21
@ -353,25 +353,31 @@ class JournalEntry(AccountsController):
|
|||||||
self.remark = ("\n").join(r) #User Remarks is not mandatory
|
self.remark = ("\n").join(r) #User Remarks is not mandatory
|
||||||
|
|
||||||
def set_print_format_fields(self):
|
def set_print_format_fields(self):
|
||||||
total_amount = 0.0
|
bank_amount = party_amount = total_amount = 0.0
|
||||||
bank_account_currency = None
|
currency = bank_account_currency = party_account_currency = pay_to_recd_from= None
|
||||||
pay_to_recd_from = None
|
|
||||||
for d in self.get('accounts'):
|
for d in self.get('accounts'):
|
||||||
if d.party_type and d.party:
|
if d.party_type and d.party:
|
||||||
if not pay_to_recd_from:
|
if not pay_to_recd_from:
|
||||||
pay_to_recd_from = frappe.db.get_value(d.party_type, d.party,
|
pay_to_recd_from = frappe.db.get_value(d.party_type, d.party,
|
||||||
"customer_name" if d.party_type=="Customer" else "supplier_name")
|
"customer_name" if d.party_type=="Customer" else "supplier_name")
|
||||||
|
|
||||||
|
party_amount += (d.debit_in_account_currency or d.credit_in_account_currency)
|
||||||
|
party_account_currency = d.account_currency
|
||||||
|
|
||||||
elif frappe.db.get_value("Account", d.account, "account_type") in ["Bank", "Cash"]:
|
elif frappe.db.get_value("Account", d.account, "account_type") in ["Bank", "Cash"]:
|
||||||
total_amount += (d.debit_in_account_currency or d.credit_in_account_currency)
|
bank_amount += (d.debit_in_account_currency or d.credit_in_account_currency)
|
||||||
bank_account_currency = d.account_currency
|
bank_account_currency = d.account_currency
|
||||||
|
|
||||||
if pay_to_recd_from:
|
if pay_to_recd_from:
|
||||||
self.pay_to_recd_from = pay_to_recd_from
|
self.pay_to_recd_from = pay_to_recd_from
|
||||||
else:
|
if bank_amount:
|
||||||
total_amount = 0
|
total_amount = bank_amount
|
||||||
|
currency = bank_account_currency
|
||||||
|
else:
|
||||||
|
total_amount = party_amount
|
||||||
|
currency = party_account_currency
|
||||||
|
|
||||||
self.set_total_amount(total_amount, bank_account_currency)
|
self.set_total_amount(total_amount, currency)
|
||||||
|
|
||||||
def set_total_amount(self, amt, currency):
|
def set_total_amount(self, amt, currency):
|
||||||
self.total_amount = amt
|
self.total_amount = amt
|
||||||
|
Loading…
x
Reference in New Issue
Block a user