From 9da0bf6106e200ab493d5b0e094971333d084b5e Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Wed, 23 May 2012 18:27:05 +0530 Subject: [PATCH] fix in customer address contact report --- .../reload_customer_address_contact.py | 4 +++ erpnext/patches/patch_list.py | 6 ++++- .../customer_address_contact.py | 22 ++++++++++++++++ .../customer_address_contact.sql | 26 +++++++++++++++++++ .../customer_address_contact.txt | 9 ++----- 5 files changed, 59 insertions(+), 8 deletions(-) create mode 100644 erpnext/patches/may_2012/reload_customer_address_contact.py create mode 100644 erpnext/selling/search_criteria/customer_address_contact/customer_address_contact.py create mode 100644 erpnext/selling/search_criteria/customer_address_contact/customer_address_contact.sql diff --git a/erpnext/patches/may_2012/reload_customer_address_contact.py b/erpnext/patches/may_2012/reload_customer_address_contact.py new file mode 100644 index 00000000000..9a3107975b6 --- /dev/null +++ b/erpnext/patches/may_2012/reload_customer_address_contact.py @@ -0,0 +1,4 @@ +def execute(): + import webnotes + import webnotes.modules + webnotes.modules.reload_doc('selling', 'search_criteria', 'customer_address_contact') \ No newline at end of file diff --git a/erpnext/patches/patch_list.py b/erpnext/patches/patch_list.py index b38bcaadf6d..13a411c926f 100644 --- a/erpnext/patches/patch_list.py +++ b/erpnext/patches/patch_list.py @@ -392,5 +392,9 @@ patch_list = [ 'patch_file': 'create_report_manager_role', 'description': 'Create report manager role if not exists' }, - + { + 'patch_module': 'patches.may_2012', + 'patch_file': 'reload_customer_address_contact', + 'description': 'Reload report customer address contact' + }, ] \ No newline at end of file diff --git a/erpnext/selling/search_criteria/customer_address_contact/customer_address_contact.py b/erpnext/selling/search_criteria/customer_address_contact/customer_address_contact.py new file mode 100644 index 00000000000..2d3e4c304bf --- /dev/null +++ b/erpnext/selling/search_criteria/customer_address_contact/customer_address_contact.py @@ -0,0 +1,22 @@ +col_defs = [ + {'label': 'Id', 'type': 'Link', 'width': '', 'options': 'Customer'}, + {'label': 'Customer Name'}, + {'label': 'Address Line 1', 'width': '200px'}, + {'label': 'Address Line 2', 'width': '200px'}, + {'label': 'City'}, + {'label': 'State'}, + {'label': 'Pincode', 'width': '80px'}, + {'label': 'Country', 'width': '100px'}, + {'label': 'Contact First Name'}, + {'label': 'Contact Last Name'}, + {'label': 'Contact Phone', 'width': '100px'}, + {'label': 'Contact Mobile', 'width': '100px'}, + {'label': 'Contact Email'}, +] +webnotes.msgprint(colnames) +for col in col_defs: + colnames.append(col['label']) + coltypes.append(col.get('type') or 'Data') + colwidths.append(col.get('width') or '150px') + coloptions.append(col.get('options') or '') + col_idx[col['label']] = len(colnames) - 1 \ No newline at end of file diff --git a/erpnext/selling/search_criteria/customer_address_contact/customer_address_contact.sql b/erpnext/selling/search_criteria/customer_address_contact/customer_address_contact.sql new file mode 100644 index 00000000000..3752ebc04ec --- /dev/null +++ b/erpnext/selling/search_criteria/customer_address_contact/customer_address_contact.sql @@ -0,0 +1,26 @@ +select + `tabCustomer`.name, + `tabCustomer`.customer_name, + `tabAddress`.address_line1, + `tabAddress`.address_line2, + `tabAddress`.city, + `tabAddress`.state, + `tabAddress`.pincode, + `tabAddress`.country, + `tabContact`.first_name, + `tabContact`.last_name, + `tabContact`.phone, + `tabContact`.mobile_no, + `tabContact`.email_id +from + `tabCustomer` + left join `tabAddress` on ( + `tabAddress`.customer=`tabCustomer`.name and + ifnull(`tabAddress`.is_primary_address, 0)=1 + ) + left join `tabContact` on ( + `tabContact`.customer=`tabCustomer`.name and + ifnull(`tabContact`.is_primary_contact, 0)=1 + ) +order by + `tabCustomer`.customer_name asc \ No newline at end of file diff --git a/erpnext/selling/search_criteria/customer_address_contact/customer_address_contact.txt b/erpnext/selling/search_criteria/customer_address_contact/customer_address_contact.txt index 52d6d63f3c5..3c94a520b8f 100644 --- a/erpnext/selling/search_criteria/customer_address_contact/customer_address_contact.txt +++ b/erpnext/selling/search_criteria/customer_address_contact/customer_address_contact.txt @@ -3,18 +3,15 @@ # These values are common in all dictionaries { - 'creation': '2012-04-03 12:49:51', + 'creation': '2012-04-17 11:29:10', 'docstatus': 0, - 'modified': '2012-04-03 12:49:51', + 'modified': '2012-05-23 18:17:40', 'modified_by': u'Administrator', 'owner': u'Administrator' }, # These values are common for all Search Criteria { - 'add_col': u"`tabAddress`.address_line1 AS 'Address Line 1'\n`tabAddress`.address_line2 AS 'Address Line 2'\n`tabAddress`.city AS 'City'\n`tabAddress`.state AS 'State'\n`tabAddress`.pincode AS 'Pincode'\n`tabAddress`.country AS 'Country'\n`tabContact`.first_name AS 'Contact First Name'\n`tabContact`.last_name AS 'Contact Last Name'\n`tabContact`.phone AS 'Contact Phone'\n`tabContact`.mobile_no AS 'Contact Mobile'\n`tabContact`.email_id AS 'Contact Email'", - 'add_cond': u'`tabAddress`.customer=`tabCustomer`.name\nifnull(`tabAddress`.is_primary_address, 0)=1\n`tabContact`.customer=`tabCustomer`.name\nifnull(`tabContact`.is_primary_contact, 0)=1', - 'add_tab': u'`tabAddress`\n`tabContact`', 'columns': u'Customer\x01ID,Customer\x01Customer Name', 'criteria_name': u'Customer Address Contact', 'doc_type': u'Customer', @@ -23,8 +20,6 @@ 'module': u'Selling', 'name': '__common__', 'page_len': 50, - 'sort_by': u'`tabCustomer`.`customer_name`', - 'sort_order': u'ASC', 'standard': u'Yes' },