fix: Set address while creating Opportunity from Lead (#18702)
* fix: Set address while creating Opportunity from Lead * fix: Setting of address in opportunity from Lead
This commit is contained in:
parent
9002a6c195
commit
80afee04a4
@ -146,15 +146,14 @@ 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.db.exists('Dynamic Link', {
|
address = frappe.get_all('Dynamic Link', {
|
||||||
'link_doctype': target.doctype,
|
'link_doctype': source.doctype,
|
||||||
'link_name': target.name,
|
'link_name': source.name,
|
||||||
'parenttype': 'Address',
|
'parenttype': 'Address',
|
||||||
'disabled': 0
|
}, ['parent'], limit=1)
|
||||||
})
|
|
||||||
|
|
||||||
if address:
|
if address:
|
||||||
target.customer_address = 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": {
|
||||||
|
@ -31,9 +31,9 @@ frappe.ui.form.on("Opportunity", {
|
|||||||
|
|
||||||
party_name: function(frm) {
|
party_name: function(frm) {
|
||||||
frm.toggle_display("contact_info", frm.doc.party_name);
|
frm.toggle_display("contact_info", frm.doc.party_name);
|
||||||
|
frm.trigger('set_contact_link');
|
||||||
|
|
||||||
if (frm.doc.opportunity_from == "Customer") {
|
if (frm.doc.opportunity_from == "Customer") {
|
||||||
frm.trigger('set_contact_link');
|
|
||||||
erpnext.utils.get_party_details(frm);
|
erpnext.utils.get_party_details(frm);
|
||||||
} else if (frm.doc.opportunity_from == "Lead") {
|
} else if (frm.doc.opportunity_from == "Lead") {
|
||||||
erpnext.utils.map_current_doc({
|
erpnext.utils.map_current_doc({
|
||||||
@ -48,13 +48,6 @@ frappe.ui.form.on("Opportunity", {
|
|||||||
frm.get_field("items").grid.set_multiple_add("item_code", "qty");
|
frm.get_field("items").grid.set_multiple_add("item_code", "qty");
|
||||||
},
|
},
|
||||||
|
|
||||||
party_name: function(frm) {
|
|
||||||
if (frm.doc.opportunity_from == "Customer") {
|
|
||||||
frm.trigger('set_contact_link');
|
|
||||||
erpnext.utils.get_party_details(frm);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
with_items: function(frm) {
|
with_items: function(frm) {
|
||||||
frm.trigger('toggle_mandatory');
|
frm.trigger('toggle_mandatory');
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user