From 41471c3b4442614556351df3f5b4dc3b667eef7f Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Thu, 5 Jun 2014 11:40:45 +0530 Subject: [PATCH 1/6] fixed description in salary manager --- erpnext/hr/doctype/salary_manager/salary_manager.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/hr/doctype/salary_manager/salary_manager.json b/erpnext/hr/doctype/salary_manager/salary_manager.json index 39a1d9cf9e..e430f3b5f2 100644 --- a/erpnext/hr/doctype/salary_manager/salary_manager.json +++ b/erpnext/hr/doctype/salary_manager/salary_manager.json @@ -11,7 +11,7 @@ "fieldname": "document_description", "fieldtype": "HTML", "label": "Document Description", - "options": "
You can generate multiple salary slips based on the selected criteria, submit and mail those to the employee directly from here
", + "options": "
You can generate multiple salary slips based on the selected criteria, submit and mail those to the employee directly from here
", "permlevel": 0 }, { @@ -144,7 +144,7 @@ "icon": "icon-cog", "idx": 1, "issingle": 1, - "modified": "2014-05-09 02:16:45.165977", + "modified": "2014-06-04 06:46:39.437061", "modified_by": "Administrator", "module": "HR", "name": "Salary Manager", From c22e11d483e4a33edbacd1478e6ddc1e8412cea2 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Thu, 5 Jun 2014 13:17:45 +0530 Subject: [PATCH 2/6] added address template: --- erpnext/config/setup.py | 5 ++ .../page/setup_wizard/install_fixtures.py | 6 +- erpnext/utilities/doctype/address/address.py | 26 ++++----- .../utilities/doctype/address/test_address.py | 14 ++++- .../doctype/address_template/__init__.py | 0 .../address_template/address_template.json | 57 +++++++++++++++++++ .../address_template/address_template.py | 19 +++++++ .../address_template/test_address_template.py | 22 +++++++ .../address_template/test_records.json | 13 +++++ 9 files changed, 145 insertions(+), 17 deletions(-) create mode 100644 erpnext/utilities/doctype/address_template/__init__.py create mode 100644 erpnext/utilities/doctype/address_template/address_template.json create mode 100644 erpnext/utilities/doctype/address_template/address_template.py create mode 100644 erpnext/utilities/doctype/address_template/test_address_template.py create mode 100644 erpnext/utilities/doctype/address_template/test_records.json diff --git a/erpnext/config/setup.py b/erpnext/config/setup.py index 66b44e28c5..8db9ef2914 100644 --- a/erpnext/config/setup.py +++ b/erpnext/config/setup.py @@ -30,6 +30,11 @@ def get_data(): "name": "Print Heading", "description": _("Titles for print templates e.g. Proforma Invoice.") }, + { + "type": "doctype", + "name": "Address Template", + "description": _("Country wise default Address Templates") + }, { "type": "doctype", "name": "Terms and Conditions", diff --git a/erpnext/setup/page/setup_wizard/install_fixtures.py b/erpnext/setup/page/setup_wizard/install_fixtures.py index 90ef1f4a84..4bdf15eeef 100644 --- a/erpnext/setup/page/setup_wizard/install_fixtures.py +++ b/erpnext/setup/page/setup_wizard/install_fixtures.py @@ -10,6 +10,9 @@ from frappe import _ def install(country=None): records = [ + # address template + {'doctype':"Address Template", "country": country}, + # item group {'doctype': 'Item Group', 'item_group_name': _('All Item Groups'), 'is_group': 'Yes', 'parent_item_group': ''}, @@ -189,7 +192,8 @@ def install(country=None): from frappe.modules import scrub for r in records: - doc = frappe.get_doc(r) + doc = frappe.new_doc(r.get("doctype")) + doc.update(r) # ignore mandatory for root parent_link_field = ("parent_" + scrub(doc.doctype)) diff --git a/erpnext/utilities/doctype/address/address.py b/erpnext/utilities/doctype/address/address.py index b00b40d7f0..01b9d9acb5 100644 --- a/erpnext/utilities/doctype/address/address.py +++ b/erpnext/utilities/doctype/address/address.py @@ -10,7 +10,6 @@ from frappe.utils import cstr from frappe.model.document import Document class Address(Document): - def autoname(self): if not self.address_title: self.address_title = self.customer \ @@ -56,22 +55,16 @@ def get_address_display(address_dict): if not isinstance(address_dict, dict): address_dict = frappe.db.get_value("Address", address_dict, "*", as_dict=True) or {} - meta = frappe.get_meta("Address") - sequence = (("", "address_line1"), - ("\n", "address_line2"), - ("\n", "city"), - ("\n", "state"), - ("\n" + meta.get_label("pincode") + ": ", "pincode"), - ("\n", "country"), - ("\n" + meta.get_label("phone") + ": ", "phone"), - ("\n" + meta.get_label("fax") + ": ", "fax")) + template = frappe.db.get_value("Address Template", \ + {"country": address_dict.get("country")}, "template") + if not template: + template = frappe.db.get_value("Address Template", \ + {"is_default": 1}, "template") - display = "" - for separator, fieldname in sequence: - if address_dict.get(fieldname): - display += separator + address_dict.get(fieldname) + if not template: + frappe.throw(_("No default Address Template found. Please create a new one")) - return display.strip() + return frappe.render_template(template, address_dict) def get_territory_from_address(address): """Tries to match city, state and country of address to existing territory""" @@ -88,3 +81,6 @@ def get_territory_from_address(address): break return territory + + + diff --git a/erpnext/utilities/doctype/address/test_address.py b/erpnext/utilities/doctype/address/test_address.py index 815449aaa7..1e36a4438c 100644 --- a/erpnext/utilities/doctype/address/test_address.py +++ b/erpnext/utilities/doctype/address/test_address.py @@ -1,6 +1,18 @@ # Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors # License: GNU General Public License v3. See license.txt +from __future__ import unicode_literals import frappe -test_records = frappe.get_test_records('Address') \ No newline at end of file +test_records = frappe.get_test_records('Address') + +import unittest +import frappe + +from erpnext.utilities.doctype.address.address import get_address_display + +class TestAddress(unittest.TestCase): + def test_template_works(self): + address = frappe.get_list("Address")[0].name + display = get_address_display(frappe.get_doc("Address", address).as_dict()) + self.assertTrue(display) diff --git a/erpnext/utilities/doctype/address_template/__init__.py b/erpnext/utilities/doctype/address_template/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/erpnext/utilities/doctype/address_template/address_template.json b/erpnext/utilities/doctype/address_template/address_template.json new file mode 100644 index 0000000000..f08660bddb --- /dev/null +++ b/erpnext/utilities/doctype/address_template/address_template.json @@ -0,0 +1,57 @@ +{ + "autoname": "field:country", + "creation": "2014-06-05 02:22:36.029850", + "docstatus": 0, + "doctype": "DocType", + "document_type": "Master", + "fields": [ + { + "fieldname": "country", + "fieldtype": "Link", + "in_list_view": 1, + "label": "Country", + "options": "Country", + "permlevel": 0, + "reqd": 0, + "search_index": 1 + }, + { + "description": "This format is used if country specific format is not found", + "fieldname": "is_default", + "fieldtype": "Check", + "in_list_view": 1, + "label": "Is Default", + "permlevel": 0 + }, + { + "default": "{{ address_title }}
\n{{ address_line1 }}
\n{% if address_line2 %}{{ address_line2 }}
{% endif -%}\n{{ city }}
\n{% if state %}{{ state }}
{% endif -%}\n{% if pincode %} PIN / ZIP: {{ 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", + "description": "

Default Template

\n

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

\n
{{ address_title }}<br>\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 / ZIP:  {{ 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", + "label": "Template", + "permlevel": 0 + } + ], + "icon": "icon-map-marker", + "modified": "2014-06-05 03:28:45.428733", + "modified_by": "Administrator", + "module": "Utilities", + "name": "Address Template", + "name_case": "", + "owner": "Administrator", + "permissions": [ + { + "create": 1, + "delete": 1, + "export": 1, + "permlevel": 0, + "read": 1, + "report": 1, + "role": "System Manager", + "set_user_permissions": 1, + "write": 1 + } + ], + "sort_field": "modified", + "sort_order": "DESC" +} \ No newline at end of file diff --git a/erpnext/utilities/doctype/address_template/address_template.py b/erpnext/utilities/doctype/address_template/address_template.py new file mode 100644 index 0000000000..bf68d82d7d --- /dev/null +++ b/erpnext/utilities/doctype/address_template/address_template.py @@ -0,0 +1,19 @@ +# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class AddressTemplate(Document): + def validate(self): + defaults = frappe.db.get_values("Address Template", + {"is_default":1, "name":("!=", self.name)}) + if not self.is_default: + if not defaults: + self.is_default = 1 + frappe.msgprint(frappe._("Setting this Address Template as default as there is no other default")) + else: + if defaults: + for d in defaults: + frappe.db.set_value("Address Template", d, "is_default", 0) diff --git a/erpnext/utilities/doctype/address_template/test_address_template.py b/erpnext/utilities/doctype/address_template/test_address_template.py new file mode 100644 index 0000000000..953c852d85 --- /dev/null +++ b/erpnext/utilities/doctype/address_template/test_address_template.py @@ -0,0 +1,22 @@ +# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors +# License: See license.txt + +from __future__ import unicode_literals + +import frappe +test_records = frappe.get_test_records('Address Template') + +import unittest +import frappe + +class TestAddressTemplate(unittest.TestCase): + def test_default_is_unset(self): + a = frappe.get_doc("Address Template", "India") + a.is_default = 1 + a.save() + + b = frappe.get_doc("Address Template", "Brazil") + b.is_default = 1 + b.save() + + self.assertEqual(frappe.db.get_value("Address Template", "India", "is_default"), 0) diff --git a/erpnext/utilities/doctype/address_template/test_records.json b/erpnext/utilities/doctype/address_template/test_records.json new file mode 100644 index 0000000000..412c9e745b --- /dev/null +++ b/erpnext/utilities/doctype/address_template/test_records.json @@ -0,0 +1,13 @@ +[ + { + "country": "India", + "is_default": 1, + "template": "{{ address_title }}
\n{{ address_line1 }}
\n{% if address_line2 %}{{ address_line2 }}
{% endif %}\n{{ city }}
\n{% if state %}{{ state }}
{% endif %}\n{% if pincode %} PIN / ZIP: {{ 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" + }, + { + "country": "Brazil", + "is_default": 0, + "template": "{{ address_title }}
\n{{ address_line1 }}
\n{% if address_line2 %}{{ address_line2 }}
{% endif %}\n{{ city }}
\n{% if state %}{{ state }}
{% endif %}\n{% if pincode %} PIN / ZIP: {{ 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" + } +] + From eaa2e55d20fad3ebc0c15636acc922b5b6dd95c3 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Thu, 5 Jun 2014 14:44:16 +0530 Subject: [PATCH 3/6] patch for address template fixes #1749 --- erpnext/patches.txt | 1 + erpnext/patches/v4_0/new_address_template.py | 9 +++++++++ .../doctype/address_template/address_template.json | 6 +++--- .../doctype/address_template/address_template.py | 7 ++++++- 4 files changed, 19 insertions(+), 4 deletions(-) create mode 100644 erpnext/patches/v4_0/new_address_template.py diff --git a/erpnext/patches.txt b/erpnext/patches.txt index b5e66d4b1a..a5a7ae49c0 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -45,3 +45,4 @@ execute:frappe.delete_doc("Print Format", "SalesInvoice") execute:import frappe.defaults;frappe.defaults.clear_default("price_list_currency") erpnext.patches.v4_0.update_account_root_type execute:frappe.delete_doc("Report", "Purchase In Transit") +erpnext.patches.v4_0.new_address_template diff --git a/erpnext/patches/v4_0/new_address_template.py b/erpnext/patches/v4_0/new_address_template.py new file mode 100644 index 0000000000..fc0c957ad6 --- /dev/null +++ b/erpnext/patches/v4_0/new_address_template.py @@ -0,0 +1,9 @@ +import frappe + +def execute(): + d = frappe.new_doc("Address Template") + d.update({"country":frappe.db.get_default("country")}) + try: + d.insert() + except Exception: + pass diff --git a/erpnext/utilities/doctype/address_template/address_template.json b/erpnext/utilities/doctype/address_template/address_template.json index f08660bddb..13fd003514 100644 --- a/erpnext/utilities/doctype/address_template/address_template.json +++ b/erpnext/utilities/doctype/address_template/address_template.json @@ -24,8 +24,8 @@ "permlevel": 0 }, { - "default": "{{ address_title }}
\n{{ address_line1 }}
\n{% if address_line2 %}{{ address_line2 }}
{% endif -%}\n{{ city }}
\n{% if state %}{{ state }}
{% endif -%}\n{% if pincode %} PIN / ZIP: {{ 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", - "description": "

Default Template

\n

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

\n
{{ address_title }}<br>\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 / ZIP:  {{ 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_title }}
\n{{ address_line1 }}
\n{% if address_line2 %}{{ address_line2 }}
{% endif -%}\n{{ city }}
\n{% if state %}{{ state }}
{% endif -%}\n{% if pincode %} PIN: {{ 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", + "description": "

Default Template

\n

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

\n
{{ address_title }}<br>\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", "label": "Template", @@ -33,7 +33,7 @@ } ], "icon": "icon-map-marker", - "modified": "2014-06-05 03:28:45.428733", + "modified": "2014-06-05 05:12:20.507364", "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 bf68d82d7d..21d3e6bfcb 100644 --- a/erpnext/utilities/doctype/address_template/address_template.py +++ b/erpnext/utilities/doctype/address_template/address_template.py @@ -4,6 +4,7 @@ from __future__ import unicode_literals import frappe from frappe.model.document import Document +from frappe import _ class AddressTemplate(Document): def validate(self): @@ -12,8 +13,12 @@ class AddressTemplate(Document): if not self.is_default: if not defaults: self.is_default = 1 - frappe.msgprint(frappe._("Setting this Address Template as default as there is no other default")) + frappe.msgprint(_("Setting this Address Template as default as there is no other default")) else: if defaults: for d in defaults: frappe.db.set_value("Address Template", d, "is_default", 0) + + def on_trash(self): + if self.is_default: + frappe.throw(_("Default Address Tempalate cannot be deleted")) From 33020a63b80dfc9e4fc5c1cd694a9f70ccabea13 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Thu, 5 Jun 2014 14:46:44 +0530 Subject: [PATCH 4/6] patch for address template fixes #1749 --- erpnext/utilities/doctype/address_template/address_template.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/utilities/doctype/address_template/address_template.py b/erpnext/utilities/doctype/address_template/address_template.py index 21d3e6bfcb..39b8d21bd8 100644 --- a/erpnext/utilities/doctype/address_template/address_template.py +++ b/erpnext/utilities/doctype/address_template/address_template.py @@ -21,4 +21,4 @@ class AddressTemplate(Document): def on_trash(self): if self.is_default: - frappe.throw(_("Default Address Tempalate cannot be deleted")) + frappe.throw(_("Default Address Template cannot be deleted")) From c02fbd22fa89d59d0752c402c99895d3ba72b6ee Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Thu, 5 Jun 2014 15:34:43 +0530 Subject: [PATCH 5/6] removed address_title from address and removed test --- .../selling/doctype/customer/test_customer.py | 43 +++++----- .../address_template/address_template.json | 86 +++++++++---------- 2 files changed, 64 insertions(+), 65 deletions(-) diff --git a/erpnext/selling/doctype/customer/test_customer.py b/erpnext/selling/doctype/customer/test_customer.py index 19bcce8ee5..e2273bc59c 100644 --- a/erpnext/selling/doctype/customer/test_customer.py +++ b/erpnext/selling/doctype/customer/test_customer.py @@ -9,44 +9,43 @@ import unittest from frappe.test_runner import make_test_records test_ignore = ["Price List"] - + test_records = frappe.get_test_records('Customer') class TestCustomer(unittest.TestCase): def test_party_details(self): from erpnext.accounts.party import get_party_details - + to_check = { - 'address_display': '_Test Address Line 1\n_Test City\nIndia\nPhone: +91 0000000000', - 'selling_price_list': None, - 'customer_group': '_Test Customer Group', - 'contact_designation': None, - 'customer_address': '_Test Address-Office', - 'contact_department': None, - 'contact_email': 'test_contact_customer@example.com', - 'contact_mobile': None, - 'sales_team': [], - 'contact_display': '_Test Contact For _Test Customer', - 'contact_person': '_Test Contact For _Test Customer-_Test Customer', - 'territory': u'_Test Territory', - 'contact_phone': '+91 0000000000', + 'selling_price_list': None, + 'customer_group': '_Test Customer Group', + 'contact_designation': None, + 'customer_address': '_Test Address-Office', + 'contact_department': None, + 'contact_email': 'test_contact_customer@example.com', + 'contact_mobile': None, + 'sales_team': [], + 'contact_display': '_Test Contact For _Test Customer', + 'contact_person': '_Test Contact For _Test Customer-_Test Customer', + 'territory': u'_Test Territory', + 'contact_phone': '+91 0000000000', 'customer_name': '_Test Customer' } - + make_test_records("Address") make_test_records("Contact") - + details = get_party_details("_Test Customer") - + for key, value in to_check.iteritems(): self.assertEquals(value, details.get(key)) - + def test_rename(self): frappe.rename_doc("Customer", "_Test Customer 1", "_Test Customer 1 Renamed") self.assertTrue(frappe.db.exists("Customer", "_Test Customer 1 Renamed")) self.assertFalse(frappe.db.exists("Customer", "_Test Customer 1")) - - frappe.rename_doc("Customer", "_Test Customer 1 Renamed", "_Test Customer 1") - + + frappe.rename_doc("Customer", "_Test Customer 1 Renamed", "_Test Customer 1") + diff --git a/erpnext/utilities/doctype/address_template/address_template.json b/erpnext/utilities/doctype/address_template/address_template.json index 13fd003514..d032595849 100644 --- a/erpnext/utilities/doctype/address_template/address_template.json +++ b/erpnext/utilities/doctype/address_template/address_template.json @@ -1,57 +1,57 @@ { - "autoname": "field:country", - "creation": "2014-06-05 02:22:36.029850", - "docstatus": 0, - "doctype": "DocType", - "document_type": "Master", + "autoname": "field:country", + "creation": "2014-06-05 02:22:36.029850", + "docstatus": 0, + "doctype": "DocType", + "document_type": "Master", "fields": [ { - "fieldname": "country", - "fieldtype": "Link", - "in_list_view": 1, - "label": "Country", - "options": "Country", - "permlevel": 0, - "reqd": 0, + "fieldname": "country", + "fieldtype": "Link", + "in_list_view": 1, + "label": "Country", + "options": "Country", + "permlevel": 0, + "reqd": 0, "search_index": 1 - }, + }, { - "description": "This format is used if country specific format is not found", - "fieldname": "is_default", - "fieldtype": "Check", - "in_list_view": 1, - "label": "Is Default", + "description": "This format is used if country specific format is not found", + "fieldname": "is_default", + "fieldtype": "Check", + "in_list_view": 1, + "label": "Is Default", "permlevel": 0 - }, + }, { - "default": "{{ address_title }}
\n{{ address_line1 }}
\n{% if address_line2 %}{{ address_line2 }}
{% endif -%}\n{{ city }}
\n{% if state %}{{ state }}
{% endif -%}\n{% if pincode %} PIN: {{ 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", - "description": "

Default Template

\n

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

\n
{{ address_title }}<br>\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", - "label": "Template", + "default": "{{ address_line1 }}
\n{% if address_line2 %}{{ address_line2 }}
{% endif -%}\n{{ city }}
\n{% if state %}{{ state }}
{% endif -%}\n{% if pincode %} PIN: {{ 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", + "description": "

Default Template

\n

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

\n
{{ address_title }}<br>\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", + "label": "Template", "permlevel": 0 } - ], - "icon": "icon-map-marker", - "modified": "2014-06-05 05:12:20.507364", - "modified_by": "Administrator", - "module": "Utilities", - "name": "Address Template", - "name_case": "", - "owner": "Administrator", + ], + "icon": "icon-map-marker", + "modified": "2014-06-05 05:12:20.507364", + "modified_by": "Administrator", + "module": "Utilities", + "name": "Address Template", + "name_case": "", + "owner": "Administrator", "permissions": [ { - "create": 1, - "delete": 1, - "export": 1, - "permlevel": 0, - "read": 1, - "report": 1, - "role": "System Manager", - "set_user_permissions": 1, + "create": 1, + "delete": 1, + "export": 1, + "permlevel": 0, + "read": 1, + "report": 1, + "role": "System Manager", + "set_user_permissions": 1, "write": 1 } - ], - "sort_field": "modified", + ], + "sort_field": "modified", "sort_order": "DESC" -} \ No newline at end of file +} From 5036706f81c29427e1e5b75d17454e40d0a5e067 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Thu, 5 Jun 2014 15:44:28 +0530 Subject: [PATCH 6/6] removed address_title from address and removed test --- .../address_template/address_template.json | 86 +++++++++---------- 1 file changed, 43 insertions(+), 43 deletions(-) diff --git a/erpnext/utilities/doctype/address_template/address_template.json b/erpnext/utilities/doctype/address_template/address_template.json index d032595849..378474e4cc 100644 --- a/erpnext/utilities/doctype/address_template/address_template.json +++ b/erpnext/utilities/doctype/address_template/address_template.json @@ -1,57 +1,57 @@ { - "autoname": "field:country", - "creation": "2014-06-05 02:22:36.029850", - "docstatus": 0, - "doctype": "DocType", - "document_type": "Master", + "autoname": "field:country", + "creation": "2014-06-05 02:22:36.029850", + "docstatus": 0, + "doctype": "DocType", + "document_type": "Master", "fields": [ { - "fieldname": "country", - "fieldtype": "Link", - "in_list_view": 1, - "label": "Country", - "options": "Country", - "permlevel": 0, - "reqd": 0, + "fieldname": "country", + "fieldtype": "Link", + "in_list_view": 1, + "label": "Country", + "options": "Country", + "permlevel": 0, + "reqd": 0, "search_index": 1 - }, + }, { - "description": "This format is used if country specific format is not found", - "fieldname": "is_default", - "fieldtype": "Check", - "in_list_view": 1, - "label": "Is Default", + "description": "This format is used if country specific format is not found", + "fieldname": "is_default", + "fieldtype": "Check", + "in_list_view": 1, + "label": "Is Default", "permlevel": 0 - }, + }, { - "default": "{{ address_line1 }}
\n{% if address_line2 %}{{ address_line2 }}
{% endif -%}\n{{ city }}
\n{% if state %}{{ state }}
{% endif -%}\n{% if pincode %} PIN: {{ 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", - "description": "

Default Template

\n

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

\n
{{ address_title }}<br>\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", - "label": "Template", + "default": "{% if address_line2 %}{{ address_line2 }}
{% endif -%}\n{{ city }}
\n{% if state %}{{ state }}
{% endif -%}\n{% if pincode %} PIN: {{ 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", + "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", + "label": "Template", "permlevel": 0 } - ], - "icon": "icon-map-marker", - "modified": "2014-06-05 05:12:20.507364", - "modified_by": "Administrator", - "module": "Utilities", - "name": "Address Template", - "name_case": "", - "owner": "Administrator", + ], + "icon": "icon-map-marker", + "modified": "2014-06-05 06:14:13.200689", + "modified_by": "Administrator", + "module": "Utilities", + "name": "Address Template", + "name_case": "", + "owner": "Administrator", "permissions": [ { - "create": 1, - "delete": 1, - "export": 1, - "permlevel": 0, - "read": 1, - "report": 1, - "role": "System Manager", - "set_user_permissions": 1, + "create": 1, + "delete": 1, + "export": 1, + "permlevel": 0, + "read": 1, + "report": 1, + "role": "System Manager", + "set_user_permissions": 1, "write": 1 } - ], - "sort_field": "modified", + ], + "sort_field": "modified", "sort_order": "DESC" -} +} \ No newline at end of file