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

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

        issue11859
        review415881003
        (grafted from 2f418044fe4ea5808b4cd3d9bf14d492292ada50)
diffstat:

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

diffs (23 lines):

diff -r 2ab5d41d1c6c -r 93543e0c4971 production.py
--- a/production.py     Sat Nov 05 17:46:02 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 2ab5d41d1c6c -r 93543e0c4971 work.py
--- a/work.py   Sat Nov 05 17:46:02 2022 +0100
+++ b/work.py   Thu Nov 24 19:12:19 2022 +0100
@@ -207,7 +207,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