From e8ec89bd3eab6cf123fa63ddc5c2cd6767323b9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Wed, 25 Oct 2017 18:49:45 +0200 Subject: [PATCH] Use production state to set the initial state of work in tests Since rev 838de4930154, the state of the work is computed at the creation so the create a work in state done, the production must be already in done state. issue6878 review36731002 --- tests/test_production_work_timesheet.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tests/test_production_work_timesheet.py b/tests/test_production_work_timesheet.py index e5c1ff902d..04767b82bb 100644 --- a/tests/test_production_work_timesheet.py +++ b/tests/test_production_work_timesheet.py @@ -13,7 +13,7 @@ class ProductionWorkTimesheetTestCase(ModuleTestCase): 'Test Production Work Timesheet module' module = 'production_work_timesheet' - def create_work(self): + def create_work(self, production_state='draft'): pool = Pool() Work = pool.get('production.work') Operation = pool.get('production.routing.operation') @@ -27,7 +27,7 @@ class ProductionWorkTimesheetTestCase(ModuleTestCase): operation.timesheet_available = True operation.save() - production = Production() + production = Production(state=production_state) production.save() work = Work( @@ -68,8 +68,7 @@ class ProductionWorkTimesheetTestCase(ModuleTestCase): TimesheetWork.search([('id', '=', timesheet_work_id)])) # Test create as done - work = self.create_work() - work.state = 'done' + work = self.create_work(production_state='done') work.save() timesheet_work, = work.timesheet_works self.assertEqual(timesheet_work.timesheet_end_date, Date.today())