how can I select many items with field many2one?

Asked by Cuong


With field many2one, how can I select many items? For ex, my table has product_id, many2one to product.product.
In my form, I want to add many products at once. Currently I can only select each item when I want to add products to my form view.


Question information

English Edit question
Odoo Web Client Edit question
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Lorenzo Battistini (elbati) said :

You have to use a many2many

Revision history for this message
Cuong (bhcuong2008) said :

Hi Lorenzo,

I want each line in relation table to have some fields. For example, I'm doing sale quote. Quote has some fields and a quote line (one2many). Each quote line will have product_id, price. Using many2many is not appropriate.

It means that the relation table will have this schema,
quote_id: many2one quote
product_id: many2one product
price1: float
price2: float
If using many2many, I cant specify price info for each product.


Revision history for this message
Cuong (bhcuong2008) said :


I add widget="many2many" in field o2m and it's changed. But when I click on button 'Add' then error occurs.

Can I customize behavior of this button or widget?


Revision history for this message
OpenBMS JSC (openbmsjsc) said :

@Cuong: I think with the source code available, you can do whatever changes you think fit, and welcome to contribute your work back to the community. I guess you need to look at the source code for server, around the widget module(s).

Can you help with this problem?

Provide an answer of your own, or ask Cuong for more information if necessary.

To post a message you must log in.