Form Popup; set a default value according a parent field


#1

Hi,

I’m face of a functionnal requirement that i’m unable to solve so maybe one of you has already face of it and found the solution.

I have 2 domains:

  • customer: which has two M2O field pointed to the same domain Contact. One field is for technical, the other one if for administrative
  • contact; which has a field (integer selection) that specify a category (technical = 1, administrative = 2)

When I select “Create” with the field customer.technicalContact I would like to preset the category field of the contact with the corresponding value.

By default, it’s possible to obtain the parent model (parent._model) but not the field from where the create call is issued. I can’t specifiy a domain (which is only for select) and also I can’t specify a context

My question is: is there a way to specify a value in my customer.technicalContact field that I can read/extract from my Contact form to preset it’s category field ?

Of course it’s possible if I dupplicate the form, set a default value on each and define a custom form-view for each customer.contact field but it’s not really good for code maintenance.

Thank u in advance