Skip to Content
Menu
This question has been flagged
1 Odpoveď
4481 Zobrazenia

I would like to extend the `l10n_in` localization in my custom module `test_module` by adding additional accounts to the Chart of Accounts `l10n_in.indian_chart_template_standard`.


Defined `account.account.template` XML data containing entries like:

        <record model="account.account.template" id="p10100">
<field name="name">Test Account Receivable</field>
<field name="code">10100</field>
<field name="user_type_id" ref="account.data_account_type_current_assets"/>
<field name="reconcile" eval="False"/>
<field name="chart_template_id" ref="l10n_in.indian_chart_template_standard"/>
</record>

I have also defined an XML to load the templates for companies:

    <data noupdate="0">
<function model="account.chart.template" name="try_loading_for_current_company">
<value eval="[ref('l10n_in.indian_chart_template_standard')]"/>
</function>
</data>


But installing `test_module` on a new database results in following error (because the journals are already created by `l10n_in` module and it tries to load again?)

odoo.tools.convert.ParseError: "duplicate key value violates unique constraint "account_journal_code_company_uniq"
DETAIL:  Key (code, name, company_id)=(INV, Tax Invoices, 1) already exists.
" while parsing /opt/odoo/addons/test_module/data/account_chart_template_data.xml:4, near
<function model="account.chart.template" name="try_loading_fpos_for_current_company">
            <value eval="[ref('l10n_in.indian_chart_template_standard')]"/>
        </function>


What is the best practice to handle such cases properly in code?



Avatar
Zrušiť
Best Answer

Your account number may be repeated twice in your account chart. The best way is to comment on this section and after installing the module in the accounting settings section, select the desired localization. 


—>


This is probably an error. Now check the Odo server log to find the error. After fixing the error, you can return the commented part to its original state.

Avatar
Zrušiť
Related Posts Replies Zobrazenia Aktivita
1
feb 24
2351
2
nov 23
2617
4
aug 25
2213
1
sep 24
925
0
dec 23
1527