[translation] [fixes] #5860
diff --git a/erpnext/config/desktop.py b/erpnext/config/desktop.py
index 2b8dce0..c5a1320 100644
--- a/erpnext/config/desktop.py
+++ b/erpnext/config/desktop.py
@@ -60,7 +60,7 @@
"link": "List/Lead"
},
{
- "module_name": "Profit and Loss Statment",
+ "module_name": "Profit and Loss Statement",
"_doctype": "Account",
"color": "#3498db",
"icon": "octicon octicon-repo",
diff --git a/erpnext/setup/setup_wizard/install_fixtures.py b/erpnext/setup/setup_wizard/install_fixtures.py
index 23549ff..84ac157 100644
--- a/erpnext/setup/setup_wizard/install_fixtures.py
+++ b/erpnext/setup/setup_wizard/install_fixtures.py
@@ -30,7 +30,7 @@
# salary component
{'doctype': 'Salary Component', 'salary_component': _('Income Tax'), 'description': _('Income Tax')},
{'doctype': 'Salary Component', 'salary_component': _('Basic'), 'description': _('Basic')},
-
+
# expense claim type
{'doctype': 'Expense Claim Type', 'name': _('Calls'), 'expense_type': _('Calls')},
{'doctype': 'Expense Claim Type', 'name': _('Food'), 'expense_type': _('Food')},
@@ -209,5 +209,4 @@
# make sure DuplicateEntryError is for the exact same doc and not a related doc
pass
else:
- raise
-
+ raise
\ No newline at end of file
diff --git a/erpnext/utilities/doctype/address_template/address_template.js b/erpnext/utilities/doctype/address_template/address_template.js
index 83d4fc8..c055bca 100644
--- a/erpnext/utilities/doctype/address_template/address_template.js
+++ b/erpnext/utilities/doctype/address_template/address_template.js
@@ -3,6 +3,14 @@
frappe.ui.form.on('Address Template', {
refresh: function(frm) {
-
+ if(frm.is_new() && !frm.doc.template) {
+ // set default template via js so that it is translated
+ frappe.call({
+ method: 'erpnext.utilities.doctype.address_template.address_template.get_default_address_template',
+ callback: function(r) {
+ frm.set_value('template', r.message);
+ }
+ });
+ }
}
});
diff --git a/erpnext/utilities/doctype/address_template/address_template.json b/erpnext/utilities/doctype/address_template/address_template.json
index 5002619..3e263be 100644
--- a/erpnext/utilities/doctype/address_template/address_template.json
+++ b/erpnext/utilities/doctype/address_template/address_template.json
@@ -15,6 +15,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "country",
"fieldtype": "Link",
"hidden": 0,
@@ -40,6 +41,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"description": "This format is used if country specific format is not found",
"fieldname": "is_default",
"fieldtype": "Check",
@@ -65,7 +67,8 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
- "default": "{{ address_line1 }}<br>{% if address_line2 %}{{ address_line2 }}<br>{% endif -%}\n{{ city }}<br>\n{% if state %}{{ state }}<br>{% endif -%}\n{% if pincode %}{{ 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",
+ "columns": 0,
+ "default": "",
"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",
"fieldtype": "Code",
@@ -99,7 +102,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 0,
- "modified": "2016-07-25 05:24:26.636240",
+ "modified": "2016-09-15 05:42:59.542484",
"modified_by": "Administrator",
"module": "Utilities",
"name": "Address Template",
diff --git a/erpnext/utilities/doctype/address_template/address_template.py b/erpnext/utilities/doctype/address_template/address_template.py
index e759be4..64aaa45 100644
--- a/erpnext/utilities/doctype/address_template/address_template.py
+++ b/erpnext/utilities/doctype/address_template/address_template.py
@@ -9,6 +9,9 @@
class AddressTemplate(Document):
def validate(self):
+ if not self.template:
+ self.template = get_default_address_template()
+
self.defaults = frappe.db.get_values("Address Template", {"is_default":1, "name":("!=", self.name)})
if not self.is_default:
if not self.defaults:
@@ -25,3 +28,15 @@
def on_trash(self):
if self.is_default:
frappe.throw(_("Default Address Template cannot be deleted"))
+
+@frappe.whitelist()
+def get_default_address_template():
+ '''Get default address template (translated)'''
+ return '''{{ address_line1 }}<br>{% if address_line2 %}{{ address_line2 }}<br>{% endif -%}\
+{{ city }}<br>
+{% if state %}{{ state }}<br>{% endif -%}
+{% if pincode %}{{ 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 -%}'''