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
This commit is contained in:
Cédric Krier
2017-10-25 18:49:45 +02:00
parent 42267160f6
commit e8ec89bd3e
+3 -4
View File
@@ -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())