Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
2 ตอบกลับ
2676 มุมมอง

Greetings,

I have tried to create a new model field with Odoo's UI. I Click on Settings->Developer Mode-> Technical-> Database Structure->Models and I try to create a new model for res.users. I Edit, Add a Line and try to add a new field e.g. x_somefield. I leave the defaults and try to save it but it fails.

l have tried multiple combinations but I keep receiving this error: Unable to order by name: fields used for ordering must be present on the model and stored.

Any idea what's wrong?

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

The res.users is created as a delegation inheritance from res.partner so the name field is a related field to name field in res.partner and it not stored in the DB and they used it in the model order and in the below line of code they check if the field used in model order is not stored then raise the error you got.

odoo/ir_model.py at 15.0 · odoo/odoo (github.com)

Same things if you tried to add a new field in product.product from UI you will get the same error.

I was able to reproduce it in Odoo 15 Runbot for res.users and res.users. I have reported this in Odoo GitHub and will wait for the results.

Workaround:

You can create the field in res.partner and it will be shown in res.users because res.users is inherit (delegation inheritance) from res.partner.

อวตาร
ละทิ้ง
ผู้เขียน

Thank you for this quick fix. This was what I was looking for. I thought I was the only one facing this issue.

คำตอบที่ดีที่สุด

so how can i create a new user with external api ?

in execute_kw i write res.user or res.partner


อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
0
ธ.ค. 24
1500
Import Data From Another Model แก้ไขแล้ว
1
มี.ค. 24
2560
0
พ.ย. 23
1906
2
ก.ย. 23
2694
1
มิ.ย. 23
12603