changeset a35cc0231ba4 in modules/production_work:6.0
details: 
https://hg.tryton.org/modules/production_work?cmd=changeset&node=a35cc0231ba4
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 fccb4e09f667 -r a35cc0231ba4 production.py
--- a/production.py     Mon May 03 16:09:43 2021 +0200
+++ b/production.py     Thu Nov 24 19:12:19 2022 +0100
@@ -101,6 +101,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 fccb4e09f667 -r a35cc0231ba4 work.py
--- a/work.py   Mon May 03 16:09:43 2021 +0200
+++ b/work.py   Thu Nov 24 19:12:19 2022 +0100
@@ -214,7 +214,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