跳至内容
菜单
此问题已终结

Is there a way to have a default filter that is passed by a method? I know that I can add a filter with @on.change, but the problem is that I won't have any field to change. The filter has to be as a default value. The lambda won't cut it. having a computed field that I use it then in the domain filter won't work as well.

I need a filter that returns ids of used records, and then show only the projects that are not used.

So the domain should be generated as example [('project_id', 'not in', [1,2,4,8,10]), ('analytic_account_id.parent_project_id', '=', self.partner_id)]. 

My model:

free_hours = fields.Float(string='Free hours', compute='_get_free_hours')
start_date = fields.Date(string='Start date')

partner_id = fields.Many2one('res.partner', string='Contact', required=True, ondelete='cascade')
project_ids = fields.Many2many( comodel_name='project.project', relation='project_pvz_hours_rel', column1='pvz_hours_id', column2='project_id', string='Project' )
形象
丢弃
相关帖文 回复 查看 活动
0
7月 22
1464
1
11月 19
6020
0
8月 20
2122
1
7月 19
4921
2
5月 17
11047