Skip to content

Commit

Permalink
fix: Set address while creating Opportunity from Lead (#18700)
Browse files Browse the repository at this point in the history
  • Loading branch information
surajshetty3416 authored and nabinhait committed Aug 12, 2019
1 parent 1c728a7 commit f81b6c7
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion erpnext/crm/doctype/lead/lead.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,17 @@ def set_missing_values(source, target):

@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,
'parenttype': 'Address',
'disabled': 0
})

if address:
target.customer_address = address

target_doc = get_mapped_doc("Lead", source_name,
{"Lead": {
"doctype": "Opportunity",
Expand All @@ -157,7 +168,7 @@ def make_opportunity(source_name, target_doc=None):
"email_id": "contact_email",
"mobile_no": "contact_mobile"
}
}}, target_doc)
}}, target_doc, set_missing_values)

return target_doc

Expand Down

0 comments on commit f81b6c7

Please sign in to comment.