fix: Remove redundant get_doc

This commit is contained in:
Deepesh Garg 2021-05-02 12:22:16 +05:30
parent 204ea1027f
commit a66184fe3c
2 changed files with 5 additions and 6 deletions

View File

@ -646,7 +646,7 @@ def make_custom_fields(update=True):
def make_fixtures(company=None):
docs = []
company = company.name if company else frappe.db.get_value("Global Defaults", None, "default_company")
company = company or frappe.db.get_value("Global Defaults", None, "default_company")
set_salary_components(docs)
set_tds_account(docs, company)

View File

@ -435,13 +435,12 @@ def get_name_with_abbr(name, company):
return " - ".join(parts)
def install_country_fixtures(company):
company_doc = frappe.get_doc("Company", company)
path = frappe.get_app_path('erpnext', 'regional', frappe.scrub(company_doc.country))
def install_country_fixtures(company, country):
path = frappe.get_app_path('erpnext', 'regional', frappe.scrub(country))
if os.path.exists(path.encode("utf-8")):
try:
module_name = "erpnext.regional.{0}.setup.setup".format(frappe.scrub(company_doc.country))
frappe.get_attr(module_name)(company_doc, False)
module_name = "erpnext.regional.{0}.setup.setup".format(frappe.scrub(country))
frappe.get_attr(module_name)(company, False)
except Exception as e:
frappe.log_error()
frappe.throw(_("Failed to setup defaults for country {0}. Please contact support@erpnext.com").format(frappe.bold(company_doc.country)))