Skip to Content
Odoo Menu
  • Prijavi
  • Try it free
  • Aplikacije
    Finance
    • Knjigovodstvo
    • Obračun
    • Stroški
    • Spreadsheet (BI)
    • Dokumenti
    • Podpisovanje
    Prodaja
    • CRM
    • Prodaja
    • POS Shop
    • POS Restaurant
    • Naročnine
    • Najem
    Spletne strani
    • Website Builder
    • Spletna trgovina
    • Blog
    • Forum
    • Pogovor v živo
    • eUčenje
    Dobavna veriga
    • Zaloga
    • Proizvodnja
    • PLM
    • Nabava
    • Vzdrževanje
    • Kakovost
    Kadri
    • Kadri
    • Kadrovanje
    • Odsotnost
    • Ocenjevanja
    • Priporočila
    • Vozni park
    Marketing
    • Družbeno Trženje
    • Email Marketing
    • SMS Marketing
    • Dogodki
    • Avtomatizacija trženja
    • Ankete
    Storitve
    • Projekt
    • Časovnice
    • Storitve na terenu
    • Služba za pomoč
    • Načrtovanje
    • Termini
    Produktivnost
    • Razprave
    • Odobritve
    • IoT
    • Voip
    • Znanje
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Industrije
    Trgovina na drobno
    • Book Store
    • Trgovina z oblačili
    • Trgovina s pohištvom
    • Grocery Store
    • Trgovina s strojno opremo računalnikov
    • Trgovina z igračami
    Food & Hospitality
    • Bar and Pub
    • Restavracija
    • Hitra hrana
    • Guest House
    • Beverage Distributor
    • Hotel
    Nepremičnine
    • Real Estate Agency
    • Arhitekturno podjetje
    • Gradbeništvo
    • Estate Management
    • Vrtnarjenje
    • Združenje lastnikov nepremičnin
    Svetovanje
    • Računovodsko podjetje
    • Odoo Partner
    • Marketinška agencija
    • Law firm
    • Pridobivanje talentov
    • Audit & Certification
    Proizvodnja
    • Tekstil
    • Metal
    • Pohištvo
    • Hrana
    • Brewery
    • Poslovna darila
    Health & Fitness
    • Športni klub
    • Trgovina z očali
    • Fitnes center
    • Wellness Practitioners
    • Lekarna
    • Frizerski salon
    Trades
    • Handyman
    • IT Hardware & Support
    • Sistemi sončne energije
    • Izdelovalec čevljev
    • Čistilne storitve
    • HVAC Services
    Ostali
    • Neprofitna organizacija
    • Agencija za okolje
    • Najem oglasnih panojev
    • Fotografija
    • Najem koles
    • Prodajalec programske opreme
    Browse all Industries
  • Skupnost
    Learn
    • Tutorials
    • Dokumentacija
    • Certifikati
    • Šolanje
    • Blog
    • Podcast
    Empower Education
    • Education Program
    • Scale Up! Business Game
    • Visit Odoo
    Get the Software
    • Prenesi
    • Compare Editions
    • Releases
    Collaborate
    • Github
    • Forum
    • Dogodki
    • Prevodi
    • Become a Partner
    • Services for Partners
    • Register your Accounting Firm
    Get Services
    • Find a Partner
    • Find an Accountant
    • Meet an advisor
    • Implementation Services
    • Sklici kupca
    • Podpora
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Get a demo
  • Določanje cen
  • Pomoč

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

  • CRM
  • e-Commerce
  • Knjigovodstvo
  • Zaloga
  • PoS
  • Projekt
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Ključne besede (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Ključne besede (View all)
odoo accounting v14 pos v15
About this forum
Pomoč

duplicate key Error while updating model

Naroči se

Get notified when there's activity on this post

This question has been flagged
5 Odgovori
5897 Prikazi
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
Opusti
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
Avtor

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
Avtor

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
Avtor

solution was: "vacuumdb -f DBNAME"

Avatar
Jack
Avtor Best Answer

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
Opusti
Enjoying the discussion? Don't just read, join in!

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

Prijavi
Community
  • Tutorials
  • Dokumentacija
  • Forum
Open Source
  • Prenesi
  • Github
  • Runbot
  • Prevodi
Services
  • Odoo.sh Hosting
  • Podpora
  • Nadgradnja
  • Custom Developments
  • Izobraževanje
  • Find an Accountant
  • Find a Partner
  • Become a Partner
About us
  • Our company
  • Sredstva blagovne znamke
  • Kontakt
  • Zaposlitve
  • Dogodki
  • Podcast
  • Blog
  • Stranke
  • Pravno • Zasebnost
  • Varnost
الْعَرَبيّة 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 is a suite of open source business apps that cover all your company needs: CRM, eCommerce, accounting, inventory, point of sale, project management, etc.

Odoo's unique value proposition is to be at the same time very easy to use and fully integrated.

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