Skip to Content
Menu
This question has been flagged

i have a many2one field. It is in a line(part of tree for one2many.)

<tree string="PLD" editable="bottom">                               

<field name="priority_set" />                         

<field name="shop_id"  domain="[('is_shop', '=', True),('usage','=','internal')]"    options="{'no_open':True,'no_create':1,'no_create_edit':1}" />          //shop_id = fields.many2one('stock.location')                     

<field name="temp_id"      options="{'no_open':True,'no_create':1,'no_create_edit':1}" />                           

</tree>

i want to select a shop for 1st line. In the 2nd line, the selected shop value should not be shown in the many2one dropdown. How can it be done?

Avatar
Discard
Best Answer

Hai Tanvir Faisal,

You can done it by different ways.

One solution is here.

Just add a Many2many field in the model that One2many field exist. write a function in the onchange of your Many2one field.inside the function write the selected Many2one value to the Many2many field. pass the Many2many value through context to the One2many field from the model of One2many. you can put it that context value in your domain.


Thank you.

Avatar
Discard
Author

Can you explain a bit more? I am new in odoo...may be thats why i am not visualizing it !

In my case, in line, when user 1st selects any shop from dropdown, in the next line, the previously selected shop should not be shown in the dropdown. Thanks!

Related Posts Replies Views Activity
2
Apr 24
839
2
Jul 18
7212
1
Jan 22
1971
0
Aug 17
2597
0
Dec 15
3945