fix: get org address if exist
This commit is contained in:
parent
b506d99d62
commit
43a723c721
@ -124,7 +124,8 @@ def get_quotation_url(crm_deal, organization):
|
|||||||
frappe.throw(_("ERPNext is not integrated with the CRM"))
|
frappe.throw(_("ERPNext is not integrated with the CRM"))
|
||||||
|
|
||||||
contact = get_contact(crm_deal)
|
contact = get_contact(crm_deal)
|
||||||
address = get_organization_address(organization).get("name") if organization else None
|
address = get_organization_address(organization)
|
||||||
|
address = address.get("name") if address else None
|
||||||
|
|
||||||
if not erpnext_crm_settings.is_erpnext_in_different_site:
|
if not erpnext_crm_settings.is_erpnext_in_different_site:
|
||||||
quotation_url = get_url_to_list("Quotation")
|
quotation_url = get_url_to_list("Quotation")
|
||||||
@ -142,7 +143,11 @@ def create_prospect_in_remote_site(crm_deal, erpnext_crm_settings):
|
|||||||
client = get_erpnext_site_client(erpnext_crm_settings)
|
client = get_erpnext_site_client(erpnext_crm_settings)
|
||||||
doc = frappe.get_cached_doc("CRM Deal", crm_deal)
|
doc = frappe.get_cached_doc("CRM Deal", crm_deal)
|
||||||
contacts = get_contacts(doc)
|
contacts = get_contacts(doc)
|
||||||
address = get_organization_address(doc.organization)
|
address = get_organization_address(doc.organization) or None
|
||||||
|
|
||||||
|
if address and not isinstance(address, dict):
|
||||||
|
address = address.as_dict()
|
||||||
|
|
||||||
return client.post_api(
|
return client.post_api(
|
||||||
"erpnext.crm.frappe_crm_api.create_prospect_against_crm_deal",
|
"erpnext.crm.frappe_crm_api.create_prospect_against_crm_deal",
|
||||||
{
|
{
|
||||||
@ -157,7 +162,7 @@ def create_prospect_in_remote_site(crm_deal, erpnext_crm_settings):
|
|||||||
"annual_revenue": doc.annual_revenue,
|
"annual_revenue": doc.annual_revenue,
|
||||||
"contacts": json.dumps(contacts),
|
"contacts": json.dumps(contacts),
|
||||||
"erpnext_company": erpnext_crm_settings.erpnext_company,
|
"erpnext_company": erpnext_crm_settings.erpnext_company,
|
||||||
"address": address.as_dict() if address else None,
|
"address": address,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
except Exception:
|
except Exception:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user