changeset 2f418044fe4e in modules/production_work:default
details: 
https://hg.tryton.org/modules/production_work?cmd=changeset&node=2f418044fe4e
description:
        Update work state on production waiting

        Also a work with cycle should not be set back to request.

        issue11859
        review415881003
diffstat:

 production.py |  1 +
 work.py       |  2 +-
 2 files changed, 2 insertions(+), 1 deletions(-)

diffs (23 lines):

diff -r 59a0ad136522 -r 2f418044fe4e production.py
--- a/production.py     Mon Oct 31 17:29:53 2022 +0100
+++ b/production.py     Thu Nov 24 19:12:19 2022 +0100
@@ -98,6 +98,7 @@
         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 -r 59a0ad136522 -r 2f418044fe4e work.py
--- a/work.py   Mon Oct 31 17:29:53 2022 +0100
+++ b/work.py   Thu Nov 24 19:12:19 2022 +0100
@@ -210,7 +210,7 @@
 
     @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'

Reply via email to