Odoo Help

1

Selecting items for one2many relation

By
José
on 1/6/15, 5:11 PM 3,419 views

Hello, I am developing a module in Odoo8.

I have a relation between two models. Model A has a one2many relation pointing to model B, and model B has Many2one relation pointing to model A.

In a view of model A I want to select one or more items of model B. But if I put a field like <field name="name_of_one2many_relation" /> I can create one or more records of model B and relate them with record of model A. I want to select previously created records of model B, not create new ones. How can I do this?

Thanks!
 

1

Sudhir Arya (ERP Harbor Consulting Services)

--Sudhir Arya (ERP Harbor Consulting Services)--
11594
| 6 8 8
Ahmedabad, India
--Sudhir Arya (ERP Harbor Consulting Services)--

• Co-Founder & Co-Owner at ERP Harbor Consulting Services

• ERP Consultant / ERP Customization / TechnoFunctional Expert

• Sound knowledge in Python, Odoo (Open ERP), XML, PostgreSQL

• Domain knowledge of Sale Management, Purchase Management, Warehouse Management, Manufacturing, Multi Company Configuration & Management, HR Management, Medical Management, Construction Management, Education Management, Point of Sale, Third Party Integrations

• Positive attitude and quick Learner

• Good analytical skill, quick bug and issue tracing and find the solution

• Good knowledge and experience in payment gateway integration with Odoo

• Ready to accept new challenges

• Active Memeber On Stackoverflow 

LinkedIn

Blog

Stackoverflow

Sudhir Arya
ERP Harbor Consulting Services
skype: 
sudhir@erpharbor.com 
Sudhir Arya (ERP Harbor Consulting Services)
On 1/6/15, 5:42 PM

Hello José,

I would suggest to use many2many field which will allow you to select existing records unlike one2many where you have to create the recrods.

0

Ivan

--Ivan--

3360
| 5 3 6
Jakarta, Indonesia
--Ivan--
Ivan
On 1/7/15, 4:20 AM

You can also still use one2many field with many2many_list widget. Just set widget='many2many_list' in the name_of_one2many_relation fields tag in the view and you get the many2many list behaviour (selecting from existing record, etc.) from a one2many field. It also applicable vv (many2many using one2many_list widget).

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

1 follower(s)

Stats

Asked: 1/6/15, 5:11 PM
Seen: 3419 times
Last updated: 3/16/15, 8:10 AM