mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-13 10:11:20 +00:00
Merge pull request #16541 from alyf-de/develop
feat(regional): Germany module with address template
This commit is contained in:
0
erpnext/regional/germany/__init__.py
Normal file
0
erpnext/regional/germany/__init__.py
Normal file
8
erpnext/regional/germany/address_template.html
Normal file
8
erpnext/regional/germany/address_template.html
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
{{ address_line1 }}<br>
|
||||||
|
{% if address_line2 %}{{ address_line2 }}<br>{% endif -%}
|
||||||
|
{{ pincode }} {{ city }}<br>
|
||||||
|
{% if country %}{{ country }}<br>{% endif -%}
|
||||||
|
<br>
|
||||||
|
{% if phone %}Tel: {{ phone }}<br>{% endif -%}
|
||||||
|
{% if fax %}Fax: {{ fax }}<br>{% endif -%}
|
||||||
|
{% if email_id %}E-Mail: {{ email_id }}<br>{% endif -%}
|
||||||
31
erpnext/regional/germany/setup.py
Normal file
31
erpnext/regional/germany/setup.py
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
import os
|
||||||
|
import frappe
|
||||||
|
|
||||||
|
|
||||||
|
def setup(company=None, patch=True):
|
||||||
|
if not patch:
|
||||||
|
update_address_template()
|
||||||
|
|
||||||
|
|
||||||
|
def update_address_template():
|
||||||
|
"""
|
||||||
|
Read address template from file. Update existing Address Template or create a
|
||||||
|
new one.
|
||||||
|
"""
|
||||||
|
dir_name = os.path.dirname(__file__)
|
||||||
|
template_path = os.path.join(dir_name, 'address_template.html')
|
||||||
|
|
||||||
|
with open(template_path, 'r') as template_file:
|
||||||
|
template_html = template_file.read()
|
||||||
|
|
||||||
|
address_template = frappe.db.get_value('Address Template', 'Germany')
|
||||||
|
|
||||||
|
if address_template:
|
||||||
|
frappe.db.set_value('Address Template', 'Germany', 'template', template_html)
|
||||||
|
else:
|
||||||
|
# make new html template for Germany
|
||||||
|
frappe.get_doc(dict(
|
||||||
|
doctype='Address Template',
|
||||||
|
country='Germany',
|
||||||
|
template=template_html
|
||||||
|
)).insert()
|
||||||
Reference in New Issue
Block a user