I'm trying to get projects where the selected contact is the follower. I need it so I can select for which projects I should generate the report. For this I'm using a wizard with a Many2One field for selecting the contact and a Many2many field I want to use for checkboxes in the view.
Is it possible to set a dynamic domain that will filter the Many2many field?
contact_id = fields.Many2one('res.partner', domain="[('customers_tic_id', '!=', False)]") project_ids = fields.Many2many(comodel_name='project.project', relation='project_document_wizard_rel', column1='document_wizard_id', column2='project_id', string='Contacts following projects', domain="[('project_id', 'in', self.followers_search_to_list())]") def followers_search_to_list(self): tmp_list = list() followers = self.env['mail.followers'].sudo().search([('partner_id', '=', contact_id.id), ('res_model', '=', 'project.project')]) for follower in followers: tmp_list.append(follower.res_id) return tmp_list
So what I'm doing wrong?