Skip to content

Commit

Permalink
fix: pass address obj instead of dict
Browse files Browse the repository at this point in the history
  • Loading branch information
shariquerik committed Sep 18, 2024
1 parent 64612c6 commit ac0eae4
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions crm/fcrm/doctype/erpnext_crm_settings/erpnext_crm_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,9 +175,20 @@ def get_contacts(doc):
return contacts

def get_organization_address(organization):
address = frappe.get_value("CRM Organization", organization, "address")
address = frappe.db.get_value("CRM Organization", organization, "address")
address = frappe.get_doc("Address", address) if address else None
return address
return {
"name": address.name,
"address_title": address.address_title,
"address_type": address.address_type,
"address_line1": address.address_line1,
"address_line2": address.address_line2,
"city": address.city,
"county": address.county,
"state": address.state,
"country": address.country,
"pincode": address.pincode,
}

def create_customer_in_erpnext(doc, method):
erpnext_crm_settings = frappe.get_single("ERPNext CRM Settings")
Expand All @@ -200,7 +211,7 @@ def create_customer_in_erpnext(doc, method):
"website": doc.website,
"crm_deal": doc.name,
"contacts": json.dumps(contacts),
"address": address.as_dict() if address else None,
"address": json.dumps(address) if address else None,
}
if not erpnext_crm_settings.is_erpnext_in_different_site:
from erpnext.crm.frappe_crm_api import create_customer
Expand Down

0 comments on commit ac0eae4

Please sign in to comment.