From c49f209d6d147331f441b5219f247074cc333aa0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Tue, 23 Apr 2019 09:57:12 +0200 Subject: [PATCH] Use domain to force work value on timesheet lines The target of the One2Many is wrong because it must be a timesheet work instead of production work. issue8175 review281401014 --- work.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/work.py b/work.py index c60385380a..40d7a6886b 100644 --- a/work.py +++ b/work.py @@ -18,12 +18,13 @@ class Work(metaclass=PoolMeta): fields.Boolean('Available on timesheets'), 'on_change_with_timesheet_available') timesheet_lines = fields.Function( - fields.One2Many('timesheet.line', 'work', 'Timesheet Lines', + fields.One2Many('timesheet.line', None, 'Timesheet Lines', states={ 'invisible': ~Eval('timesheet_works'), }, domain=[ ('company', '=', Eval('company', -1)), + ('work', 'in', Eval('timesheet_works', [])), ], depends=['timesheet_works', 'company']), 'get_timesheet_lines', setter='set_timesheet_lines')