[cleanup] [minor] fetch lead details in opportunity
diff --git a/selling/doctype/lead/lead.js b/selling/doctype/lead/lead.js
index a3ae783..3c6fda7 100644
--- a/selling/doctype/lead/lead.js
+++ b/selling/doctype/lead/lead.js
@@ -33,16 +33,7 @@
var doc = this.frm.doc;
erpnext.hide_naming_series();
this.frm.clear_custom_buttons();
-
- this.frm.dashboard.reset(doc);
- if(!doc.__islocal) {
- if(doc.status=="Converted") {
- this.frm.dashboard.set_headline_alert(wn._("Converted"), "alert-success", "icon-ok-sign");
- } else {
- this.frm.dashboard.set_headline_alert(wn._(doc.status), "alert-info", "icon-exclamation-sign");
- }
- }
-
+
this.frm.__is_customer = this.frm.__is_customer || this.frm.doc.__is_customer;
if(!this.frm.doc.__islocal && !this.frm.__is_customer) {
this.frm.add_custom_button("Create Customer", this.create_customer);
diff --git a/selling/doctype/lead/lead.py b/selling/doctype/lead/lead.py
index da11410..316481c 100644
--- a/selling/doctype/lead/lead.py
+++ b/selling/doctype/lead/lead.py
@@ -126,6 +126,10 @@
"campaign_name": "campaign",
"doctype": "enquiry_from",
"name": "lead",
+ "lead_name": "contact_display",
+ "company_name": "customer_name",
+ "email_id": "contact_email",
+ "mobile_no": "contact_mobile"
}
}}, target_doclist)
diff --git a/selling/doctype/opportunity/opportunity.js b/selling/doctype/opportunity/opportunity.js
index 1ec3f3f..25f28bf 100644
--- a/selling/doctype/opportunity/opportunity.js
+++ b/selling/doctype/opportunity/opportunity.js
@@ -53,6 +53,11 @@
this.frm.set_query("contact_by", erpnext.queries.profile);
}
+ this.frm.set_query("customer_address", function() {
+ if(me.frm.doc.lead) return {filters: { lead: me.frm.doc.lead } };
+ else if(me.frm.doc.customer) return {filters: { customer: me.frm.doc.customer } };
+ });
+
this.frm.set_query("item_code", "enquiry_details", function() {
return {
query: "controllers.queries.item_query",
@@ -63,7 +68,6 @@
$.each([["lead", "lead"],
["customer", "customer"],
- ["customer_address", "customer_filter"],
["contact_person", "customer_filter"],
["territory", "not_a_group_filter"]], function(i, opts) {
me.frm.set_query(opts[0], erpnext.queries[opts[1]]);
@@ -151,8 +155,14 @@
}
}
-cur_frm.cscript.customer_address = cur_frm.cscript.contact_person = function(doc,dt,dn) {
- if(doc.customer) return get_server_fields('get_customer_address', JSON.stringify({customer: doc.customer, address: doc.customer_address, contact: doc.contact_person}),'', doc, dt, dn, 1);
+cur_frm.cscript.customer_address = cur_frm.cscript.contact_person = function(doc, dt, dn) {
+ args = {
+ address: doc.customer_address,
+ contact: doc.contact_person
+ }
+ if(doc.customer) args.update({customer: doc.customer});
+
+ return get_server_fields('get_customer_address', JSON.stringify(args),'', doc, dt, dn, 1);
}
cur_frm.cscript.lead = function(doc, cdt, cdn) {
@@ -163,7 +173,7 @@
source_name: cur_frm.doc.lead
})
- unhide_field(['customer_name', 'address_display','contact_mobile',
+ unhide_field(['customer_name', 'address_display','contact_mobile', 'customer_address',
'contact_email', 'territory']);
}
diff --git a/selling/doctype/opportunity/opportunity.txt b/selling/doctype/opportunity/opportunity.txt
index a904f56..aeedd08 100644
--- a/selling/doctype/opportunity/opportunity.txt
+++ b/selling/doctype/opportunity/opportunity.txt
@@ -2,7 +2,7 @@
{
"creation": "2013-03-07 18:50:30",
"docstatus": 0,
- "modified": "2013-09-10 10:52:49",
+ "modified": "2013-09-25 19:32:29",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -192,34 +192,16 @@
},
{
"doctype": "DocField",
- "fieldname": "contact_person",
- "fieldtype": "Link",
- "in_filter": 1,
- "label": "Contact Person",
- "options": "Contact",
- "print_hide": 1,
- "read_only": 0
- },
- {
- "doctype": "DocField",
"fieldname": "customer_address",
"fieldtype": "Link",
"in_filter": 1,
- "label": "Customer Address",
+ "label": "Customer / Lead Address",
"options": "Address",
"print_hide": 1,
"read_only": 0
},
{
"doctype": "DocField",
- "fieldname": "customer_name",
- "fieldtype": "Data",
- "label": "Customer Name",
- "print_hide": 0,
- "read_only": 1
- },
- {
- "doctype": "DocField",
"fieldname": "address_display",
"fieldtype": "Small Text",
"hidden": 0,
@@ -229,6 +211,36 @@
"read_only": 1
},
{
+ "description": "<a href=\"#Sales Browser/Territory\">To manage Territory, click here</a>",
+ "doctype": "DocField",
+ "fieldname": "territory",
+ "fieldtype": "Link",
+ "in_filter": 1,
+ "label": "Territory",
+ "options": "Territory",
+ "print_hide": 1,
+ "read_only": 0,
+ "reqd": 0,
+ "search_index": 1
+ },
+ {
+ "depends_on": "eval:doc.enquiry_from==\"Customer\"",
+ "description": "<a href=\"#Sales Browser/Customer Group\">To manage Territory, click here</a>",
+ "doctype": "DocField",
+ "fieldname": "customer_group",
+ "fieldtype": "Link",
+ "hidden": 0,
+ "in_filter": 1,
+ "label": "Customer Group",
+ "oldfieldname": "customer_group",
+ "oldfieldtype": "Link",
+ "options": "Customer Group",
+ "print_hide": 1,
+ "read_only": 0,
+ "reqd": 0,
+ "search_index": 1
+ },
+ {
"doctype": "DocField",
"fieldname": "column_break3",
"fieldtype": "Column Break",
@@ -236,6 +248,24 @@
},
{
"doctype": "DocField",
+ "fieldname": "customer_name",
+ "fieldtype": "Data",
+ "label": "Customer Name",
+ "print_hide": 0,
+ "read_only": 1
+ },
+ {
+ "doctype": "DocField",
+ "fieldname": "contact_person",
+ "fieldtype": "Link",
+ "in_filter": 1,
+ "label": "Contact Person",
+ "options": "Contact",
+ "print_hide": 1,
+ "read_only": 0
+ },
+ {
+ "doctype": "DocField",
"fieldname": "contact_display",
"fieldtype": "Small Text",
"label": "Contact",
@@ -256,36 +286,6 @@
"read_only": 1
},
{
- "depends_on": "eval:doc.enquiry_from==\"Customer\"",
- "description": "<a href=\"#Sales Browser/Customer Group\">To manage Territory, click here</a>",
- "doctype": "DocField",
- "fieldname": "customer_group",
- "fieldtype": "Link",
- "hidden": 0,
- "in_filter": 1,
- "label": "Customer Group",
- "oldfieldname": "customer_group",
- "oldfieldtype": "Link",
- "options": "Customer Group",
- "print_hide": 1,
- "read_only": 0,
- "reqd": 0,
- "search_index": 1
- },
- {
- "description": "<a href=\"#Sales Browser/Territory\">To manage Territory, click here</a>",
- "doctype": "DocField",
- "fieldname": "territory",
- "fieldtype": "Link",
- "in_filter": 1,
- "label": "Territory",
- "options": "Territory",
- "print_hide": 1,
- "read_only": 0,
- "reqd": 0,
- "search_index": 1
- },
- {
"description": "Filing in Additional Information about the Opportunity will help you analyze your data better.",
"doctype": "DocField",
"fieldname": "more_info",