Skip to content

Commit

Permalink
fix: currency in coa import (#34174)
Browse files Browse the repository at this point in the history
* fix: currency in coa import

(cherry picked from commit 19c0b7a)

* chore: change column label

(cherry picked from commit e3c000d)

---------

Co-authored-by: vishnu <vishnuviswambaran2002@gmail.com>
  • Loading branch information
mergify[bot] and Vishnu7025 authored Feb 27, 2023
1 parent 14c248c commit 4d92d46
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ def _import_accounts(children, parent, root_type, root_account=False):
"root_type",
"is_group",
"tax_rate",
"account_currency",
]:

account_number = cstr(child.get("account_number")).strip()
Expand Down Expand Up @@ -95,7 +96,17 @@ def identify_is_group(child):
is_group = child.get("is_group")
elif len(
set(child.keys())
- set(["account_name", "account_type", "root_type", "is_group", "tax_rate", "account_number"])
- set(
[
"account_name",
"account_type",
"root_type",
"is_group",
"tax_rate",
"account_number",
"account_currency",
]
)
):
is_group = 1
else:
Expand Down Expand Up @@ -185,6 +196,7 @@ def get_account_tree_from_existing_company(existing_company):
"root_type",
"tax_rate",
"account_number",
"account_currency",
],
order_by="lft, rgt",
)
Expand Down Expand Up @@ -267,6 +279,7 @@ def _import_accounts(children, parent):
"root_type",
"is_group",
"tax_rate",
"account_currency",
]:
continue

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def validate_columns(data):

no_of_columns = max([len(d) for d in data])

if no_of_columns > 7:
if no_of_columns > 8:
frappe.throw(
_("More columns found than expected. Please compare the uploaded file with standard template"),
title=(_("Wrong Template")),
Expand Down Expand Up @@ -233,6 +233,7 @@ def return_parent(data, child):
is_group,
account_type,
root_type,
account_currency,
) = i

if not account_name:
Expand All @@ -253,6 +254,8 @@ def return_parent(data, child):
charts_map[account_name]["account_type"] = account_type
if root_type:
charts_map[account_name]["root_type"] = root_type
if account_currency:
charts_map[account_name]["account_currency"] = account_currency
path = return_parent(data, account_name)[::-1]
paths.append(path) # List of path is created
line_no += 1
Expand Down Expand Up @@ -315,6 +318,7 @@ def get_template(template_type):
"Is Group",
"Account Type",
"Root Type",
"Account Currency",
]
writer = UnicodeWriter()
writer.writerow(fields)
Expand Down

0 comments on commit 4d92d46

Please sign in to comment.