brotherton-erpnext/erpnext/regional/address_template/README.md
Raffael Meyer 9aae0c27c2
feat(regional): a central place for regional address templates (#19862)
* feat: a central place for regional address templates

* set up address templates during install

* why don't the tests run?

* fix: remove unused variables, fix cwd

* fix: .get() dicts contents

* fix: choose the right default

* fix: fieldname is template, not html

* fix: import unittest

* fix: remove unnecessary code

* fix: ensure country exists

* fix: ensure country exists

* feat: test updating an existing template

* fix(regional): DuplicateEntryError in test_update_address_template

* refactor and set 'is_default'

* fix codacy

* fix: patch gst_fixes

* fix: patch update_address_template_for_india

Co-authored-by: Nabin Hait <nabinhait@gmail.com>
2020-04-08 08:56:57 +05:30

19 lines
709 B
Markdown

To add an **Address Template** for your country, place a new file in this directory:
* File name: `your_country.html` (lower case with underscores)
* File content: a [Jinja Template](http://jinja.pocoo.org/docs/templates/).
All the fields of **Address** (including Custom Fields, if any) will be available to the template. Example:
```jinja
{{ address_line1 }}<br>
{% if address_line2 %}{{ address_line2 }}<br>{% endif -%}
{{ city }}<br>
{% if state %}{{ state }}<br>{% endif -%}
{% if pincode %} PIN: {{ pincode }}<br>{% endif -%}
{{ country }}<br>
{% if phone %}Phone: {{ phone }}<br>{% endif -%}
{% if fax %}Fax: {{ fax }}<br>{% endif -%}
{% if email_id %}Email: {{ email_id }}<br>{% endif -%}
```