This question has been flagged

Here below is the code used to implement a new chart account.

Everything works fine :

<?xml version="1.0" encoding="utf-8"?>
<odoo>
    <data noupdate="1">

         <record id="l10n_fr_custom.1_pcg_701" model="account.account">
            <field name="name">Ventes de produits TVA NP</field>
            <field name="code">70100000</field>
            <field name="user_type_id" ref="account.data_account_type_revenue"/>
        </record>



    </data>
</odoo>


But when I update the whole code, appears an error :



odoo.sql_db: bad query: b'INSERT INTO "account_account" ("id", "deprecated", "code", "name", "reconcile", "company_id", "user_type_id", "create_uid", "write_uid", "create_date", "write_date") VALUES(nextval(\'account_account_id_seq\'), false, \'70100000\', \'Ventes de produits TVA NP\', false, 1, 14, 1, 1, (now() at time zone \'UTC\'), (now() at time zone \'UTC\')) RETURNING id'
ERROR: duplicate key value violates unique constraint "account_account_code_company_uniq"
DETAIL:  Key (code, company_id)=(70100000, 1) already exists.


How am I supposed to resolve this ?

Avatar
Discard

Your log says the error and its more detailed