Multilingual Chart of Accounts

I have issue with Chart of Accounts when changing the user language, I need to give the account name based on user language, Is Custom Translations can help me on this and how?

2 Likes

@Mohammed_Redha
This will help you get started > GitHub - frappe/chart_of_accounts_builder

Thank you for fast reply, but I need it to be on Multilingual, the company has different nationalities employees.
So what do you suggest whith “chart_of_accounts_builder”?
Should I create different Chart of Accounts for each language or what?

What are you referring to is very unusual use case scenario AFAIK, will you please share your detailed use case with example?

for English user will see this :

for Arabic user should see this :
<img src=“/uploads/default/original/2X/a/ae07f900a72a357ab94fac11da32d8dd3b075987.png” width=“267” height=“332”

1 Like

Ok, so you mean, multilingual charts-of-account with regards to the default language of the User under same ERPNext instance.
If System default language is Arabic, but
Some of User’s/Employee’s language of choice is set to English then Charts of Accounts should be in English only (maybe translated version)

1 Like

Yes, If the default language of the User is English he will see English Charts of Accounts and if the user is Arabic he will see Arabic Charts of Accounts.
Under same ERPNext instance.

How to make translated version?

Not sure, but AFAIK that is not possible out-of-the-box at present.
We need more discussion on direct translatability of charts of accounts and consequences.

What do you suggest and how to go further

I will recommend you to open an issue at GitHub - frappe/erpnext: Free and Open Source Enterprise Resource Planning (ERP) requesting it and wait till someone responds.

I solve it with this steps:
1-Add extra feild for account name


2-edite /frappe-bench/apps/erpnext/erpnext/accounts/utils.py get_children():

def get_children():
	args = frappe.local.form_dict
	doctype, company = args['doctype'], args['company']
	fieldname = frappe.db.escape(doctype.lower().replace(' ','_'))
	doctype = frappe.db.escape(doctype)
	# root
	if args['parent'] in ("Accounts", "Cost Centers"):
		fields = ", root_type, report_type, account_currency" if doctype=="Account" else ""
		acc = frappe.db.sql(""" select
			name as value, account_name_arabic as value2, is_group as expandable {fields}
			from `tab{doctype}`
			where ifnull(`parent_{fieldname}`,'') = ''
			and `company` = %s	and docstatus<2
			order by name""".format(fields=fields, fieldname = fieldname, doctype=doctype),
				company, as_dict=1)
		if args["parent"]=="Accounts":
			sort_root_accounts(acc)
	else:
		# other
		fields = ", account_currency" if doctype=="Account" else ""
		acc = frappe.db.sql("""select
			name as value, account_name_arabic as value2, is_group as expandable, parent_{fieldname} as parent {fields}
			from `tab{doctype}`
			where ifnull(`parent_{fieldname}`,'') = %s
			and docstatus<2
			order by name""".format(fields=fields, fieldname=fieldname, doctype=doctype),
				args['parent'], as_dict=1)
	if doctype == 'Account':
		company_currency = frappe.db.get_value("Company", company, "default_currency")
		for each in acc:
			each["company_currency"] = company_currency
			each["balance"] = flt(get_balance_on(each.get("value"), in_account_currency=False))
			if each.account_currency != company_currency:
				each["balance_in_account_currency"] = flt(get_balance_on(each.get("value")))
	return acc

I add , account_name_arabic as value2 to sql to retrive Arabic name from DB
3-Edite apps/frappe/frappe/public/js/frappe/ui/tree.js addnode()

addnode: function(data) {
var $li = $(‘

  • ’);
    if(this.tree.drop) $li.draggable({revert:true});
    return new frappe.ui.TreeNode({
    tree:this.tree,
    parent: $li.appendTo(this.$ul),
    parent_label: this.label,
    label:(frappe.boot.lang == “en”) ? data.value : data.value2,
    expandable: data.expandable,
    data: data
    });
    },

  • In label:(frappe.boot.lang == "en") ? data.value : data.value2, will check lang of system, If ‘en’ it will display default value else Arabic name

    6 Likes

    that’s great effort from you mohammed .

    Dear Mohammad,

    I need help regarding this Chart of Accounts, when I go to add field in the accounts doctype it is restricted.

    Kindly let me know how to add the field.