Odoo Help

0

How to resolve ParseError: duplicate key value violates unique constraint

By
Luigi Sison
on 7/5/16, 12:18 PM 550 views

 Version 9

The code IND is used in 2 models:

<record id="ind" model="hc.vs.participation.type">   

            <field name="code">IND</field>

 

<record id="ind" model="hc.vs.identifier.type">

            <field name="code">IND</field>


Each model has the SQL constraint

_sql_constraints = [

        ('code_unique',

        'UNIQUE(code)',

        "The concept code must be unique.")

        ]

0
Michael Watchorn
On 7/5/16, 5:21 PM

The field in the models are not the problem. It's the record ID that is the problem. Both record ID's are "ind":

<record id="ind" .....

There in lies your problem.

 Are you loading XML data this way? Where is the rest of the code. We can help you out more if we can see the rest of it.

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)

Stats

Asked: 7/5/16, 12:18 PM
Seen: 550 times
Last updated: 7/5/16, 5:21 PM