fix failing tests

This commit is contained in:
tunde
2017-09-08 15:35:59 +01:00
parent 225ac0dac3
commit 96b8f223fd
2 changed files with 17 additions and 19 deletions

View File

@@ -609,11 +609,14 @@ class AccountsController(TransactionBase):
def set_payment_schedule(self):
due_date = self.due_date or get_due_date(self.posting_date)
self.append("payment_schedule", {
"due_date": due_date,
"invoice_portion": 100,
"payment_amount": self.grand_total
})
if self.get("payment_terms_template"):
data = get_payment_terms(self.payment_terms_template, self.posting_date, self.grand_total)
for item in data:
self.append("payment_schedule", item)
else:
data = dict(due_date=due_date, invoice_portion=100, payment_amount=self.grand_total)
self.append("payment_schedule", data)
def set_due_date(self):
self.due_date = max([d.due_date for d in self.get("payment_schedule")])
@@ -845,4 +848,4 @@ def get_due_date(posting_date, term):
elif term.due_date_based_on == "Month(s) after the end of the invoice month":
due_date = add_months(get_last_day(posting_date), term.credit_months)
return due_date
return due_date