mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-21 14:09:19 +00:00
fix: Unable to add details in quotation and opportunity (#19354)
This commit is contained in:
@@ -146,14 +146,7 @@ def _make_customer(source_name, target_doc=None, ignore_permissions=False):
|
|||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def make_opportunity(source_name, target_doc=None):
|
def make_opportunity(source_name, target_doc=None):
|
||||||
def set_missing_values(source, target):
|
def set_missing_values(source, target):
|
||||||
address = frappe.get_all('Dynamic Link', {
|
_set_missing_values(source, target)
|
||||||
'link_doctype': source.doctype,
|
|
||||||
'link_name': source.name,
|
|
||||||
'parenttype': 'Address',
|
|
||||||
}, ['parent'], limit=1)
|
|
||||||
|
|
||||||
if address:
|
|
||||||
target.customer_address = address[0].parent
|
|
||||||
|
|
||||||
target_doc = get_mapped_doc("Lead", source_name,
|
target_doc = get_mapped_doc("Lead", source_name,
|
||||||
{"Lead": {
|
{"Lead": {
|
||||||
@@ -173,13 +166,17 @@ def make_opportunity(source_name, target_doc=None):
|
|||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def make_quotation(source_name, target_doc=None):
|
def make_quotation(source_name, target_doc=None):
|
||||||
|
def set_missing_values(source, target):
|
||||||
|
_set_missing_values(source, target)
|
||||||
|
|
||||||
target_doc = get_mapped_doc("Lead", source_name,
|
target_doc = get_mapped_doc("Lead", source_name,
|
||||||
{"Lead": {
|
{"Lead": {
|
||||||
"doctype": "Quotation",
|
"doctype": "Quotation",
|
||||||
"field_map": {
|
"field_map": {
|
||||||
"name": "party_name"
|
"name": "party_name"
|
||||||
}
|
}
|
||||||
}}, target_doc)
|
}}, target_doc, set_missing_values)
|
||||||
|
|
||||||
target_doc.quotation_to = "Lead"
|
target_doc.quotation_to = "Lead"
|
||||||
target_doc.run_method("set_missing_values")
|
target_doc.run_method("set_missing_values")
|
||||||
target_doc.run_method("set_other_charges")
|
target_doc.run_method("set_other_charges")
|
||||||
@@ -187,6 +184,25 @@ def make_quotation(source_name, target_doc=None):
|
|||||||
|
|
||||||
return target_doc
|
return target_doc
|
||||||
|
|
||||||
|
def _set_missing_values(source, target):
|
||||||
|
address = frappe.get_all('Dynamic Link', {
|
||||||
|
'link_doctype': source.doctype,
|
||||||
|
'link_name': source.name,
|
||||||
|
'parenttype': 'Address',
|
||||||
|
}, ['parent'], limit=1)
|
||||||
|
|
||||||
|
contact = frappe.get_all('Dynamic Link', {
|
||||||
|
'link_doctype': source.doctype,
|
||||||
|
'link_name': source.name,
|
||||||
|
'parenttype': 'Contact',
|
||||||
|
}, ['parent'], limit=1)
|
||||||
|
|
||||||
|
if address:
|
||||||
|
target.customer_address = address[0].parent
|
||||||
|
|
||||||
|
if contact:
|
||||||
|
target.contact_person = contact[0].parent
|
||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def get_lead_details(lead, posting_date=None, company=None):
|
def get_lead_details(lead, posting_date=None, company=None):
|
||||||
if not lead: return {}
|
if not lead: return {}
|
||||||
|
|||||||
@@ -100,10 +100,6 @@ frappe.ui.form.on("Opportunity", {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (frm.doc.opportunity_from && frm.doc.party_name && !frm.doc.contact_person) {
|
|
||||||
frm.trigger("party_name");
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
set_contact_link: function(frm) {
|
set_contact_link: function(frm) {
|
||||||
@@ -171,7 +167,7 @@ erpnext.crm.Opportunity = frappe.ui.form.Controller.extend({
|
|||||||
if (me.frm.doc.opportunity_from == "Lead") {
|
if (me.frm.doc.opportunity_from == "Lead") {
|
||||||
me.frm.set_query('party_name', erpnext.queries['lead']);
|
me.frm.set_query('party_name', erpnext.queries['lead']);
|
||||||
}
|
}
|
||||||
else if (me.frm.doc.opportunity_from == "Cuatomer") {
|
else if (me.frm.doc.opportunity_from == "Customer") {
|
||||||
me.frm.set_query('party_name', erpnext.queries['customer']);
|
me.frm.set_query('party_name', erpnext.queries['customer']);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -23,9 +23,6 @@ frappe.ui.form.on('Quotation', {
|
|||||||
refresh: function(frm) {
|
refresh: function(frm) {
|
||||||
frm.trigger("set_label");
|
frm.trigger("set_label");
|
||||||
frm.trigger("set_dynamic_field_label");
|
frm.trigger("set_dynamic_field_label");
|
||||||
if (frm.doc.quotation_to && frm.doc.party_name && !frm.doc.contact_person) {
|
|
||||||
frm.trigger("party_name");
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
quotation_to: function(frm) {
|
quotation_to: function(frm) {
|
||||||
|
|||||||
Reference in New Issue
Block a user