Odoo Help


How to add multiple products on single click in an order lines of Po/So order forms in openerp?

on 11/11/14, 5:15 AM 4,157 views

Here in this screen shot products are adding one by one in orderlines by Add an item.

But, i want to import mutiple products at a time.

Hi Divya, as per my understanding i hope you are looking for Product Bundling kind of functionality.Kindly please let me know if my understanding is correct so that I can expedite the same.

on 2/10/16, 9:58 AM

Mohammed Amal

--Mohammed Amal--

| 5 3 7
Malappuram, India
--Mohammed Amal--

Email : mohammedamal.n@gmail.com

Mohammed Amal
On 3/30/17, 12:56 AM


You should change product_id in sale.order.line from many2one to many2many.

But if you change priduct_id many fields in order_line(in sale.order) are depending on it(like description,price etc). you should change them too.

Hope this helps


IT Libertas

--IT Libertas--
| 4 3 7
Saint Petersburg, Russian Federation
--IT Libertas--

Visit us: https://odootools.com/

IT Libertas is a team of developers and automation experts to help you to unlock Odoo ERP system's potential. We have been communicating with end users to whom the software became a main business tool since 2012. As a result, we are proud of dozens of successful Odoo apps developed.

We are open for new ideas and challenges to create the best Odoo tools for business needs all over the world

IT Libertas
On 3/30/17, 11:01 AM

Be cauitious: Making the product fields as m2m would break Odoo logic totally (procurement, invoicing etc.)

For sale orders we developed this app  - https://apps.odoo.com/apps/modules/10.0/product_selection_wizard_sale/- may help you. It let search products and then add them at once (but different lines). For purchases a similar app with same core is going for a release. It is a payable module, regretfullu

On 2/8/16, 2:09 AM

Hello Divya,

For the same requirement I changed order_line field to many2many.

#'order_line': fields.many2many('sale.order.line', 'order_id', 'Order Lines', readonly=True, states={'draft': [('readonly', False)], 'sent': [('readonly', False)]}, copy=True),

After that it lists all order lines.

As suggested by shahshank added following line in sale_order_line class

'm2m_prod': fields.many2many('product.product', 'm2m_table', 'order_lineid', 'product_id', 'M2M products'),

But still it lists all order lines.

do we have to modify sale_view.py also?

shashank verma
On 11/11/14, 5:45 AM

Hello Divya,

Default structure of orderline is one2many . Good choice would be to use many2many structure where u can add muliple product and then you can design your business logic according to many2many flow.

Add Product one by one (one2many) is the best way because each sale Line product have different quantity, unit Price.

on 11/11/14, 5:52 AM

But if we want to import 100 products at time, it is difficult way to form one by one. Is there any alternative way for it?

on 11/11/14, 6:19 AM

yes the default structure of orderline is one2many @shashank, But changing it to many to many field will effect to any other forms in application?

on 11/11/14, 6:22 AM

Openerp using Import options csv file data import. Refer http://www.slideshare.net/Audaxis/opendays-import-csv-2013v5

on 11/11/14, 6:40 AM

@divya: If you are replacing o2m field by m2m field then it will effect other application. Because some of the modules might be refering to order_line(o2m field in sale_order class)

shashank verma
on 11/11/14, 8:22 AM

Hi Guys,

I Don't think converting o2m order lines field to a m2m or making the field product which is of m2o to an m2m. Here in the first case i don't think requirement will be acheived and comming to second case one orderline will have n number of products which doesn't seem to be correct.

Instead what i would prefer is to

Create a wizard which will pop up with a button click on form view and it will show the list of all products where you can select all the required products(Multiple products at once) and clicking on submit button in wizard will create an individual orderline in current order for every product selected.

This procedure is little bit lengthy, but i hope this will help you to acheive your requirement without disturbing the actual process or default modules.


Kiran Kumar

On 11/11/14, 6:29 AM

when creating many to many field for order lines , It is showing the list of existing order lines but it must show existing products.

'm2m_prod': fields.many2many('product.product', 'm2m_table', 'order_lineid', 'product_id', 'M2M products'), Use this defination in sale_order_line class

shashank verma
on 11/11/14, 8:18 AM

Thanks @shashank

on 11/11/14, 11:57 PM

Hi Shashank, I don't know if you'd reply or not, but can you please help me on this?

I am on Odoo v9, and can't change sale.order line to many2many from GUI. And nothing happens when I use the codes above in Technical> Views.

Kindly help me with this. Let me know how I can do it in Odoo v9 ?


Hamza rana
on 6/17/16, 5:47 PM

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.


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)


Asked: 11/11/14, 5:15 AM
Seen: 4157 times
Last updated: 3/30/17, 11:01 AM