From 9dfc0f32ab2e3db4f44741f120d0ecde390b9d9b Mon Sep 17 00:00:00 2001 From: ashish Date: Thu, 26 Oct 2017 20:07:32 +0530 Subject: [PATCH] customer.json -- a checkbox field is added which gives user ability to bypass credit limit check at sales order level for a customer. It is default to 0. Also patch is added to update value of new field to 0 after migrate. test_customer.js -- It is auto generated file as customer.json is modified. And it is removed. --- erpnext/patches.txt | 1 + ...reditlimitcheckatsalesorder_in_customer.py | 10 ++++++++ .../selling/doctype/customer/customer.json | 3 ++- .../selling/doctype/customer/test_customer.js | 23 ------------------- 4 files changed, 13 insertions(+), 24 deletions(-) create mode 100644 erpnext/patches/v9_0/set_bypasscreditlimitcheckatsalesorder_in_customer.py delete mode 100644 erpnext/selling/doctype/customer/test_customer.js diff --git a/erpnext/patches.txt b/erpnext/patches.txt index fd7a1b4da6..41999a99b7 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -455,3 +455,4 @@ erpnext.patches.v9_0.add_healthcare_domain erpnext.patches.v9_0.set_variant_item_description erpnext.patches.v9_0.set_uoms_in_variant_field erpnext.patches.v9_0.copy_old_fees_field_data +erpnext.patches.v9_0.set_bypasscreditlimitcheckatsalesorder_in_customer diff --git a/erpnext/patches/v9_0/set_bypasscreditlimitcheckatsalesorder_in_customer.py b/erpnext/patches/v9_0/set_bypasscreditlimitcheckatsalesorder_in_customer.py new file mode 100644 index 0000000000..e94a5081f0 --- /dev/null +++ b/erpnext/patches/v9_0/set_bypasscreditlimitcheckatsalesorder_in_customer.py @@ -0,0 +1,10 @@ +import frappe + +def execute(): + frappe.reload_doctype("Customer") + + if "bypass_credit_limit_check_at_sales_order" in frappe.db.get_table_columns("Customer"): + frappe.db.sql(""" + update `tabCustomer` + set bypass_credit_limit_check_at_sales_order = 0 + where (bypass_credit_limit_check_at_sales_order is NULL)""") \ No newline at end of file diff --git a/erpnext/selling/doctype/customer/customer.json b/erpnext/selling/doctype/customer/customer.json index f231b85c65..24b1968d5f 100644 --- a/erpnext/selling/doctype/customer/customer.json +++ b/erpnext/selling/doctype/customer/customer.json @@ -913,6 +913,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "default": "0", "fieldname": "bypass_credit_limit_check_at_sales_order", "fieldtype": "Check", "hidden": 0, @@ -1232,7 +1233,7 @@ "issingle": 0, "istable": 0, "max_attachments": 0, - "modified": "2017-10-24 14:44:48.508334", + "modified": "2017-10-26 16:21:18.028471", "modified_by": "Administrator", "module": "Selling", "name": "Customer", diff --git a/erpnext/selling/doctype/customer/test_customer.js b/erpnext/selling/doctype/customer/test_customer.js deleted file mode 100644 index 65b81af32c..0000000000 --- a/erpnext/selling/doctype/customer/test_customer.js +++ /dev/null @@ -1,23 +0,0 @@ -/* eslint-disable */ -// rename this file from _test_[name] to test_[name] to activate -// and remove above this line - -QUnit.test("test: Customer", function (assert) { - let done = assert.async(); - - // number of asserts - assert.expect(1); - - frappe.run_serially([ - // insert a new Customer - () => frappe.tests.make('Customer', [ - // values to be set - {key: 'value'} - ]), - () => { - assert.equal(cur_frm.doc.key, 'value'); - }, - () => done() - ]); - -});