[translation] [fixes] #5860
This commit is contained in:
parent
83d81203b2
commit
769dda0874
@ -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",
|
||||
|
@ -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
|
@ -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);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -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",
|
||||
|
@ -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 }}<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 -%}'''
|
||||
|
Loading…
x
Reference in New Issue
Block a user