mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-02 19:59:12 +00:00
fix formatting and names
This commit is contained in:
@@ -1,21 +1,31 @@
|
|||||||
import frappe, os
|
import os
|
||||||
|
import frappe
|
||||||
|
|
||||||
|
|
||||||
def setup(company=None, patch=True):
|
def setup(company=None, patch=True):
|
||||||
if not patch:
|
if not patch:
|
||||||
update_address_template()
|
update_address_template()
|
||||||
|
|
||||||
|
|
||||||
def update_address_template():
|
def update_address_template():
|
||||||
with open(os.path.join(os.path.dirname(__file__), 'address_template.html'), 'r') as f:
|
"""
|
||||||
html = f.read()
|
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')
|
||||||
|
|
||||||
address_template = frappe.db.get_value('Address Template', 'Germany')
|
with open(template_path, 'r') as template_file:
|
||||||
if address_template:
|
template_html = template_file.read()
|
||||||
frappe.db.set_value('Address Template', 'Germany', 'template', html)
|
|
||||||
else:
|
address_template = frappe.db.get_value('Address Template', 'Germany')
|
||||||
# make new html template for Germany
|
|
||||||
frappe.get_doc(dict(
|
if address_template:
|
||||||
doctype='Address Template',
|
frappe.db.set_value('Address Template', 'Germany', 'template', template_html)
|
||||||
country='Germany',
|
else:
|
||||||
template=html
|
# make new html template for Germany
|
||||||
)).insert()
|
frappe.get_doc(dict(
|
||||||
|
doctype='Address Template',
|
||||||
|
country='Germany',
|
||||||
|
template=template_html
|
||||||
|
)).insert()
|
||||||
|
|||||||
Reference in New Issue
Block a user