From 7983747aad66dc040c1c2ce3702ce45f5d2d09db Mon Sep 17 00:00:00 2001 From: Bertrand Chenal Date: Thu, 13 Nov 2008 17:19:28 +0100 Subject: [PATCH] Allow to update move from assign to draft. Avoid cancellation accordingly. --- move.py | 2 +- packing.py | 27 ++------------------------- packing.xml | 3 --- 3 files changed, 3 insertions(+), 29 deletions(-) diff --git a/move.py b/move.py index 57b239bbf5..e9d67294e8 100644 --- a/move.py +++ b/move.py @@ -373,7 +373,7 @@ class Move(OSV): move.company, context=context) elif vals['state'] == 'draft': - if move.state in ('assigned', 'done'): + if move.state == 'done': self.raise_user_error(cursor, 'set_state_draft', context=context) elif vals['state'] == 'assigned': diff --git a/packing.py b/packing.py index d430d49261..2687e0dd08 100644 --- a/packing.py +++ b/packing.py @@ -221,10 +221,6 @@ class PackingIn(OSV): def set_state_draft(self, cursor, user, packing_id, context=None): move_obj = self.pool.get('stock.move') packing = self.browse(cursor, user, packing_id, context=context) - move_obj.write(cursor, user, [m.id for m in packing.incoming_moves - if m.state != 'draft'], { - 'state': 'cancel', - }, context=context) move_obj.write(cursor, user, [m.id for m in packing.incoming_moves if m.state != 'draft'], { 'state': 'draft', @@ -468,11 +464,7 @@ class PackingOut(OSV): move_obj = self.pool.get('stock.move') packing = self.browse(cursor, user, packing_id, context=context) self.write( - cursor, user, packing_id, {'state':'draft'}, context=context) - move_obj.write( - cursor, user, - [m.id for m in packing.inventory_moves + packing.outgoing_moves], - {'state': 'cancel'}, context=context) + cursor, user, packing_id, {'state': 'draft'}, context=context) move_obj.write( cursor, user, [m.id for m in packing.inventory_moves + packing.outgoing_moves], @@ -580,15 +572,6 @@ class PackingOut(OSV): move_obj = self.pool.get('stock.move') uom_obj = self.pool.get('product.uom') packing = self.browse(cursor, user, packing_id, context=context) - if packing.state == 'assigned': - move_obj.write( - cursor, user, - [m.id for m in packing.inventory_moves + packing.outgoing_moves], - {'state': 'cancel'}, context=context) - move_obj.write( - cursor, user, - [m.id for m in packing.inventory_moves + packing.outgoing_moves], - {'state': 'draft'}, context=context) self.write( cursor, user, packing_id, {'state': 'waiting'}, context=context) @@ -743,10 +726,7 @@ class PackingInternal(OSV): move_obj = self.pool.get('stock.move') packing = self.browse(cursor, user, packing_id, context=context) self.write( - cursor, user, packing_id, {'state':'draft'}, context=context) - move_obj.write( - cursor, user, [m.id for m in packing.moves], {'state': 'cancel'}, - context=context) + cursor, user, packing_id, {'state': 'draft'}, context=context) move_obj.write( cursor, user, [m.id for m in packing.moves], {'state': 'draft'}, context=context) @@ -754,9 +734,6 @@ class PackingInternal(OSV): def set_state_waiting(self, cursor, user, packing_id, context=None): move_obj = self.pool.get('stock.move') packing = self.browse(cursor, user, packing_id, context=context) - move_obj.write( - cursor, user, [m.id for m in packing.moves], {'state': 'cancel'}, - context=context) move_obj.write( cursor, user, [m.id for m in packing.moves], {'state': 'draft'}, context=context) diff --git a/packing.xml b/packing.xml index 896143086b..90efa1bc00 100644 --- a/packing.xml +++ b/packing.xml @@ -51,9 +51,6 @@ this repository contains the full copyright notices and license terms. -->