From f2bacb5cc1f6f85027fd512a0a3ec46990a446fc 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 (grafted from 2f418044fe4ea5808b4cd3d9bf14d492292ada50) --HG-- branch : 6.0 --- production.py | 1 + work.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/production.py b/production.py index 2bebfcdf9f..5aa68639db 100644 --- a/production.py +++ b/production.py @@ -101,6 +101,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 7af4642f1a..fa1fcc37b8 100644 --- a/work.py +++ b/work.py @@ -214,7 +214,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'