[minor] fixes for chart_of_accounts_builder app
This commit is contained in:
parent
88e709e1f0
commit
e64fbd6d3c
@ -82,24 +82,26 @@ def get_charts_for_country(country):
|
|||||||
def _get_chart_name(content):
|
def _get_chart_name(content):
|
||||||
if content:
|
if content:
|
||||||
content = json.loads(content)
|
content = json.loads(content)
|
||||||
if content and content.get("is_active", "No") == "Yes" and content.get("disabled", "No") == "No":
|
|
||||||
|
if frappe.local.flags.allow_unverified_charts:
|
||||||
|
charts.append(content["name"])
|
||||||
|
|
||||||
|
elif content and content.get("is_active", "No") == "Yes" and content.get("disabled", "No") == "No":
|
||||||
charts.append(content["name"])
|
charts.append(content["name"])
|
||||||
|
|
||||||
country_code = frappe.db.get_value("Country", country, "code")
|
country_code = frappe.db.get_value("Country", country, "code")
|
||||||
if country_code:
|
if country_code:
|
||||||
path = os.path.join(os.path.dirname(__file__), "verified")
|
folders = ("verified",)
|
||||||
for fname in os.listdir(path):
|
if frappe.local.flags.allow_unverified_charts:
|
||||||
if fname.startswith(country_code) and fname.endswith(".json"):
|
folders = ("verified", "unverified")
|
||||||
with open(os.path.join(path, fname), "r") as f:
|
|
||||||
_get_chart_name(f.read())
|
|
||||||
|
|
||||||
# countries_use_OHADA_system = ["Benin", "Burkina Faso", "Cameroon", "Central African Republic", "Comoros",
|
for folder in folders:
|
||||||
# "Congo", "Ivory Coast", "Gabon", "Guinea", "Guinea Bissau", "Equatorial Guinea", "Mali", "Niger",
|
path = os.path.join(os.path.dirname(__file__), folder)
|
||||||
# "Replica of Democratic Congo", "Senegal", "Chad", "Togo"]
|
|
||||||
#
|
for fname in os.listdir(path):
|
||||||
# if country in countries_use_OHADA_system:
|
if fname.startswith(country_code) and fname.endswith(".json"):
|
||||||
# with open(os.path.join(os.path.dirname(__file__), "syscohada_syscohada_chart_template.json"), "r") as f:
|
with open(os.path.join(path, fname), "r") as f:
|
||||||
# _get_chart_name(f.read())
|
_get_chart_name(f.read())
|
||||||
|
|
||||||
if len(charts) != 1:
|
if len(charts) != 1:
|
||||||
charts.append("Standard")
|
charts.append("Standard")
|
||||||
|
@ -216,13 +216,15 @@ class Company(Document):
|
|||||||
frappe.db.sql("""delete from `tabItem Reorder` where warehouse in (%s)"""
|
frappe.db.sql("""delete from `tabItem Reorder` where warehouse in (%s)"""
|
||||||
% ', '.join(['%s']*len(warehouses)), tuple(warehouses))
|
% ', '.join(['%s']*len(warehouses)), tuple(warehouses))
|
||||||
|
|
||||||
for f in ["income_account", "expense_account"]:
|
if accounts:
|
||||||
frappe.db.sql("""update tabItem set %s=NULL where %s in (%s)"""
|
for f in ["income_account", "expense_account"]:
|
||||||
% (f, f, ', '.join(['%s']*len(accounts))), tuple(accounts))
|
frappe.db.sql("""update tabItem set %s=NULL where %s in (%s)"""
|
||||||
|
% (f, f, ', '.join(['%s']*len(accounts))), tuple(accounts))
|
||||||
|
|
||||||
for f in ["selling_cost_center", "buying_cost_center"]:
|
if cost_centers:
|
||||||
frappe.db.sql("""update tabItem set %s=NULL where %s in (%s)"""
|
for f in ["selling_cost_center", "buying_cost_center"]:
|
||||||
% (f, f, ', '.join(['%s']*len(cost_centers))), tuple(cost_centers))
|
frappe.db.sql("""update tabItem set %s=NULL where %s in (%s)"""
|
||||||
|
% (f, f, ', '.join(['%s']*len(cost_centers))), tuple(cost_centers))
|
||||||
|
|
||||||
# reset default company
|
# reset default company
|
||||||
frappe.db.sql("""update `tabSingles` set value=""
|
frappe.db.sql("""update `tabSingles` set value=""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user