Skip to Content
Odoo Menu
  • Log ind
  • Prøv gratis
  • Apps
    Økonomi
    • Bogføring
    • Fakturering
    • Udgifter
    • Regneark (BI)
    • Dokumenter
    • e-Signatur
    Salg
    • CRM
    • Salg
    • POS Butik
    • POS Restaurant
    • Abonnementer
    • Udlejning
    Hjemmeside
    • Hjemmesidebygger
    • e-Handel
    • Blog
    • Forum
    • LiveChat
    • e-Læring
    Forsyningskæde
    • Lagerbeholdning
    • Produktion
    • PLM
    • Indkøb
    • Vedligeholdelse
    • Kvalitet
    HR
    • Medarbejdere
    • Rekruttering
    • Fravær
    • Medarbejdersamtaler
    • Anbefalinger
    • Flåde
    Marketing
    • Markedsføring på sociale medier
    • E-mailmarketing
    • SMS-marketing
    • Arrangementer
    • Automatiseret marketing
    • Spørgeundersøgelser
    Tjenester
    • Projekt
    • Timesedler
    • Udkørende Service
    • Kundeservice
    • Planlægning
    • Aftaler
    Produktivitet
    • Dialog
    • Godkendelser
    • IoT
    • VoIP
    • Vidensdeling
    • WhatsApp
    Tredjepartsapps Odoo Studio Odoo Cloud-platform
  • Brancher
    Detailhandel
    • Boghandel
    • Tøjforretning
    • Møbelforretning
    • Dagligvarebutik
    • Byggemarked
    • Legetøjsforretning
    Mad og værtsskab
    • Bar og pub
    • Restaurant
    • Fastfood
    • Gæstehus
    • Drikkevareforhandler
    • Hotel
    Ejendom
    • Ejendomsmægler
    • Arkitektfirma
    • Byggeri
    • Ejendomsadministration
    • Havearbejde
    • Boligejerforening
    Rådgivning
    • Regnskabsfirma
    • Odoo-partner
    • Marketingbureau
    • Advokatfirma
    • Rekruttering
    • Audit & certificering
    Produktion
    • Tekstil
    • Metal
    • Møbler
    • Fødevareproduktion
    • Bryggeri
    • Firmagave
    Heldbred & Fitness
    • Sportsklub
    • Optiker
    • Fitnesscenter
    • Kosmetolog
    • Apotek
    • Frisør
    Håndværk
    • Handyman
    • IT-hardware og support
    • Solenergisystemer
    • Skomager
    • Rengøringsservicer
    • VVS- og ventilationsservice
    Andet
    • Nonprofitorganisation
    • Miljøagentur
    • Udlejning af billboards
    • Fotografi
    • Cykeludlejning
    • Softwareforhandler
    Gennemse alle brancher
  • Community
    Få mere at vide
    • Tutorials
    • Dokumentation
    • Certificeringer
    • Oplæring
    • Blog
    • Podcast
    Bliv klogere
    • Udannelselsesprogram
    • Scale Up!-virksomhedsspillet
    • Besøg Odoo
    Få softwaren
    • Download
    • Sammenlign versioner
    • Udgaver
    Samarbejde
    • Github
    • Forum
    • Arrangementer
    • Oversættelser
    • Bliv partner
    • Tjenester til partnere
    • Registrér dit regnskabsfirma
    Modtag tjenester
    • Find en partner
    • Find en bogholder
    • Kontakt en rådgiver
    • Implementeringstjenester
    • Kundereferencer
    • Support
    • Opgraderinger
    Github Youtube Twitter LinkedIn Instagram Facebook Spotify
    +1 (650) 691-3277
    Få en demo
  • Prissætning
  • Hjælp

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Bogføring
  • Lager
  • PoS
  • Projekt
  • MRP
All apps
Du skal være registreret for at interagere med fællesskabet.
All Posts People Emblemer
Tags (View all)
odoo accounting v14 pos v15
Om dette forum
Du skal være registreret for at interagere med fællesskabet.
All Posts People Emblemer
Tags (View all)
odoo accounting v14 pos v15
Om dette forum
Hjælp

