Odoo Help

0

Fields one2many aren't created in a model

By
Keywoker
on 11/16/14, 6:46 AM 831 views

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.

Emipro Technologies Pvt. Ltd.
on 11/16/14, 7:30 AM

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.

Keywoker
on 11/16/14, 11:49 AM

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

Emipro Technologies Pvt. Ltd.
on 11/16/14, 12:21 PM
1
john5000
On 11/16/14, 10:32 PM

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?

Keywoker
on 11/17/14, 1:28 AM

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

john5000
on 11/17/14, 3:22 AM

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

2 follower(s)

Stats

Asked: 11/16/14, 6:46 AM
Seen: 831 times
Last updated: 3/16/15, 8:10 AM