Overslaan naar inhoud
Menu
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Deze vraag is gerapporteerd
1 Beantwoorden
4478 Weergaven

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
Annuleer
Beste antwoord

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
Annuleer
Gerelateerde posts Antwoorden Weergaven Activiteit
1
feb. 24
2347
2
nov. 23
2614
4
aug. 25
2209
1
sep. 24
922
0
dec. 23
1523