Bỏ qua để đến Nội dung
Odoo Menu
  • Đăng nhập
  • Dùng thử miễn phí
  • Ứng dụng
    Tài chính
    • Kế toán
    • Hóa đơn
    • Chi phí
    • Bảng tính (BI)
    • Tài liệu
    • Ký tên
    Bán hàng
    • CRM
    • Bán hàng
    • POS Cửa hàng
    • POS Nhà hàng
    • Đăng ký
    • Cho thuê
    Trang web
    • Trình tạo trang web
    • Thương mại điện tử
    • Blog
    • Diễn đàn
    • Trò chuyện trực tiếp
    • Học trực tuyến
    Chuỗi cung ứng
    • Tồn kho
    • Sản xuất
    • PLM
    • Mua hàng
    • Bảo dưỡng
    • Chất lượng
    Nhân sự
    • Nhân viên
    • Tuyển dụng
    • Ngày nghỉ
    • Đánh giá
    • Giới thiệu
    • Đội xe
    Marketing
    • Marketing trên MXH
    • Marketing qua email
    • Marketing qua SMS
    • Sự kiện
    • Tự động hóa Marketing
    • Khảo sát
    Dịch vụ
    • Dự án
    • Bảng chấm công
    • Dịch vụ hiện trường
    • Hỗ trợ
    • Kế hoạch
    • Lịch hẹn
    Năng suất
    • Thảo luận
    • Phê duyệt
    • IoT
    • VoIP
    • Kiến thức
    • WhatsApp
    Ứng dụng của bên thứ ba Studio Odoo Nền tảng Đám mây Odoo
  • Ngành
    Bán lẻ
    • Nhà sách
    • Cửa hàng quần áo
    • Cửa hàng nội thất
    • Cửa hàng tạp hóa
    • Cửa hàng đồ kim khí
    • Cửa hàng đồ chơi
    Ẩm thực & Dịch vụ lưu trú
    • Bar và quán rượu
    • Nhà hàng
    • Đồ ăn nhanh
    • Guest house
    • Nhà phân phối đồ uống
    • Khách sạn
    Bất động sản
    • Công ty môi giới bất động sản
    • Công ty kiến trúc
    • Xây dựng
    • Quản lý bất động sản
    • Làm vườn
    • Hiệp hội chủ sở hữu bất động sản
    Tư vấn
    • Công ty kế toán
    • Đối tác Odoo
    • Công ty marketing
    • Công ty luật
    • Tuyển dụng
    • Thanh tra & chứng nhận
    Sản xuất
    • Dệt may
    • Kim loại
    • Nội thất
    • Ẩm thực
    • Nhà máy bia
    • Quà tặng doanh nghiệp
    Sức khoẻ & fitness
    • CLB thể thao
    • Cửa hàng kính mắt
    • Trung tâm fitness
    • Chuyên gia chăm sóc sức khỏe
    • Hiệu thuốc
    • Tiệm làm tóc
    Thương mại
    • Dịch vụ sửa chữa
    • Phần cứng CNTT & Hỗ trợ
    • Hệ thống năng lượng mặt trời
    • Công ty sản xuất giày
    • Dịch vụ vệ sinh
    • Dịch vụ HVAC
    Khác
    • Tổ chức phi lợi nhuận
    • Cơ quan môi trường
    • Cho thuê biển quảng cáo
    • Nhiếp ảnh
    • Cho thuê xe đạp
    • Đại lý phần mềm
    Xem tất cả ngành
  • Cộng đồng
    Học tập
    • Khóa học
    • Tài liệu
    • Chứng chỉ
    • Đào tạo
    • Blog
    • Podcast
    Thúc đẩy đào tạo
    • Chương trình đào tạo
    • Trò chơi kinh doanh Scale Up!
    • Tham quan Odoo
    Nhận phần mềm
    • Tải xuống
    • So sánh các phiên bản
    • Phiên bản
    Hợp tác
    • Github
    • Diễn đàn
    • Sự kiện
    • Dịch thuật
    • Trở thành đối tác
    • Dịch vụ dành cho Đối tác
    • Đăng ký công ty kế toán của bạn
    Nhận dịch vụ
    • Tìm đối tác
    • Tìm kế toán
    • Gặp chuyên gia hỗ trợ
    • Dịch vụ Triển khai
    • Khách hàng tham khảo
    • Hỗ trợ
    • Nâng cấp
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Nhận một buổi demo
  • Bảng giá
  • Trợ giúp

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

  • CRM
  • e-Commerce
  • Kế toán
  • Tồn kho
  • PoS
  • Dự án
  • MRP
All apps
Bạn cần phải đăng ký để tương tác với cộng đồng.
Tất cả bài viết Người Huy hiệu
Thẻ (Xem tất cả)
odoo accounting v14 pos v15
Về diễn đàn này
Bạn cần phải đăng ký để tương tác với cộng đồng.
Tất cả bài viết Người Huy hiệu
Thẻ (Xem tất cả)
odoo accounting v14 pos v15
Về diễn đàn này
Hỗ trợ

duplicate key Error while updating model

Đăng ký nhận tin

Nhận thông báo khi có hoạt động trên bài viết này

Câu hỏi này đã bị gắn cờ
5 Trả lời
5898 Lượt xem
Ảnh đại diện
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
Ảnh đại diện
Huỷ bỏ
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
Tác giả

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
Tác giả

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
Tác giả

solution was: "vacuumdb -f DBNAME"

Ảnh đại diện
Jack
Tác giả Câu trả lời hay nhất

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
Ảnh đại diện
Huỷ bỏ
Bạn có hứng thú với cuộc thảo luận không? Đừng chỉ đọc, hãy tham gia nhé!

Tạo tài khoản ngay hôm nay để tận hưởng các tính năng độc đáo và tham gia cộng đồng tuyệt vời của chúng tôi!

Đăng ký
Cộng đồng
  • Khóa học
  • Tài liệu
  • Diễn đàn
Open source
  • Tải xuống
  • Github
  • Runbot
  • Dịch thuật
Dịch vụ
  • Lưu trữ Odoo.sh
  • Hỗ trợ
  • Nâng cấp
  • Phát triển tùy chỉnh
  • Đào tạo
  • Tìm kế toán
  • Tìm đối tác
  • Trở thành đối tác
Giới thiệu công ty
  • Công ty của chúng tôi
  • Tài sản thương hiệu
  • Liên hệ
  • Việc làm
  • Sự kiện
  • Podcast
  • Blog
  • Khách hàng
  • Pháp lý • Riêng tư
  • Bảo mật
الْعَرَبيّة 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 là bộ ứng dụng kinh doanh có open source đáp ứng tất cả các nhu cầu của công ty bạn: CRM, thương mại điện tử, kế toán, tồn kho, POS, quản lý dự án, v.v.

Định hướng giá trị riêng biệt của Odoo là tích hợp hoàn toàn và dễ dàng sử dụng.

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