fix failing test case

This commit is contained in:
tunde 2017-09-20 12:26:19 +01:00
parent 4712ed6377
commit 35c84fe4f2
2 changed files with 13 additions and 22 deletions

View File

@ -762,29 +762,20 @@ def get_payment_entry(dt, dn, party_amount=None, bank_account=None, bank_amount=
pe.received_amount = received_amount
pe.allocate_payment_amount = 1
pe.letter_head = doc.get("letter_head")
args = {
'party_account': party_account, 'company': pe.company, 'party_type': pe.party_type,
'party': pe.party, 'posting_date': pe.posting_date
}
references = get_outstanding_reference_documents(args=args)
if doc.get("payment_schedule"):
for d in doc.get("payment_schedule"):
invoice_amount = d.payment_amount * doc.conversion_rate \
if party_account_currency == doc.company_currency else d.payment_amount
paid_amount = get_paid_amount(dt, dn, party_type, pe.party, party_account, d.due_date)
outstanding_amount = invoice_amount - paid_amount
pe.append("references", {
"reference_doctype": dt,
"reference_name": dn,
"due_date": d.due_date,
"total_amount": invoice_amount,
"outstanding_amount": outstanding_amount,
"allocated_amount": outstanding_amount
})
else:
for reference in references:
pe.append("references", {
"reference_doctype": dt,
"reference_name": dn,
"due_date": doc.get("due_date"),
"total_amount": grand_total,
"outstanding_amount": outstanding_amount,
"allocated_amount": outstanding_amount
'reference_doctype': reference.voucher_type,
'reference_name': reference.voucher_no,
'due_date': reference.due_date,
'total_amount': reference.invoice_amount,
'outstanding_amount': reference.outstanding_amount,
'allocated_amount': reference.outstanding_amount
})
pe.setup_party_account_field()

View File

@ -212,7 +212,7 @@ class TestPaymentEntry(unittest.TestCase):
self.assertRaises(InvalidPaymentEntry, pe1.validate)
si1 = create_sales_invoice()
si1 = create_sales_invoice()
# create full payment entry against si1
pe2 = get_payment_entry("Sales Invoice", si1.name, bank_account="_Test Cash - _TC")