diff --git a/erpnext/config/desktop.py b/erpnext/config/desktop.py index 2b8dce03943..c5a1320a266 100644 --- a/erpnext/config/desktop.py +++ b/erpnext/config/desktop.py @@ -60,7 +60,7 @@ def get_data(): "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 23549ff7970..84ac1579efa 100644 --- a/erpnext/setup/setup_wizard/install_fixtures.py +++ b/erpnext/setup/setup_wizard/install_fixtures.py @@ -30,7 +30,7 @@ def install(country=None): # 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 @@ def install(country=None): # 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 83d4fc8d3cf..c055bcaceca 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 5002619c3f6..3e263be0a34 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 }}
{% if address_line2 %}{{ address_line2 }}
{% endif -%}\n{{ city }}
\n{% if state %}{{ state }}
{% endif -%}\n{% if pincode %}{{ pincode }}
{% endif -%}\n{{ country }}
\n{% if phone %}Phone: {{ phone }}
{% endif -%}\n{% if fax %}Fax: {{ fax }}
{% endif -%}\n{% if email_id %}Email: {{ email_id }}
{% endif -%}\n", + "columns": 0, + "default": "", "description": "

Default Template

\n

Uses Jinja Templating and all the fields of Address (including Custom Fields if any) will be available

\n
{{ 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
", "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 e759be49195..64aaa45d269 100644 --- a/erpnext/utilities/doctype/address_template/address_template.py +++ b/erpnext/utilities/doctype/address_template/address_template.py @@ -9,6 +9,9 @@ from frappe import _ 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 @@ class AddressTemplate(Document): 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 }}
{% if address_line2 %}{{ address_line2 }}
{% endif -%}\ +{{ city }}
+{% if state %}{{ state }}
{% endif -%} +{% if pincode %}{{ pincode }}
{% endif -%} +{{ country }}
+{% if phone %}'''+_('Phone')+''': {{ phone }}
{% endif -%} +{% if fax %}'''+_('Fax')+''': {{ fax }}
{% endif -%} +{% if email_id %}'''+_('Email')+''': {{ email_id }}
{% endif -%}'''