Odoo Help

2

1
3 Answers
1
Allison
20/03/13 14:47

The closest I came to achieving this was adding a many2one field on crm.lead and a functional field on project.project that returns the corresponding crm.lead (if there is one).

1 Comment
mike
22/03/13 13:03

I'm having a similar problem and cannot find the answer. my model has a many2one field to a related "category" model. On the form this field shows up as "model.category id" since it doesn't have a name field. So I write my own name_get function and now have my derived name on the form and it links to the category instance like before. However, now when I edit the form and change the category record instead of the id being sent back for the onchange event I get the derived name now. Source on the form page shows no value attribute on the <option> tags. And my name_get returns (record.id, name).

0
Kobus Wolvaardt
24/06/15 05:18

Hi,

I am unsure if it helps, but you can inherit from another model in a way that it the second model is one to one in embedded with the first. Your DB has two tables, but the view treats them as one. I am unsure if there is actually a link back from the inheretid model, but I think this is what is done with res_user vs res_partner... the user iniherits and actually creates a res_partner.

See in:

https://www.odoo.com/forum/how-to/developers-13/the-different-openerp-model-inheritance-mechanisms-whats-the-difference-between-them-and-when-should-they-be-used-46

The heading Polymorphic data using _inherits

Not exactly one2one, but might still be what you need.


Ask a Question
Writer
Keep Informed
0 follower(s)
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 eLearning platform and experience all Odoo Apps through learning videos, use cases and quizzes.

Test it now