Fixed Address Template
This commit is contained in:
parent
4a069a1e7f
commit
fc601659f5
@ -48,6 +48,7 @@ execute:frappe.delete_doc("Report", "Purchase In Transit")
|
|||||||
erpnext.patches.v4_0.new_address_template
|
erpnext.patches.v4_0.new_address_template
|
||||||
execute:frappe.delete_doc("DocType", "SMS Control")
|
execute:frappe.delete_doc("DocType", "SMS Control")
|
||||||
erpnext.patches.v4_0.fix_case_of_hr_module_def
|
erpnext.patches.v4_0.fix_case_of_hr_module_def
|
||||||
|
erpnext.patches.v4_0.fix_address_template
|
||||||
|
|
||||||
# WATCHOUT: This patch reload's documents
|
# WATCHOUT: This patch reload's documents
|
||||||
erpnext.patches.v4_0.reset_permissions_for_masters
|
erpnext.patches.v4_0.reset_permissions_for_masters
|
||||||
|
12
erpnext/patches/v4_0/fix_address_template.py
Normal file
12
erpnext/patches/v4_0/fix_address_template.py
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||||
|
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
import frappe
|
||||||
|
|
||||||
|
def execute():
|
||||||
|
missing_line = """{{ address_line1 }}<br>"""
|
||||||
|
for name, template in frappe.db.sql("select name, template from `tabAddress Template`"):
|
||||||
|
if missing_line not in template:
|
||||||
|
d = frappe.get_doc("Address Template", name)
|
||||||
|
d.template = missing_line + d.template
|
||||||
|
d.save()
|
@ -1,5 +1,4 @@
|
|||||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||||
# MIT License. See license.txt
|
|
||||||
|
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
import frappe
|
import frappe
|
||||||
|
@ -2,9 +2,7 @@ import frappe
|
|||||||
|
|
||||||
def execute():
|
def execute():
|
||||||
frappe.reload_doc("utilities", "doctype", "address_template")
|
frappe.reload_doc("utilities", "doctype", "address_template")
|
||||||
d = frappe.new_doc("Address Template")
|
if not frappe.db.sql("select name from `tabAddress Template`"):
|
||||||
d.update({"country":frappe.db.get_default("country")})
|
d = frappe.new_doc("Address Template")
|
||||||
try:
|
d.update({"country":frappe.db.get_default("country")})
|
||||||
d.insert()
|
d.insert()
|
||||||
except Exception:
|
|
||||||
pass
|
|
||||||
|
@ -1,57 +1,57 @@
|
|||||||
{
|
{
|
||||||
"autoname": "field:country",
|
"autoname": "field:country",
|
||||||
"creation": "2014-06-05 02:22:36.029850",
|
"creation": "2014-06-05 02:22:36.029850",
|
||||||
"docstatus": 0,
|
"docstatus": 0,
|
||||||
"doctype": "DocType",
|
"doctype": "DocType",
|
||||||
"document_type": "Master",
|
"document_type": "Master",
|
||||||
"fields": [
|
"fields": [
|
||||||
{
|
{
|
||||||
"fieldname": "country",
|
"fieldname": "country",
|
||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
"in_list_view": 1,
|
"in_list_view": 1,
|
||||||
"label": "Country",
|
"label": "Country",
|
||||||
"options": "Country",
|
"options": "Country",
|
||||||
"permlevel": 0,
|
"permlevel": 0,
|
||||||
"reqd": 0,
|
"reqd": 1,
|
||||||
"search_index": 1
|
"search_index": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"description": "This format is used if country specific format is not found",
|
"description": "This format is used if country specific format is not found",
|
||||||
"fieldname": "is_default",
|
"fieldname": "is_default",
|
||||||
"fieldtype": "Check",
|
"fieldtype": "Check",
|
||||||
"in_list_view": 1,
|
"in_list_view": 1,
|
||||||
"label": "Is Default",
|
"label": "Is Default",
|
||||||
"permlevel": 0
|
"permlevel": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"default": "{% if address_line2 %}{{ address_line2 }}<br>{% endif -%}\n{{ city }}<br>\n{% if state %}{{ state }}<br>{% endif -%}\n{% if pincode %} PIN: {{ pincode }}<br>{% endif -%}\n{{ country }}<br>\n{% if phone %}Phone: {{ phone }}<br>{% endif -%}\n{% if fax %}Fax: {{ fax }}<br>{% endif -%}\n{% if email_id %}Email: {{ email_id }}<br>{% endif -%}\n",
|
"default": "{{ address_line1 }}<br>{% if address_line2 %}{{ address_line2 }}<br>{% endif -%}\n{{ city }}<br>\n{% if state %}{{ state }}<br>{% endif -%}\n{% if pincode %}PIN: {{ pincode }}<br>{% endif -%}\n{{ country }}<br>\n{% if phone %}Phone: {{ phone }}<br>{% endif -%}\n{% if fax %}Fax: {{ fax }}<br>{% endif -%}\n{% if email_id %}Email: {{ email_id }}<br>{% endif -%}\n",
|
||||||
"description": "<h4>Default Template</h4>\n<p>Uses <a href=\"http://jinja.pocoo.org/docs/templates/\">Jinja Templating</a> and all the fields of Address (including Custom Fields if any) will be available</p>\n<pre><code>{{ address_line1 }}<br>\n{% if address_line2 %}{{ address_line2 }}<br>{% endif -%}\n{{ city }}<br>\n{% if state %}{{ state }}<br>{% endif -%}\n{% if pincode %} PIN: {{ pincode }}<br>{% endif -%}\n{{ country }}<br>\n{% if phone %}Phone: {{ phone }}<br>{% endif -%}\n{% if fax %}Fax: {{ fax }}<br>{% endif -%}\n{% if email_id %}Email: {{ email_id }}<br>{% endif -%}\n</code></pre>",
|
"description": "<h4>Default Template</h4>\n<p>Uses <a href=\"http://jinja.pocoo.org/docs/templates/\">Jinja Templating</a> and all the fields of Address (including Custom Fields if any) will be available</p>\n<pre><code>{{ address_line1 }}<br>\n{% if address_line2 %}{{ address_line2 }}<br>{% endif -%}\n{{ city }}<br>\n{% if state %}{{ state }}<br>{% endif -%}\n{% if pincode %} PIN: {{ pincode }}<br>{% endif -%}\n{{ country }}<br>\n{% if phone %}Phone: {{ phone }}<br>{% endif -%}\n{% if fax %}Fax: {{ fax }}<br>{% endif -%}\n{% if email_id %}Email: {{ email_id }}<br>{% endif -%}\n</code></pre>",
|
||||||
"fieldname": "template",
|
"fieldname": "template",
|
||||||
"fieldtype": "Code",
|
"fieldtype": "Code",
|
||||||
"label": "Template",
|
"label": "Template",
|
||||||
"permlevel": 0
|
"permlevel": 0
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"icon": "icon-map-marker",
|
"icon": "icon-map-marker",
|
||||||
"modified": "2014-06-05 06:14:13.200689",
|
"modified": "2014-06-05 06:14:15.200689",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Utilities",
|
"module": "Utilities",
|
||||||
"name": "Address Template",
|
"name": "Address Template",
|
||||||
"name_case": "",
|
"name_case": "",
|
||||||
"owner": "Administrator",
|
"owner": "Administrator",
|
||||||
"permissions": [
|
"permissions": [
|
||||||
{
|
{
|
||||||
"create": 1,
|
"create": 1,
|
||||||
"delete": 1,
|
"delete": 1,
|
||||||
"export": 1,
|
"export": 1,
|
||||||
"permlevel": 0,
|
"permlevel": 0,
|
||||||
"read": 1,
|
"read": 1,
|
||||||
"report": 1,
|
"report": 1,
|
||||||
"role": "System Manager",
|
"role": "System Manager",
|
||||||
"set_user_permissions": 1,
|
"set_user_permissions": 1,
|
||||||
"write": 1
|
"write": 1
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"sort_field": "modified",
|
"sort_field": "modified",
|
||||||
"sort_order": "DESC"
|
"sort_order": "DESC"
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user