Fixes in Lead, Opportunity, Quotation, Setup Wizard
diff --git a/erpnext/public/js/utils/party.js b/erpnext/public/js/utils/party.js
index 9063b00..31abbb3 100644
--- a/erpnext/public/js/utils/party.js
+++ b/erpnext/public/js/utils/party.js
@@ -8,19 +8,21 @@
}
if(!args) {
if(frm.doc.customer) {
- args = {
+ args = {
party: frm.doc.customer,
party_type: "Customer",
price_list: frm.doc.selling_price_list
};
- } else {
- args = {
+ } else if(frm.doc.supplier) {
+ args = {
party: frm.doc.supplier,
party_type: "Supplier",
price_list: frm.doc.buying_price_list
};
}
}
+ if(!args) return;
+
args.currency = frm.doc.currency;
args.company = frm.doc.company;
frappe.call({
@@ -44,7 +46,7 @@
} else if(frm.doc.supplier) {
address_field = "supplier_address";
} else return;
- }
+ }
if(!display_field) display_field = "address_display";
if(frm.doc[address_field]) {
frappe.call({
@@ -60,7 +62,7 @@
erpnext.utils.get_contact_details = function(frm) {
if(frm.updating_party_details) return;
-
+
if(frm.doc["contact_person"]) {
frappe.call({
method: "erpnext.utilities.doctype.contact.contact.get_contact_details",
@@ -71,4 +73,4 @@
}
})
}
-}
\ No newline at end of file
+}
diff --git a/erpnext/selling/doctype/lead/lead.py b/erpnext/selling/doctype/lead/lead.py
index 4f48542..b40132e 100644
--- a/erpnext/selling/doctype/lead/lead.py
+++ b/erpnext/selling/doctype/lead/lead.py
@@ -101,7 +101,7 @@
@frappe.whitelist()
def make_opportunity(source_name, target_doc=None):
- doclist = get_mapped_doc("Lead", source_name,
+ target_doc = get_mapped_doc("Lead", source_name,
{"Lead": {
"doctype": "Opportunity",
"field_map": {
@@ -115,7 +115,7 @@
}
}}, target_doc)
- return doclist
+ return target_doc
@frappe.whitelist()
def get_lead_details(lead):
diff --git a/erpnext/selling/doctype/opportunity/opportunity.json b/erpnext/selling/doctype/opportunity/opportunity.json
index 51129c5..bdd8558 100644
--- a/erpnext/selling/doctype/opportunity/opportunity.json
+++ b/erpnext/selling/doctype/opportunity/opportunity.json
@@ -1,7 +1,7 @@
{
"allow_import": 1,
"autoname": "naming_series:",
- "creation": "2013-03-07 18:50:30.000000",
+ "creation": "2013-03-07 18:50:30",
"description": "Potential Sales Deal",
"docstatus": 0,
"doctype": "DocType",
@@ -72,6 +72,15 @@
"read_only": 0
},
{
+ "depends_on": "eval:doc.customer || doc.lead",
+ "fieldname": "customer_name",
+ "fieldtype": "Data",
+ "label": "Customer / Lead Name",
+ "permlevel": 0,
+ "print_hide": 0,
+ "read_only": 1
+ },
+ {
"fieldname": "column_break0",
"fieldtype": "Column Break",
"oldfieldtype": "Column Break",
@@ -80,6 +89,17 @@
"width": "50%"
},
{
+ "fieldname": "enquiry_type",
+ "fieldtype": "Select",
+ "label": "Opportunity Type",
+ "oldfieldname": "enquiry_type",
+ "oldfieldtype": "Select",
+ "options": "\nSales\nMaintenance",
+ "permlevel": 0,
+ "read_only": 0,
+ "reqd": 1
+ },
+ {
"default": "Draft",
"fieldname": "status",
"fieldtype": "Select",
@@ -94,17 +114,6 @@
"reqd": 1
},
{
- "fieldname": "enquiry_type",
- "fieldtype": "Select",
- "label": "Opportunity Type",
- "oldfieldname": "enquiry_type",
- "oldfieldtype": "Select",
- "options": "\nSales\nMaintenance",
- "permlevel": 0,
- "read_only": 0,
- "reqd": 1
- },
- {
"fieldname": "items",
"fieldtype": "Section Break",
"label": "Items",
@@ -212,15 +221,6 @@
"read_only": 0
},
{
- "depends_on": "customer",
- "fieldname": "customer_name",
- "fieldtype": "Data",
- "label": "Customer Name",
- "permlevel": 0,
- "print_hide": 0,
- "read_only": 1
- },
- {
"depends_on": "eval:doc.lead || doc.customer",
"fieldname": "contact_person",
"fieldtype": "Link",
@@ -409,7 +409,7 @@
"icon": "icon-info-sign",
"idx": 1,
"is_submittable": 1,
- "modified": "2014-01-20 17:48:59.000000",
+ "modified": "2014-04-23 06:38:48.858871",
"modified_by": "Administrator",
"module": "Selling",
"name": "Opportunity",
diff --git a/erpnext/selling/doctype/quotation/quotation.js b/erpnext/selling/doctype/quotation/quotation.js
index 7eeb69a..b694529 100644
--- a/erpnext/selling/doctype/quotation/quotation.js
+++ b/erpnext/selling/doctype/quotation/quotation.js
@@ -24,19 +24,19 @@
},
refresh: function(doc, dt, dn) {
this._super(doc, dt, dn);
-
+
if(doc.docstatus == 1 && doc.status!=='Lost') {
- cur_frm.add_custom_button(__('Make Sales Order'),
+ cur_frm.add_custom_button(__('Make Sales Order'),
cur_frm.cscript['Make Sales Order']);
if(doc.status!=="Ordered") {
- cur_frm.add_custom_button(__('Set as Lost'),
+ cur_frm.add_custom_button(__('Set as Lost'),
cur_frm.cscript['Declare Order Lost'], "icon-exclamation");
}
cur_frm.appframe.add_button(__('Send SMS'), cur_frm.cscript.send_sms, "icon-mobile-phone");
}
-
+
if (this.frm.doc.docstatus===0) {
- cur_frm.add_custom_button(__('From Opportunity'),
+ cur_frm.add_custom_button(__('From Opportunity'),
function() {
frappe.model.map_current_doc({
method: "erpnext.selling.doctype.opportunity.opportunity.make_quotation",
@@ -61,33 +61,41 @@
recipients: doc.contact_email
});
}
-
- this.quotation_to();
+
+ this.toggle_reqd_lead_customer();
},
-
+
quotation_to: function() {
var me = this;
- this.frm.toggle_reqd("lead", this.frm.doc.quotation_to == "Lead");
- this.frm.toggle_reqd("customer", this.frm.doc.quotation_to == "Customer");
if (this.frm.doc.quotation_to == "Lead") {
this.frm.set_value("customer", null);
this.frm.set_value("contact_person", null);
-
- // to overwrite the customer_filter trigger from queries.js
- $.each(["customer_address", "shipping_address_name"],
- function(i, opts) {
- me.frm.set_query(opts, erpnext.queries["lead_filter"]);
- }
- );
- }
- else if (this.frm.doc.quotation_to == "Customer")
+ } else if (this.frm.doc.quotation_to == "Customer") {
this.frm.set_value("lead", null);
+ }
+
+ this.toggle_reqd_lead_customer();
+ },
+
+ toggle_reqd_lead_customer: function() {
+ var me = this;
+
+ this.frm.toggle_reqd("lead", this.frm.doc.quotation_to == "Lead");
+ this.frm.toggle_reqd("customer", this.frm.doc.quotation_to == "Customer");
+
+ // to overwrite the customer_filter trigger from queries.js
+ $.each(["customer_address", "shipping_address_name"],
+ function(i, opts) {
+ me.frm.set_query(opts, me.frm.doc.quotation_to==="Lead"
+ ? erpnext.queries["lead_filter"] : erpnext.queries["customer_filter"]);
+ }
+ );
},
tc_name: function() {
this.get_terms();
},
-
+
validate_company_and_party: function(party_field) {
if(!this.frm.doc.quotation_to) {
msgprint(__("Please select a value for {0} quotation_to {1}", [this.frm.doc.doctype, this.frm.doc.name]));
@@ -98,7 +106,7 @@
return this._super(party_field);
}
},
-
+
lead: function() {
var me = this;
frappe.call({
@@ -110,7 +118,7 @@
me.frm.set_value(r.message);
me.frm.refresh();
me.frm.updating_party_details = false;
-
+
}
}
})
@@ -159,7 +167,7 @@
})
});
dialog.show();
-
+
}
cur_frm.cscript.on_submit = function(doc, cdt, cdn) {
diff --git a/erpnext/selling/doctype/quotation/quotation.json b/erpnext/selling/doctype/quotation/quotation.json
index 4b99d9e..2f214da 100644
--- a/erpnext/selling/doctype/quotation/quotation.json
+++ b/erpnext/selling/doctype/quotation/quotation.json
@@ -2,7 +2,7 @@
"allow_attach": 1,
"allow_import": 1,
"autoname": "naming_series:",
- "creation": "2013-05-24 19:29:08.000000",
+ "creation": "2013-05-24 19:29:08",
"docstatus": 0,
"doctype": "DocType",
"document_type": "Transaction",
@@ -83,7 +83,7 @@
"fieldtype": "Data",
"hidden": 1,
"in_list_view": 1,
- "label": "Customer Name",
+ "label": "Customer / Lead Name",
"permlevel": 0,
"read_only": 1
},
@@ -818,7 +818,7 @@
"idx": 1,
"is_submittable": 1,
"max_attachments": 1,
- "modified": "2014-01-31 19:43:00.000000",
+ "modified": "2014-04-23 06:16:59.176080",
"modified_by": "Administrator",
"module": "Selling",
"name": "Quotation",
diff --git a/erpnext/setup/page/setup_wizard/setup_wizard.py b/erpnext/setup/page/setup_wizard/setup_wizard.py
index a56db71..3366433 100644
--- a/erpnext/setup/page/setup_wizard/setup_wizard.py
+++ b/erpnext/setup/page/setup_wizard/setup_wizard.py
@@ -204,9 +204,6 @@
email_settings.send_print_in_body_and_attachment = 1
email_settings.save()
- # default
- frappe.db.set_default("company_name", args["company_name"])
-
def create_feed_and_todo():
"""update activty feed and create todo for creation of item, customer, vendor"""
from erpnext.home import make_feed