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

Hi,

So I'm using Odoo v13.0 and I'm trying to create a new field in Odoo 13.0\server\odoo\addons\product\models\product.py for our internal identifier value. I'm using the following to define the field:

internal_id = fields.Char('Internal Product ID', required=True, index=True)

and further down the file I have the following to make sure this value is unique to the product:

_sql_constraints = [('internal_id_unique','unique(internal_id)',"Internal Product ID must be unique!")]

I'm restarting both odoo-server-13.0 and PostgreSQL_For_Odoo, and then I create a new database, but it seems like the new field is not created (I can't find it in View Fields screen in the inventory). Am I missing something here?

Thanks for the help.

อวตาร
ละทิ้ง
ผู้เขียน คำตอบที่ดีที่สุด

The issue was solved by adding the same lines to product_template.py instead of product.py. I'm unable to delete or close the thread, so I'll just leave it as is.

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
External ID is not set on products แก้ไขแล้ว
1
ธ.ค. 21
3819
1
มิ.ย. 21
2664
1
ก.ค. 20
2277
2
ก.ค. 20
6529
2
มิ.ย. 25
1602