Browse Source

Merge branch 'mntechnique-show_address_in_online_pos' into develop

develop
Nabin Hait 7 years ago
parent
commit
b005950ba7
  1. 36
      erpnext/selling/doctype/customer/customer.js
  2. 88
      erpnext/selling/doctype/customer/customer.json
  3. 12
      erpnext/selling/doctype/customer/customer.py

36
erpnext/selling/doctype/customer/customer.js

@ -33,7 +33,39 @@ frappe.ui.form.on("Customer", {
}
}
})
frm.set_query('customer_primary_address', function(doc) {
return {
query: "erpnext.selling.doctype.customer.customer.get_customer_primary_address",
filters: {
'customer': doc.name
}
}
})
},
customer_primary_address: function(frm){
if(frm.doc.customer_primary_address){
frappe.call({
doc: frm.doc,
args: {
"address_title": frm.doc.customer_primary_address
},
method: 'frappe.contacts.doctype.address.address.get_address_display',
callback: function(r) {
frm.set_value("primary_address", r.message);
}
});
}
if(!frm.doc.customer_primary_address){
frm.set_value("primary_address", "");
}
},
customer_primary_contact: function(frm){
if(!frm.doc.customer_primary_contact){
frm.set_value("mobile_no", "");
frm.set_value("email_id", "");
}
},
refresh: function(frm) {
if(frappe.defaults.get_default("cust_master_name")!="Naming Series") {
frm.toggle_display("naming_series", false);
@ -43,7 +75,7 @@ frappe.ui.form.on("Customer", {
frappe.dynamic_link = {doc: frm.doc, fieldname: 'name', doctype: 'Customer'}
frm.toggle_display(['address_html','contact_html','primary_contact_detail'], !frm.doc.__islocal);
frm.toggle_display(['address_html','contact_html','primary_address_and_contact_detail'], !frm.doc.__islocal);
if(!frm.doc.__islocal) {
frappe.contacts.render_address_and_contact(frm);
@ -72,4 +104,4 @@ frappe.ui.form.on("Customer", {
validate: function(frm) {
if(frm.doc.lead_name) frappe.model.clear_doc("Lead", frm.doc.lead_name);
},
});
});

88
erpnext/selling/doctype/customer/customer.json

@ -725,7 +725,8 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "primary_contact_detail",
"description": "Select, to make the customer searchable with these fields",
"fieldname": "primary_address_and_contact_detail",
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
@ -734,7 +735,7 @@
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Primary Contact Detail",
"label": "Primary Address and Contact Detail",
"length": 0,
"no_copy": 0,
"permlevel": 0,
@ -755,6 +756,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
"description": "Reselect, if the chosen contact is edited after save",
"fieldname": "customer_primary_contact",
"fieldtype": "Link",
"hidden": 0,
@ -780,6 +782,68 @@
"set_only_once": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "mobile_no",
"fieldtype": "Read Only",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Mobile No",
"length": 0,
"no_copy": 0,
"options": "customer_primary_contact.mobile_no",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "email_id",
"fieldtype": "Read Only",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Email Id",
"length": 0,
"no_copy": 0,
"options": "customer_primary_contact.email_id",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
@ -815,8 +879,9 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "mobile_no",
"fieldtype": "Read Only",
"description": "Reselect, if the chosen address is edited after save",
"fieldname": "customer_primary_address",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
@ -824,10 +889,10 @@
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Mobile Number",
"label": "Customer Primary Address",
"length": 0,
"no_copy": 0,
"options": "customer_primary_contact.mobile_no",
"options": "Address",
"permlevel": 0,
"precision": "",
"print_hide": 0,
@ -846,7 +911,8 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "email_id",
"default": "",
"fieldname": "primary_address",
"fieldtype": "Read Only",
"hidden": 0,
"ignore_user_permissions": 0,
@ -855,10 +921,10 @@
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Email Id",
"label": "Primary Address",
"length": 0,
"no_copy": 0,
"options": "customer_primary_contact.email_id",
"options": "",
"permlevel": 0,
"precision": "",
"print_hide": 0,
@ -1383,7 +1449,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 0,
"modified": "2018-01-30 11:52:05.497363",
"modified": "2018-02-09 10:44:35.801716",
"modified_by": "Administrator",
"module": "Selling",
"name": "Customer",
@ -1574,7 +1640,7 @@
"quick_entry": 1,
"read_only": 0,
"read_only_onload": 0,
"search_fields": "customer_name,customer_group,territory, mobile_no",
"search_fields": "customer_name,customer_group,territory, mobile_no,primary_address",
"show_name_in_global_search": 1,
"sort_order": "ASC",
"title_field": "customer_name",

12
erpnext/selling/doctype/customer/customer.py

@ -309,3 +309,15 @@ def get_customer_primary_contact(doctype, txt, searchfield, start, page_len, fil
'customer': customer,
'txt': '%%%s%%' % txt
})
def get_customer_primary_address(doctype, txt, searchfield, start, page_len, filters):
customer = frappe.db.escape(filters.get('customer'))
return frappe.db.sql("""
select `tabAddress`.name from `tabAddress`, `tabDynamic Link`
where `tabAddress`.name = `tabDynamic Link`.parent and `tabDynamic Link`.link_name = %(customer)s
and `tabDynamic Link`.link_doctype = 'Customer' and `tabAddress`.is_primary_address = 1
and `tabAddress`.name like %(txt)s
""", {
'customer': customer,
'txt': '%%%s%%' % txt
})
Loading…
Cancel
Save