I have seen variables called from context this way:
context="{'template': template_value,}"
They're coming from some value of the current form, aren't they? And, why can't I pass it through an act_window to the destination model. For example, in the context of an act_window, if I write this:
context="{'default_template_id': 2,}"
It works, but not if I try to get the context of the source model:
context="{'default_template_id': context.get('template_id', False),}"
Another option would be to call a function from there, but I think that's not possible:
context="{'default_template_id': my_function,}"
Can anyone help me? Thank you in advance.
EDIT
The only way I know to add an option to the menu More in tree views is through XML (how can I add an option to More in Python?), so my act_window is defined in XML:
<act_window name="Invite partners to an event"
res_model="mail.compose.message"
src_model="event.registration"
view_mode="form"
multi="True"
target="new"
context="{'default_template_id': context.get('template_id', False),}"
id="invite_partner_to_event"/>