feat(address): Add no_title param to get_condensed_address Jinja filter (#24949)

This commit is contained in:
Corentin Flr 2024-02-23 06:46:14 +01:00 committed by GitHub
parent 36ba02e71a
commit 5563c925a5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -327,8 +327,18 @@ 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"]
def get_condensed_address(doc, no_title=False):
fields = [
"address_title",
"address_line1",
"address_line2",
"city",
"county",
"state",
"country",
]
if no_title:
fields.remove("address_title")
return ", ".join(doc.get(d) for d in fields if doc.get(d))