set addr_list and contact_list attr #5635

This commit is contained in:
Saurabh 2016-07-04 18:27:58 +05:30
parent 281b07cdb6
commit bce02c4364

View File

@ -8,13 +8,13 @@ def load_address_and_contact(doc, key):
"""Loads address list and contact list in `__onload`""" """Loads address list and contact list in `__onload`"""
from erpnext.utilities.doctype.address.address import get_address_display from erpnext.utilities.doctype.address.address import get_address_display
doc.get("__onload").addr_list = [a.update({"display": get_address_display(a)}) \ doc.get("__onload")["addr_list"] = [a.update({"display": get_address_display(a)}) \
for a in frappe.get_all("Address", for a in frappe.get_all("Address",
fields="*", filters={key: doc.name}, fields="*", filters={key: doc.name},
order_by="is_primary_address desc, modified desc")] order_by="is_primary_address desc, modified desc")]
if doc.doctype != "Lead": if doc.doctype != "Lead":
doc.get("__onload").contact_list = frappe.get_all("Contact", doc.get("__onload")["contact_list"] = frappe.get_all("Contact",
fields="*", filters={key: doc.name}, fields="*", filters={key: doc.name},
order_by="is_primary_contact desc, modified desc") order_by="is_primary_contact desc, modified desc")