Enable Dark Mode!
build-localization-module-odoo.png
By: Vaishnavi Babu

How to Build a Localization Module in Odoo

Technical

Localization in Odoo is all about inserting specific customizations so as to make the Odoo application suitable and well-fitting for a particular country. 

The first step for creating a localization module in odoo is to configure Chart of Accounts for the country, with the related dependencies like account types, taxes, etc.

Before that, while creating the module one should be aware of naming the module. It should be in l10n_XX format. In this case,  XX denotes the country code. For example, if we are creating a localization module for Kenya then l10n_ke will be the module name. In this way, one can name the localization module.

One can define the chart of accounts, taxes, etc in the localization module.

First, add an XML file under data.

for example:
<function model="account.chart.template" name="try_loading_for_current_company">
<value eval="[ref('l10n_ke.kenya_chart_template)]"/>
</function>
 
Here one can create an XML file under the data folder where l10n_ke.kenya_chart_template is the module. template_id is the corresponding template XML id and this file should be written at the very last in the manifest file. Also, this file loads the right chart of accounts on time.
 
The next step is to add chart of accounts under the data folder.
<record id="kenya_chart_template" model="account.chart.template">
<field name="name">Kenya Chart of Accounts - Standard</field>
<field name="code_digits">6</field>
<field name="bank_account_code_prefix">107</field>
<field name="cash_account_code_prefix">109</field>
<field name="transfer_account_code_prefix">90</field>
<field name="currency_id" ref="base.KES"/>
</record>
 
Kenya Chart of Accounts - This specifies the name to display for this chart of accounts.
code_digits - Code digits define the digits ( number) of account codes. By default, it is 6 the value.
bank_account_code_prefix - It specifies the prefix code for the bank accounts.
cash_account_code_prefix -  It specifies the prefix code of the cash accounts.
transfer_account_code_prefix - It specifies a prefix of the transfer account code.
currency_id - Here one can specify the currency id. E.g. "base.KES".
 
Configure Chart of Accounts:
Now one can add a new account to the chart of accounts.Thue user can create records of account.account.template type. Each account -> account -> template is able to create an account. account for each company.
 
<record id=".." model="account.account.template">
<field name="name">..</field>
<field name="code">..</field>
<field type="user_type_id>..</field>
<field name="chart_template_id" ref="..."/>
<field name=”reconcile" eval="..”/>
<field name="group_id” ref=".."/>
<field name="tag_ids" eval=".."/>
</record>
 
name - Here one can specify the name to be displayed for the account.
code - Defines the code to be displayed
user_type_id - Specifies the user type id.
chart_template_id - Here one can set chart of account of this account.
currency_id - States the secondary currency for each account -> move -> line linked to this account.
reconcile - Helps with reconciling entries in the account. By default, it should be true -the field.
group_id - Defines the account’s group_id.
tag_ids - The field tag_ids specifies some tags.
 
Inserting new tax to the chart of accounts:
Let’s see how to add a new tax to the chart of accounts.  The process of creating tax to chart of accounts is the same as the creation of accounts. The only difference between the creation of both is in creation of tax, one should use account -> tax -> template model.
 
<record id="..." model="account.tax.template">
<field name="name">...</field>
<field name="amount" eval="..."/>
<field name="chart_template_id" ref="..."/>
<field name="account_id" ref="..."/>
<field name="refund_account_id" ref="..."/>
<field name="type_tax_use">...</field>
<field name="amount_type" eval="..."/>
<field name="children_tax_ids" eval="..."/>
<field name="sequence" eval="..."/>
<field name="description">...</field>
<field name="price_include" eval="..."/>
<field name="include_base_amount" eval="..."/>
<field name="analytic" eval="..."/>
<field name="tag_ids" eval="...">
<field name="tax_group_id" ref="..."/>
<field name="tax_eligibility">...</field>
<field name="cash_basis_account" red="..."/>
</record>
 
