test: create customer credit limit on change

This commit is contained in:
Mangesh-Khairnar 2019-09-02 23:18:36 +05:30
parent 86720deeae
commit cf901da25d
2 changed files with 5 additions and 2 deletions

View File

@ -29,7 +29,7 @@ def move_credit_limit_to_child_table():
companies = frappe.get_all("Company", 'name')
for record in credit_limit_record:
customer = frappe.get_doc("Customer", customer.name)
customer = frappe.get_doc("Customer", record.name)
for company in companies:
customer.append("credit_limit_reference", {
'credit_limit': record.credit_limit,

View File

@ -252,7 +252,10 @@ class TestCustomer(unittest.TestCase):
def test_customer_credit_limit_on_change(self):
outstanding_amt = self.get_customer_outstanding_amount()
customer = frappe.get_doc("Customer", '_Test Customer')
customer.credit_limit_reference[0].credit_limit = flt(outstanding_amt - 100)
customer.append('credit_limit_reference', {'credit_limit': flt(outstanding_amt - 100), 'company': '_Test Company'})
''' define new credit limit for same company '''
customer.append('credit_limit_reference', {'credit_limit': flt(outstanding_amt - 100), 'company': '_Test Company'})
self.assertRaises(frappe.ValidationError, customer.save)
def test_customer_payment_terms(self):