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
This commit is contained in:
Cédric Krier committed 2019-04-23 09:57:12 +02:00
1 parent a7a14783de
commit c49f209d6d
1 file changed
+2 -1
+2 -1
View File
@@ -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')