跳至内容
菜单
此问题已终结
1 回复
3446 查看

I describe the field in _columns like this

 'extension_order_line_ids': fields.one2many(
            'sale.order.line', 'extension_rental_id',
            'something', readonly=True),

but this field isn't created in my model, though, for many2one - it's ok. Why does it happen? Thanks

形象
丢弃

@vladislav did you added 'extension_rental_id' in the 'sale.order.line'? If possible share your code here.

编写者

Of course I did. Just I don't see the field what I want to have in my model. But the fields many2one work great.

@vladislav actually where you are not finding the field? Are you not getting it under the models screen.

最佳答案

I think what you mean is that that the one2many field defined in the .py file does not show up in the database table that is created (or extended).

That is correct and is expected. The one2many just uses the "id" field for the one-to-many relation, no additional field is required or needed in the database table for the one2many field of the model to work.

 

形象
丢弃
编写者

Thank you for the answer. Is it actual for many2one and other relations fields?

@Vladislav, many2one will end up creating a field in the database table. But one2manyu does not.