From ab75b9fc0c2dd1a8a8637991eb8d4bc5420db85b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Tue, 13 May 2008 16:47:26 +0200 Subject: [PATCH 1/6] Fix typo --- move.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/move.py b/move.py index daffe89c33..fb365bb10c 100644 --- a/move.py +++ b/move.py @@ -235,7 +235,7 @@ class Move(OSV): def set_state_assigned(self, cursor, user, ids, context=None): return self.write(cursor, user, ids, { - 'state': 'waiting', + 'state': 'assigned', }, context=context) def write(self, cursor, user, ids, vals, context=None): From 80afec9110d065faa89d78859d4f258b79daefbd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Tue, 13 May 2008 16:49:13 +0200 Subject: [PATCH 2/6] Don't change context in function --- packing.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packing.py b/packing.py index e077718207..d992070205 100644 --- a/packing.py +++ b/packing.py @@ -476,6 +476,10 @@ class PackingOut(OSV): move_obj = self.pool.get('stock.move') product_obj = self.pool.get('product.product') uom_obj = self.pool.get('product.uom') + + if context is None: + context = {} + packing = self.browse(cursor, user, id, context=context) parent_to_locations = {} inventory_moves = [] @@ -497,7 +501,7 @@ class PackingOut(OSV): parent_to_locations[move.from_location.id] = childs # Collect all raw quantities - context = context or {} + context = context.copy() context.update({'in_states': ['done', 'assigned'], 'out_states': ['done', 'assigned']}) raw_data = product_obj.raw_products_by_location( From 0badd92265eec2a54ebdc88e312d4277f807e040 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Tue, 13 May 2008 17:42:23 +0200 Subject: [PATCH 3/6] Fix workflow (remove signal_) Remove unused rpc_allowed function Add lock on move table when assigning --- packing.py | 18 +++++++++--------- packing.xml | 37 ++++++++++++++++++++----------------- 2 files changed, 29 insertions(+), 26 deletions(-) diff --git a/packing.py b/packing.py index d992070205..0cbc17af5f 100644 --- a/packing.py +++ b/packing.py @@ -265,15 +265,8 @@ class PackingOut(OSV): def __init__(self): super(PackingOut, self).__init__() self._rpc_allowed += [ - 'set_state_done', - 'set_state_waiting', - 'set_state_draft', - 'set_state_cancel', - 'set_state_assigned', - 'set_state_ready', - 'assign_try', - 'assign_force', - ] + 'button_draft', + ] self._order[0] = ('id', 'DESC') def default_state(self, cursor, user, context=None): @@ -480,6 +473,8 @@ class PackingOut(OSV): if context is None: context = {} + cursor.execute('LOCK TABLE stock_move') + packing = self.browse(cursor, user, id, context=context) parent_to_locations = {} inventory_moves = [] @@ -566,6 +561,11 @@ class PackingOut(OSV): {'state':'assigned'}) return True + def button_draft(self, cursor, user, ids, context=None): + workflow_service = LocalService('workflow') + for packing in self.browse(cursor, user, ids, context=context): + workflow_service.trg_create(user, self._name, packing.id, cursor) + PackingOut() diff --git a/packing.xml b/packing.xml index fb7a16ed52..69be873e3e 100644 --- a/packing.xml +++ b/packing.xml @@ -175,7 +175,7 @@ form +