name - Defines the tax name that to be displayed.
amount - Specifies the amount.
chart_template_id - Sets the tax’s chart of account.
account_id - Enables to define new account in case the tax doesn’t fall under the group of taxes.
efund_account_id - Enables to define new refund account in case the tax doesn’t fall under the group of taxes. 
type_tax_use - Here one can define the tax's type.
The allowed values are - Sale, purchase and None. However, the default value is Sales. 

However, adjustment is available to do some tax adjustments. None implies that tax can’t be used by itself, however, it can be implied within the group.

amount_type -  Defines the type of amount: group for a group of taxes, fixed for a tax with fixed amount, the percentage for a classic percentage of the price. The percentage amount is the default amount type. 
children_tax_ids - Defines certain children's taxes. It should be used within amount_type with group_set.
Sequence - Sequence field defines the sequence in which the tax lines are applied. By default, the sequence is 1.
description - Specifies a short text for invoices.
price_include - Triggers alarm in case amount is included in price. On the other hand, by default, it will be False.
include_base_amount - Helps in adding the amount to the base. On the other hand, it will be False by default. 
analytic - By default, the boolean field will be False. If set, the computed tax amount will be allotted to same analytic account as the invoice line (if any).
tag_ids - Specifies Tags. These tags must include  'taxes' as applicability.
tax_group_id  - Specifies tax group for displaying the sum of taxes in the invoices.
tax_eligibility - The field tax_eligibility defines the tax eligibility either based on invoice or either based on payment.By default,  the value will be 'on_invoice'.
cash_basis_account - It defines tax eligibility 'on_payment' in case of a cash basis account.

An example of l10n_ke :
<record id="tag_ke_02" model="account.account.tag">
    <field name="name">Input VAT 5%</field>
    <field name="applicability">taxes</field>
</record>
<record id="kenya_sale_tax_5_dubai" model="account.tax.template">
        <field name="name">VAT 5% </field>
    <field name="type_tax_use">sale</field>
    <field name="amount">5</field>
    <field name="amount_type">percent</field>
    <field name="description">VAT 5%</field>
    <field name="tax_group_id" ref="ke_tax_group_5"/>
    <field name="tag_ids" eval="[(6,0,[ref('tag_ke_01')])]"/>
    <field name="chart_template_id" ref="kenya_chart_template"/>
</record>

Adding a fiscal position to chart of accounts:
To create a fiscal position to chart of accounts use the account -> fiscal -> position -> template model.

<record id="..." model="account.fiscal.position.template">
<field name="name">...</field>
<field name="chart_template_id" ref="..."/>
<field name="note">...</field>
</record>
 
name - Specifies the fiscal position name.
chart_template_id - Sets the chart of account for the fiscal position.
Note - Here one can add additional notes if needed.
 
Adding properties to chart of accounts:
After the creation of accounts now one can add some properties to the generated chart of accounts.

<record id="kenya_chart_template" model="account.chart.template">
    <field name="property_account_receivable_id" ref="p10054"/>
    <field name="property_account_payable_id" ref="p1017"/>
    <field name="property_account_expense_categ_id" ref="p11241"/>
    <field name="property_account_income_categ_id" ref="p11211"/>
    <field name="income_currency_exchange_account_id" ref="p1012"/>
    <field name="expense_currency_exchange_account_id" ref="p11223"/>
</record>
 
In all these files, you can add under the data folder and if you have any CSV document one can attach that document to the data folder. In this way, one can build a localization module for a specific country.


If you need any assistance in odoo, we are online, please chat with us.



0
Comments



Leave a comment



whatsapp_icon
location

Calicut

Cybrosys Technologies Pvt. Ltd.
Neospace, Kinfra Techno Park
Kakkancherry, Calicut
Kerala, India - 673635

location

Kochi

Cybrosys Technologies Pvt. Ltd.
1st Floor, Thapasya Building,
Infopark, Kakkanad,
Kochi, India - 682030.

location

Bangalore

Cybrosys Techno Solutions
The Estate, 8th Floor,
Dickenson Road,
Bangalore, India - 560042

Send Us A Message