Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
6 Trả lời
9457 Lượt xem

A client decided to delete the superadmin user from their Odoo 12 installation, so they're now receiving errors. They created a new user and linked the "Administrator" partner to that user.

For example, when installing the Leaves module they get errors like:

KeyError: ('ir.model.data', <function IrModelData.xmlid_lookup at 0x7f6c422089d8>, 'base.user_admin') 
ValueError: <class 'ValueError'>: "External ID not found in the system: base.user_admin" while evaluating
"[(4, ref('base.user_root')), (4, ref('base.user_admin'))]"
ValueError: External ID not found in the system: base.user_admin

I have tried creating a new user and changing its ID to 2 directly in the res_users table trying to replicate the deleted user, but it doesn't seem to have any effect.

Where does Odoo define which user is the super user if it's not hardcoded by id? Where should I look/what should I change? Any ideas?

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

I had to add a new entry in the ir.model.data table with name user_admin and referencing my new user id to fix it (base module, res.users model, res_id 2).


Ảnh đại diện
Huỷ bỏ

Good day @Victor.
I am trying to install an addon but running into the same failure as per above. I subsequently need to restore the superadmin user as per the comment here.

I am running Odoo 16.0-20241124 (Community Edition).

Pardon my ignorance, but could you please provide me with the detailed steps (sql query) that I need to run to update the table?

Câu trả lời hay nhất

I thank you for your help. We were able to solve that problem with your solution

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Hello, have the same issue. Can you provide some more information how to fix it? 

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Thanks, Victor

I got the same problem on Odoo 13 and fixed that following your suggestion

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Okay, add your new user in the following groups. 

ref('base.user_root')), (4, ref('base.user_admin'), don't forget to grant all superaccess.
Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

External id is required for this user as it is used at many places. You can try by updating external_id for that new user to base.user_admin.

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 5 23
10314
2
thg 12 23
14851
0
thg 10 23
33
3
thg 10 23
788
1
thg 10 23
569