feat(regional): a central place for regional address templates (#19862)

* feat: a central place for regional address templates

* set up address templates during install

* why don't the tests run?

* fix: remove unused variables, fix cwd

* fix: .get() dicts contents

* fix: choose the right default

* fix: fieldname is template, not html

* fix: import unittest

* fix: remove unnecessary code

* fix: ensure country exists

* fix: ensure country exists

* feat: test updating an existing template

* fix(regional): DuplicateEntryError in test_update_address_template

* refactor and set 'is_default'

* fix codacy

* fix: patch gst_fixes

* fix: patch update_address_template_for_india

Co-authored-by: Nabin Hait <nabinhait@gmail.com>
This commit is contained in:
Raffael Meyer
2020-04-08 05:26:57 +02:00
committed by GitHub
parent 0672b6b2e8
commit 9aae0c27c2
13 changed files with 131 additions and 70 deletions

View File

@@ -8,9 +8,11 @@ import frappe, os, json
from frappe import _
from frappe.desk.page.setup_wizard.setup_wizard import make_records
from frappe.utils import cstr, getdate
from erpnext.accounts.doctype.account.account import RootNotEditable
from frappe.desk.doctype.global_search_settings.global_search_settings import update_global_search_doctypes
from erpnext.accounts.doctype.account.account import RootNotEditable
from erpnext.regional.address_template.setup import set_up_address_templates
default_lead_sources = ["Existing Customer", "Reference", "Advertisement",
"Cold Calling", "Exhibition", "Supplier Reference", "Mass Mailing",
"Customer's Vendor", "Campaign", "Walk In"]
@@ -30,7 +32,7 @@ def install(country=None):
{ 'doctype': 'Domain', 'domain': 'Agriculture'},
{ 'doctype': 'Domain', 'domain': 'Non Profit'},
# address template
# ensure at least an empty Address Template exists for this Country
{'doctype':"Address Template", "country": country},
# item group
@@ -269,12 +271,11 @@ def install(country=None):
# Records for the Supplier Scorecard
from erpnext.buying.doctype.supplier_scorecard.supplier_scorecard import make_default_records
make_default_records()
make_records(records)
set_up_address_templates(default_country=country)
set_more_defaults()
update_global_search_doctypes()
# path = frappe.get_app_path('erpnext', 'regional', frappe.scrub(country))