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:
Suraj Shetty 2019-08-13 10:58:29 +05:30 committed by Nabin Hait
parent 9002a6c195
commit 80afee04a4
2 changed files with 6 additions and 14 deletions

View File

@ -146,15 +146,14 @@ def _make_customer(source_name, target_doc=None, ignore_permissions=False):
@frappe.whitelist()
def make_opportunity(source_name, target_doc=None):
def set_missing_values(source, target):
address = frappe.db.exists('Dynamic Link', {
'link_doctype': target.doctype,
'link_name': target.name,
address = frappe.get_all('Dynamic Link', {
'link_doctype': source.doctype,
'link_name': source.name,
'parenttype': 'Address',
'disabled': 0
})
}, ['parent'], limit=1)
if address:
target.customer_address = address
target.customer_address = address[0].parent
target_doc = get_mapped_doc("Lead", source_name,
{"Lead": {

View File

@ -31,9 +31,9 @@ frappe.ui.form.on("Opportunity", {
party_name: function(frm) {
frm.toggle_display("contact_info", frm.doc.party_name);
frm.trigger('set_contact_link');
if (frm.doc.opportunity_from == "Customer") {
frm.trigger('set_contact_link');
erpnext.utils.get_party_details(frm);
} else if (frm.doc.opportunity_from == "Lead") {
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");
},
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) {
frm.trigger('toggle_mandatory');
},