fix: More informational error message in Address. (#9352)

* fix: More informational error message in Address.

* fix: Changed message, added title.

* fix: Changes compatible with translations.

* fix: Translation fixes.

* style: Fix formatting

Co-authored-by: Suraj Shetty <13928957+surajshetty3416@users.noreply.github.com>
This commit is contained in:
Marica 2020-01-28 16:13:18 +05:30 committed by mergify[bot]
parent 2e2c038f35
commit b1db148dc8

View file

@ -58,7 +58,8 @@ class Address(Document):
def validate_reference(self):
if self.is_your_company_address:
if not [row for row in self.links if row.link_doctype == "Company"]:
frappe.throw(_("Company is mandatory, as it is your company address"))
frappe.throw(_("Address needs to be linked to a Company.Please add a row for {0} in the Links table below.") \
.format(frappe.bold(_("Company"))), title =_("Address not Linked"))
def get_display(self):
return get_address_display(self.as_dict())
@ -256,4 +257,4 @@ def address_query(doctype, txt, searchfield, start, page_len, filters):
def get_condensed_address(doc):
fields = ["address_title", "address_line1", "address_line2", "city", "county", "state", "country"]
return ", ".join([doc.get(d) for d in fields if doc.get(d)])
return ", ".join([doc.get(d) for d in fields if doc.get(d)])