From 62b6c25b1befff159b9a7077dc15645877af96bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Thu, 24 Nov 2022 19:12:19 +0100 Subject: [PATCH] Update work state on production waiting Also a work with cycle should not be set back to request. issue11859 review415881003 --- production.py | 1 + work.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/production.py b/production.py index d849dd950f..f6e7540935 100644 --- a/production.py +++ b/production.py @@ -98,6 +98,7 @@ class Production(metaclass=PoolMeta): for production in draft_productions: works.extend(production.get_works(work_center_picker)) Work.save(works) + Work.set_state([w for p in productions for w in p.works]) def get_works(self, work_center_picker): if not self.routing: diff --git a/work.py b/work.py index a265801521..c823790935 100644 --- a/work.py +++ b/work.py @@ -210,7 +210,7 @@ class Work(sequence_ordered(), ModelSQL, ModelView): @property def _state(self): - if self.production.state == 'waiting': + if self.production.state == 'waiting' and not self.cycles: return 'request' elif self.production.state == 'done': return 'done'