Address and contact creation from opportunity #1570

This commit is contained in:
Nabin Hait 2014-05-02 11:42:24 +05:30
parent 92c4fc4e19
commit 1e6c32e95f
2 changed files with 19 additions and 18 deletions

View File

@ -24,8 +24,9 @@ cur_frm.cscript.onload = function(doc, cdt, cdn) {
"Maintenance Schedule"]
.indexOf(doctype)!==-1) {
var refdoc = frappe.get_doc(doctype, docname);
if(refdoc.doctype == "Quotation" ? refdoc.quotation_to=="Customer" : true) {
if((refdoc.doctype == "Quotation" && refdoc.quotation_to=="Customer") ||
(refdoc.doctype == "Opportunity" && refdoc.enquiry_from=="Customer") ||
!in_list(["Opportunity", "Quotation"], doctype)) {
cur_frm.set_value("customer", refdoc.customer || refdoc.name);
cur_frm.set_value("customer_name", refdoc.customer_name);
if(cur_frm.doc.doctype==="Address")
@ -40,11 +41,12 @@ cur_frm.cscript.onload = function(doc, cdt, cdn) {
if(cur_frm.doc.doctype==="Address")
cur_frm.set_value("address_title", cur_frm.doc.supplier_name);
}
if(["Lead", "Quotation"]
if(["Lead", "Opportunity", "Quotation"]
.indexOf(doctype)!==-1) {
var refdoc = frappe.get_doc(doctype, docname);
if(refdoc.doctype == "Quotation" ? refdoc.quotation_to=="Lead" : true) {
if((refdoc.doctype == "Quotation" && refdoc.quotation_to=="Lead") ||
(refdoc.doctype == "Opportunity" && refdoc.enquiry_from=="Lead") || (doctype=="Lead")) {
cur_frm.set_value("lead", refdoc.lead || refdoc.name);
cur_frm.set_value("lead_name", refdoc.customer_name || refdoc.company_name || refdoc.lead_name);
if(cur_frm.doc.doctype==="Address")

View File

@ -55,7 +55,6 @@ class Warehouse(Document):
})
ac_doc.ignore_permissions = True
ac_doc.insert()
msgprint(_("Account head {0} created").format(ac_doc.name))
def validate_parent_account(self):