Update production work state on write
Writing on the One2Many cycles may modify the state of the work. issue11823 review426021003
This commit is contained in:
1 parent
11dc82d068
commit
cc8e5c2bc6
1 file changed
+9
-1
@@ -227,7 +227,9 @@ class Work(sequence_ordered(), ModelSQL, ModelView):
|
||||
@classmethod
|
||||
def set_state(cls, works):
|
||||
for work in works:
|
||||
work.state = work._state
|
||||
state = work._state
|
||||
if work.state != state:
|
||||
work.state = state
|
||||
cls.save(works)
|
||||
|
||||
def get_rec_name(self, name):
|
||||
@@ -250,6 +252,12 @@ class Work(sequence_ordered(), ModelSQL, ModelView):
|
||||
cls.set_state(works)
|
||||
return works
|
||||
|
||||
@classmethod
|
||||
def write(cls, *args):
|
||||
super().write(*args)
|
||||
works = sum(args[0:None:2], [])
|
||||
cls.set_state(works)
|
||||
|
||||
@classmethod
|
||||
def delete(cls, works):
|
||||
for work in works:
|
||||
|
||||
Reference in new issue
Block a user