Odoo Help

Welcome!

This community 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.

0

Fields one2many aren't created in a model

By
Keywoker
on 11/16/14, 6:46 AM 719 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

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

2 follower(s)

Stats

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