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

I put a table 'tbl_external' into my Odoo database. This table haven't been created using a model. Is just a table.

Now I want to inherits its id.

If I used a model, I write:

_inherits = {'tbl_external': 'id_tbl_external'}

id_tbl_external = fields.Many2one('tbl_external', 'External Table')

How I can do in this case?

Thanks!

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

 You can not inherit external table which is not define into Odoo Model structure.

To manage any kind of relation between any two tables using Odoo you have to define those two tables inside Model structure of the Odoo. In short, in your example 'tbl_external' must be a valid ORM class in order to extend all of it's columns into your table. If it is just a database table then it is not possible anyhow to inherit all the columns. This is said to be "Inheritance by Delegation" in Odoo. 

It is better written/explained over here in this link ( Please see deligation section )

Hope this helps,


อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
1
มิ.ย. 16
3247
0
มิ.ย. 16
3548
0
เม.ย. 24
1787
4
พ.ย. 23
5835
0
ต.ค. 23
1617