Odoo Help

2

Widget many2many - how disable 'Add an item'?

By
Zbik
on 6/12/15, 10:35 AM 4,075 views

I need a widget many2many (or one2many) with disabled 'Add an item' but NOT READONLY!

Not readonly because I need manipulate sequences by drag and drop. How to do it?

Thanks in advance with the help



11
Andre de Kock
On 6/14/15, 8:28 AM

Try to disable it in the tree view. Like this:

<tree create="false">
    <!-- Fields -->
</tree>

The create="false" attribute will hide the "Add an item" action on the one2many / many2many view.

5

Zbik

--Zbik--
6263
| 6 4 7
Lodz, Poland
--Zbik--


Zbik
On 6/14/15, 11:45 AM

Thank Andre for your very helpful suggestion. Below full solution:

I replace:

 <field name="route_new_ids" widget="many2many" domain="[('product_id','=',id)]"/>

by:

 <field name="route_new_ids" domain="[('product_id','=',id)]" context="{'from_product': True}">
<tree create="false" delete="false">
  <field name="sequence" widget="handle"/>
  <field name="route_id"/>
</tree>
</field>


context="{'from_product': True}" allows to disable, after click on list position, in form view, editions other fields than sequence


Great! Glad I could help

Limitless Virtual Enterprise, Andre de Kock
on 6/15/15, 4:41 AM
3
Narendran
On 5/24/16, 1:31 AM

options="{'no_create_edit': True}"

specify this in your many2many field,

<field name="your_field" widget="many2many_tags" options="{'no_create_edit': True}"/>

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: 6/12/15, 10:35 AM
Seen: 4075 times
Last updated: 3/15/17, 4:05 PM