Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
2 Odpovědi
4373 Zobrazení

I created onchange method for my field location_id in one2many list that changes the domain of prodlot_id. Everything works fine, except for the fact that it changes the domain for all the prodlot_id fields in my one2many list.

Is there a way to change domain only for the prodlot_id of the record I changed?

Avatar
Zrušit
Nejlepší odpověď

Or you could use another field(invisible and dummy many2many field) to filter the prodlot_id based on this new field, the value of that field you need to compute using the onchange itself, instead of returning a domain for the one2many field you need to return the value for the whole field dummy, but you don't return a new domain, your field domain is using the dummy field as a filter

Avatar
Zrušit
Nejlepší odpověď


add one more condition to your domain, using AND operator, something like:  


[ '|','&', ( ...your condition... ), ('prodlot_id','in',[ id_of_record_to_apply_domain_to ]),('prodlot_id','not in',[ id_of_record_to_apply_domain_to ])]
-it's how you can apply domain to the one particular record. but still, the domain will be same in all records.

If you want to have different domain per record, I'm afraid that it should not be possible by setting domain using onchange. most probably computed one2many field is the appropriate solution to your requirement in this case, rather then change domain of field. if you want to have different one2many list per record, then make this one2many field computed field and apply your application logic inside compute function in order to have correct list per record.



Avatar
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
5
kvě 24
25164
3
bře 24
17002
2
led 24
16163
3
kvě 15
11713
0
led 18
2195