I have a model with a One2Many or Many2Many-Field and I would like to open a form to search/select related records on button click. In my model I created an action which opens the search form but how do I store the results in my Many2many-Field?
# field to store the record selection in
document_ids = fields.Many2many('document', ......
def action_select_document_ids(self):
return {
'name': _('Select documents'),
'view_type': 'tree',
'view_mode': 'tree',
'res_model': 'document',
'view_id': False,
'context': { },
'type': 'ir.actions.act_window',
'target': 'new'
}
Thanks