How to set the domain of a One2Many field of the start view of a wizard based on the selected record value?

Hi,

How can I get in the start model view, a value from “Transaction().context[‘active_ids’]” ?
I need to change the domain of a One2Many field in the start model view based on a value of the selected record.

Thanks in advance.
Laurent

By defining a method default_<state name> and return the default value for the fields defined on the StateView.
See the example default_result on Wizard — trytond latest documentation

Thanks for this response on saturday night :wink:
Yes I’ve managed to set a defaut value to my One2Many field but I want to set his domain from the wizard to restrict the choice of the user based on selected record. Should I set a domain with an Eval(function) then use on_change_ method and this function?

It is not recommended to alter the view definition at runtime (even if technically it is doable).
So your domain should be a PYSON expression to be evaluated with the state record.

Ok I use in the wizard default_start_view to pass the values to a One2Many field in the start view and then I use Eval(thisfield) in the domain of the Many2One field to set dynamically his domain.

Thanks a lot

This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.