This question has been flagged
4 Replies
28086 Views

Hi, 

Trying to import translation in Odoo 12, i get the following error : 

ERROR: ON CONFLICT DO UPDATE command cannot affect row a second time
HINT: Ensure that no rows proposed for insertion within the same command have duplicate constrained
values.

i did some research and found out that postgres included On Conflict to 'Upsert' a record. 
That is to say : when you insert a new row into the table, PostgreSQL will update the row if it already exists, otherwise, PostgreSQL inserts the new row. 

See http://www.postgresqltutorial.com/postgresql-upsert/ for more details. 

In my case, what should i do so that i can import translation successfully ?

Thank you.

Avatar
Discard

Did you check that you aren't trying to translate the same thing twice in the same import file?

I experience the same issue if the option 'Overwrite existing terms' is turned on. It seems that the bug https://github.com/odoo/odoo/issues/27268 is not fully fixed

Author

Hi @Ray,

Yes, i'm not translating the same thing twice in the same import file.

@Odoo Tools,

Thanks for the link. Altough in moylop260's scenario, ``Overwrite existing terms`` is not checked.

In my example, it is indeed checked and get the same problem.

Author Best Answer

I found out that in the po file, a word was translated twice as Ray said. had to look carefully for each line to get the wrong one.

Avatar
Discard

Okay, how we can find duplicates? I have more than 3000 translation terms.

Best Answer

@Ibrahim Boudmir

To check for duplicate lines in your .po file, you can use Poedit https://poedit.net/, which will alert you directly if there are any duplicates.

Avatar
Discard
Best Answer

hi @ibrahim

i had the same issue , its because i installed a module version 11 in 12 version , if it's your case try to adapt your file lang.po  with version 12

Avatar
Discard
Best Answer

Did you figure out how to fix it? I've updated odoo 12 to latest version. The 2 modules that I've migrated from odoo 10, I've exported the translation form odoo 12 and replaced the translation files in models.

But I still get the error when I want to add the language with override terms.


Avatar
Discard

after that you cloud just run load translation with option Overwrite existing terms or did you have to remove the module first? Thanks

Author

overwrite existing terms won't delete redundant translations from your po file.

you need to figure out what translation is declared twice or more in it.