duplicate key Error while updating model

Tilmeld

Få besked, når der er aktivitet på dette indlæg

Dette spørgsmål er blevet anmeldt
5 Besvarelser
5895 Visninger
Avatar
Jack

we use Odoo Community Edition V12 since 1,5years now.

in a simple custom module we just changed a XML File.

Updating will be done by command-line "odoo -u CUSTOMMODULE -d DBNAME --config="PATH"

But suddenly we get this error while updating:

ERROR odoonew22 odoo.sql_db: bad query: b"INSERT INTO ir_model_fields (field_description,relation_table,copied,related,name,track_visibility,required,size,store,model,index,translate,state,on_delete,model_id,readonly,ttype,relation,column2,help,relation_field,column1,selectable) VALUES ('Pricelist Name', NULL, true, NULL, 'name', NULL, true, NULL, true, 'product.pricelist', false, true, 'base', NULL, 170, false, 'char', NULL, NULL, NULL, NULL, NULL, true),('Active', NULL, true, NULL, 'active', NULL, false, NULL, true, 'product.pricelist', false, false, 'base', NULL, 170, false, 'boolean', NULL, NULL, 'If unchecked, it will allow you to hide the pricelist without removing it.', NULL, NULL, true),('Pricelist Items', NULL, true, NULL, 'item_ids', NULL, false, NULL, true, 'product.pricelist', false, false, 'base', NULL, 170, false, 'one2many', 'product.pricelist.item', NULL, NULL, 'pricelist_id', NULL, true),('Currency', NULL, true, NULL, 'currency_id', NULL, true, NULL, true, 'product.pricelist', false, false, 'base', 'set null', 170, false, 'many2one', 'res.currency', NULL, NULL, NULL, NULL, true),('Company', NULL, true, NULL, 'company_id', NULL, false, NULL, true, 'product.pricelist', false, false, 'base', 'set null', 170, false, 'many2one', 'res.company', NULL, NULL, NULL, NULL, true),('Sequence', NULL, true, NULL, 'sequence', NULL, false, NULL, true, 'product.pricelist', false, false, 'base', NULL, 170, false, 'integer', NULL, NULL, NULL, NULL, NULL, true),('Country Groups', 'res_country_group_pricelist_rel', true, NULL, 'country_group_ids', NULL, false, NULL, true, 'product.pricelist', false, false, 'base', NULL, 170, false, 'many2many', 'res.country.group', 'res_country_group_id', NULL, NULL, 'pricelist_id', true),('Discount Policy', NULL, true, NULL, 'discount_policy', NULL, false, NULL, true, 'product.pricelist', false, false, 'base', NULL, 170, false, 'selection', NULL, NULL, NULL, NULL, NULL, true),('ID', NULL, true, NULL, 'id', NULL, false, NULL, true, 'product.pricelist', false, false, 'base', NULL, 170, true, 'integer', NULL, NULL, NULL, NULL, NULL, true),('Display Name', NULL, false, NULL, 'display_name', NULL, false, NULL, false, 'product.pricelist', false, false, 'base', NULL, 170, true, 'char', NULL, NULL, NULL, NULL, NULL, false),('Created by', NULL, true, NULL, 'create_uid', NULL, false, NULL, true, 'product.pricelist', false, false, 'base', 'set null', 170, true, 'many2one', 'res.users', NULL, NULL, NULL, NULL, true),('Created on', NULL, true, NULL, 'create_date', NULL, false, NULL, true, 'product.pricelist', false, false, 'base', NULL, 170, true, 'datetime', NULL, NULL, NULL, NULL, NULL, true),('Last Updated by', NULL, true, NULL, 'write_uid', NULL, false, NULL, true, 'product.pricelist', false, false, 'base', 'set null', 170, true, 'many2one', 'res.users', NULL, NULL, NULL, NULL, true),('Last Updated on', NULL, true, NULL, 'write_date', NULL, false, NULL, true, 'product.pricelist', false, false, 'base', NULL, 170, true, 'datetime', NULL, NULL, NULL, NULL, NULL, true),('Last Modified on', NULL, false, NULL, '__last_update', NULL, false, NULL, false, 'product.pricelist', false, false, 'base', NULL, 170, true, 'datetime', NULL, NULL, NULL, NULL, NULL, false),('Priorit\xc3\xa4t', NULL, true, NULL, 'priority', NULL, false, NULL, true, 'product.pricelist', false, false, 'base', NULL, 170, false, 'integer', NULL, NULL, 'Die h\xc3\xb6chste Priorit\xc3\xa4t startet bei 100. Ist eine Preisliste auf einem Artikel nicht verf\xc3\xbcgbar wird die n\xc3\xa4chst h\xc3\xb6here Priort\xc3\xa4t gew\xc3\xa4hlt.', NULL, NULL, true) RETURNING id"
ERROR: FEHLER:  doppelter Schlüsselwert verletzt Unique-Constraint »ir_model_fields_name_unique«
DETAIL:  Schlüssel »(model, name)=(product.pricelist, active)« existiert bereits.
 
