mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-26 16:34:46 +00:00
test: create customer credit limit on change
This commit is contained in:
@@ -29,7 +29,7 @@ def move_credit_limit_to_child_table():
|
|||||||
companies = frappe.get_all("Company", 'name')
|
companies = frappe.get_all("Company", 'name')
|
||||||
|
|
||||||
for record in credit_limit_record:
|
for record in credit_limit_record:
|
||||||
customer = frappe.get_doc("Customer", customer.name)
|
customer = frappe.get_doc("Customer", record.name)
|
||||||
for company in companies:
|
for company in companies:
|
||||||
customer.append("credit_limit_reference", {
|
customer.append("credit_limit_reference", {
|
||||||
'credit_limit': record.credit_limit,
|
'credit_limit': record.credit_limit,
|
||||||
|
|||||||
@@ -252,7 +252,10 @@ class TestCustomer(unittest.TestCase):
|
|||||||
def test_customer_credit_limit_on_change(self):
|
def test_customer_credit_limit_on_change(self):
|
||||||
outstanding_amt = self.get_customer_outstanding_amount()
|
outstanding_amt = self.get_customer_outstanding_amount()
|
||||||
customer = frappe.get_doc("Customer", '_Test Customer')
|
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)
|
self.assertRaises(frappe.ValidationError, customer.save)
|
||||||
|
|
||||||
def test_customer_payment_terms(self):
|
def test_customer_payment_terms(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user