Fixes in Lead, Opportunity, Quotation, Setup Wizard

This commit is contained in:
Anand Doshi 2014-04-23 19:15:15 +05:30
parent f50a65294f
commit 78eeacb53c
6 changed files with 66 additions and 59 deletions

View File

@ -13,7 +13,7 @@ erpnext.utils.get_party_details = function(frm, method, args) {
party_type: "Customer",
price_list: frm.doc.selling_price_list
};
} else {
} else if(frm.doc.supplier) {
args = {
party: frm.doc.supplier,
party_type: "Supplier",
@ -21,6 +21,8 @@ erpnext.utils.get_party_details = function(frm, method, args) {
};
}
}
if(!args) return;
args.currency = frm.doc.currency;
args.company = frm.doc.company;
frappe.call({

View File

@ -101,7 +101,7 @@ def _make_customer(source_name, target_doc=None, ignore_permissions=False):
@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 @@ def make_opportunity(source_name, target_doc=None):
}
}}, target_doc)
return doclist
return target_doc
@frappe.whitelist()
def get_lead_details(lead):

View File

@ -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",
@ -71,6 +71,15 @@
"print_hide": 1,
"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",
@ -79,6 +88,17 @@
"read_only": 0,
"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",
@ -93,17 +113,6 @@
"read_only": 1,
"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",
@ -211,15 +220,6 @@
"permlevel": 0,
"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",
@ -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",

View File

@ -62,26 +62,34 @@ erpnext.selling.QuotationController = erpnext.selling.SellingController.extend({
});
}
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() {

View File

@ -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",

View File

@ -204,9 +204,6 @@ def set_defaults(args):
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