Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
1 Rispondi
3462 Visualizzazioni

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

Avatar
Abbandona

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

Autore

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.

Risposta migliore

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.

 

Avatar
Abbandona
Autore

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.