2020-10-13 16:20:03,482 63171 WARNING odoonew22 odoo.modules.loading: Transient module states were reset
2020-10-13 16:20:03,483 63171 ERROR odoonew22 odoo.modules.registry: Failed to load registry
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/odoo/modules/registry.py", line 60, in __new__
    return cls.registries[db_name]
  File "/usr/lib/python3/dist-packages/odoo/tools/func.py", line 69, in wrapper
    return func(self, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/odoo/tools/lru.py", line 44, in __getitem__
    a = self.d[obj].me
KeyError: 'odoonew22'


we did not change anything at model product.pricelist.

The Error MEssage is in german: it tells that Unique-Constraint »ir_model_fields_name_unique« is violated during the upper INSERT statement to ir_model_fields.


0
Avatar
Kassér
Niyas Raphy (Walnut Software Solutions)

it will be better if you can add the code i which you made the change, also ensure the error is not there, if you revert the last change, as you are getting a unique constrains error, if you are changing some data files, try giving some another name etc

Jack
Forfatter

any hints how to fix this? we alreads reverted all changes and in testenvironment it works as expected with same Files and inserted DB-Dump

Jack
Forfatter

very strange..

select * from ir_model_fields where model LIKE 'product.pricelist%'

this givs us results where model is product_pricelist

BUT:

select * from ir_model_fields where model = 'product.pricelist'

this does not giv any results (although the upper query shows results with product.pricelist)

Jack
Forfatter

solution was: "vacuumdb -f DBNAME"

Avatar
Jack
Forfatter Bedste svar

we already reverted all change. (only added a field in a tree view of the custom module).

moreover we copied all sources and DB-Dump to another Server but there i do not get this duplicate insert error when updating the module. Maybe some DB-Issues?

0
Avatar
Kassér
Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Tilmeld dig
Community
  • Tutorials
  • Dokumentation
  • Forum
Open Source
  • Download
  • Github
  • Runbot
  • Oversættelser
Tjenester
  • Odoo.sh-hosting
  • Support
  • Opgradere
  • Individuelt tilpasset udvikling
  • Uddannelse
  • Find en bogholder
  • Find en partner
  • Bliv partner
Om os
  • Vores virksomhed
  • Brandaktiver
  • Kontakt os
  • Stillinger
  • Arrangementer
  • Podcast
  • Blog
  • Kunder
  • Juridiske dokumenter • Privatlivspolitik
  • Sikkerhedspolitik
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo er en samling open source-forretningsapps, der dækker alle dine virksomhedsbehov – lige fra CRM, e-handel og bogføring til lagerstyring, POS, projektledelse og meget mere.

Det unikke ved Odoo er, at systemet både er brugervenligt og fuldt integreret.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now