From 18eb8c5f68834d69d0f2c38afc8934c55e3e7f74 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 5 Feb 2014 15:05:54 +0530 Subject: [PATCH 1/6] fixed unicode and null issue in sms center --- utilities/doctype/sms_control/sms_control.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utilities/doctype/sms_control/sms_control.py b/utilities/doctype/sms_control/sms_control.py index 5a9777a8a8..8b5a50afe1 100644 --- a/utilities/doctype/sms_control/sms_control.py +++ b/utilities/doctype/sms_control/sms_control.py @@ -55,7 +55,7 @@ class DocType: def send_form_sms(self, arg): "called from client side" args = load_json(arg) - self.send_sms([str(args['number'])], str(args['message'])) + self.send_sms([cstr(args['number'])], cstr(args['message'])) def send_sms(self, receiver_list, msg, sender_name = ''): receiver_list = self.validate_receiver_nos(receiver_list) From a7af1d619e885e2233b2ac317776d0f76d16ac98 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 5 Feb 2014 18:15:12 +0530 Subject: [PATCH 2/6] Fix in accounts receivable report --- .../accounts_receivable/accounts_receivable.py | 6 ++---- accounts/utils.py | 13 ++++++++----- buying/doctype/supplier/supplier.py | 2 +- selling/doctype/customer/customer.py | 2 +- stock/doctype/warehouse/warehouse.py | 2 +- 5 files changed, 13 insertions(+), 12 deletions(-) diff --git a/accounts/report/accounts_receivable/accounts_receivable.py b/accounts/report/accounts_receivable/accounts_receivable.py index eb8c91f99f..f23193274a 100644 --- a/accounts/report/accounts_receivable/accounts_receivable.py +++ b/accounts/report/accounts_receivable/accounts_receivable.py @@ -113,9 +113,8 @@ class AccountsReceivableReport(object): if not hasattr(self, "account_map"): self.account_map = dict(((r.name, r) for r in webnotes.conn.sql("""select acc.name, cust.name as customer, cust.customer_name, cust.territory - from `tabAccount` acc, `tabCustomer` cust - where acc.master_type="Customer" - and cust.name=acc.master_name""", as_dict=True))) + from `tabAccount` acc left join `tabCustomer` cust + on cust.name=acc.master_name where acc.master_type="Customer" """, as_dict=True))) return self.account_map @@ -134,7 +133,6 @@ class AccountsReceivableReport(object): self.gl_entries = webnotes.conn.sql("""select * from `tabGL Entry` where docstatus < 2 {0} order by posting_date, account""".format(conditions), values, as_dict=True) - return self.gl_entries def prepare_conditions(self): diff --git a/accounts/utils.py b/accounts/utils.py index a3557aed09..3c394c6b0f 100644 --- a/accounts/utils.py +++ b/accounts/utils.py @@ -356,20 +356,23 @@ def get_actual_expense(args): and fiscal_year='%(fiscal_year)s' and company='%(company)s' %(condition)s """ % (args))[0][0] -def rename_account_for(dt, olddn, newdn, merge): +def rename_account_for(dt, olddn, newdn, merge, company): old_account = get_account_for(dt, olddn) if old_account: new_account = None if not merge: - if old_account == olddn: - new_account = webnotes.rename_doc("Account", olddn, newdn) + if old_account == add_abbr_if_missing(olddn, company): + new_account = webnotes.rename_doc("Account", old_account, newdn) else: existing_new_account = get_account_for(dt, newdn) new_account = webnotes.rename_doc("Account", old_account, existing_new_account or newdn, merge=True if existing_new_account else False) - if new_account: - webnotes.conn.set_value("Account", new_account, "master_name", newdn) + webnotes.conn.set_value("Account", new_account or old_account, "master_name", newdn) + +def add_abbr_if_missing(dn, company): + from setup.doctype.company.company import get_name_with_abbr + return get_name_with_abbr(dn, company) def get_account_for(account_for_doctype, account_for): if account_for_doctype in ["Customer", "Supplier"]: diff --git a/buying/doctype/supplier/supplier.py b/buying/doctype/supplier/supplier.py index 2435d0cc31..cea44d6c68 100644 --- a/buying/doctype/supplier/supplier.py +++ b/buying/doctype/supplier/supplier.py @@ -161,7 +161,7 @@ class DocType(TransactionBase): def before_rename(self, olddn, newdn, merge=False): from accounts.utils import rename_account_for - rename_account_for("Supplier", olddn, newdn, merge) + rename_account_for("Supplier", olddn, newdn, merge, self.doc.company) def after_rename(self, olddn, newdn, merge=False): set_field = '' diff --git a/selling/doctype/customer/customer.py b/selling/doctype/customer/customer.py index 49296b0b1c..0b2cef824a 100644 --- a/selling/doctype/customer/customer.py +++ b/selling/doctype/customer/customer.py @@ -156,7 +156,7 @@ class DocType(TransactionBase): def before_rename(self, olddn, newdn, merge=False): from accounts.utils import rename_account_for - rename_account_for("Customer", olddn, newdn, merge) + rename_account_for("Customer", olddn, newdn, merge, self.doc.company) def after_rename(self, olddn, newdn, merge=False): set_field = '' diff --git a/stock/doctype/warehouse/warehouse.py b/stock/doctype/warehouse/warehouse.py index 0b2fa840c5..fa88a40998 100644 --- a/stock/doctype/warehouse/warehouse.py +++ b/stock/doctype/warehouse/warehouse.py @@ -102,7 +102,7 @@ class DocType: webnotes.conn.sql("delete from `tabBin` where warehouse=%s", olddn) from accounts.utils import rename_account_for - rename_account_for("Warehouse", olddn, newdn, merge) + rename_account_for("Warehouse", olddn, newdn, merge, self.doc.company) return newdn From dbbba659a8c716a4707dd17ed92ea4f83866c473 Mon Sep 17 00:00:00 2001 From: Pratik Vyas Date: Wed, 5 Feb 2014 19:19:29 +0600 Subject: [PATCH 3/6] bumped to version 3.8.2 --- config.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config.json b/config.json index 89e28c0ac7..149f7a9c36 100644 --- a/config.json +++ b/config.json @@ -1,6 +1,6 @@ { "app_name": "ERPNext", - "app_version": "3.8.1", + "app_version": "3.8.2", "base_template": "app/portal/templates/base.html", "modules": { "Accounts": { @@ -74,5 +74,5 @@ "type": "module" } }, - "requires_framework_version": "==3.9.0" + "requires_framework_version": "==3.9.1" } \ No newline at end of file From 4078ef8ef5ff2a0e7c3affd0607db08cfd64e03f Mon Sep 17 00:00:00 2001 From: Pratik Vyas Date: Thu, 6 Feb 2014 13:06:10 +0530 Subject: [PATCH 4/6] add travis build script --- .travis.yml | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000000..c6402feace --- /dev/null +++ b/.travis.yml @@ -0,0 +1,30 @@ +anguage: python + +python: + - "2.7" + +services: + - mysql + +install: + - pip install git+https://github.com/webnotes/wnframework.git@4.0.0-wip && + - pip install --editable . + +script: + cd ./test_sites/ && + webnotes --reinstall -v test_site && + webnotes --install_app erpnext -v test_site && + webnotes --run_tests -v test_site --app erpnext + +branches: + except: + - develop + - master + - 3.x.x + - slow + - webshop_refactor + +before_script: + - mysql -e 'create database travis' && + - echo "USE mysql;\nUPDATE user SET password=PASSWORD('travis') WHERE user='travis';\nFLUSH PRIVILEGES;\n" | mysql -u root + From 70e2a50f0f7f321dd5fdcfc740e2089a4c2f5239 Mon Sep 17 00:00:00 2001 From: Pratik Vyas Date: Thu, 6 Feb 2014 14:07:15 +0530 Subject: [PATCH 5/6] fix travis build script typo --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index c6402feace..41ba344237 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,4 @@ -anguage: python +language: python python: - "2.7" From 07d4c373f36491c8db4621f97259638b2aec317c Mon Sep 17 00:00:00 2001 From: Pratik Vyas Date: Thu, 6 Feb 2014 15:57:11 +0600 Subject: [PATCH 6/6] bumped to version 3.8.3 --- config.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config.json b/config.json index 149f7a9c36..dba2e815f8 100644 --- a/config.json +++ b/config.json @@ -1,6 +1,6 @@ { "app_name": "ERPNext", - "app_version": "3.8.2", + "app_version": "3.8.3", "base_template": "app/portal/templates/base.html", "modules": { "Accounts": { @@ -74,5 +74,5 @@ "type": "module" } }, - "requires_framework_version": "==3.9.1" + "requires_framework_version": "==3.9.2" } \ No newline at end of file