fix: Invoice discounting test

This commit is contained in:
Deepesh Garg 2020-11-29 22:17:47 +05:30
parent 20d6143c38
commit 2d5530da96
2 changed files with 8 additions and 5 deletions

View File

@ -137,11 +137,12 @@ class InvoiceDiscounting(AccountsController):
"cost_center": erpnext.get_default_cost_center(self.company) "cost_center": erpnext.get_default_cost_center(self.company)
}) })
je.append("accounts", { if self.bank_charges:
"account": self.bank_charges_account, je.append("accounts", {
"debit_in_account_currency": flt(self.bank_charges), "account": self.bank_charges_account,
"cost_center": erpnext.get_default_cost_center(self.company) "debit_in_account_currency": flt(self.bank_charges),
}) "cost_center": erpnext.get_default_cost_center(self.company)
})
je.append("accounts", { je.append("accounts", {
"account": self.short_term_loan, "account": self.short_term_loan,

View File

@ -80,6 +80,7 @@ class TestInvoiceDiscounting(unittest.TestCase):
short_term_loan=self.short_term_loan, short_term_loan=self.short_term_loan,
bank_charges_account=self.bank_charges_account, bank_charges_account=self.bank_charges_account,
bank_account=self.bank_account, bank_account=self.bank_account,
bank_charges=100
) )
je = inv_disc.create_disbursement_entry() je = inv_disc.create_disbursement_entry()
@ -289,6 +290,7 @@ def create_invoice_discounting(invoices, **args):
inv_disc.bank_account=args.bank_account inv_disc.bank_account=args.bank_account
inv_disc.loan_start_date = args.start or nowdate() inv_disc.loan_start_date = args.start or nowdate()
inv_disc.loan_period = args.period or 30 inv_disc.loan_period = args.period or 30
inv_disc.bank_charges = flt(args.bank_charges)
for d in invoices: for d in invoices:
inv_disc.append("invoices", { inv_disc.append("invoices", {