diff --git a/location.xml b/location.xml
index eaaa80df63..15fc831b46 100644
--- a/location.xml
+++ b/location.xml
@@ -61,7 +61,7 @@
-
@@ -79,7 +79,7 @@
-
diff --git a/move.py b/move.py
index 878d455e47..1b32b7d2cd 100644
--- a/move.py
+++ b/move.py
@@ -72,11 +72,6 @@ class Move(OSV):
def __init__(self):
super(Move, self).__init__()
- self._rpc_allowed += [
- 'set_state_done',
- 'set_state_draft',
- 'set_state_cancel',
- ]
self._sql_constraints += [
('check_move_qty_pos',
'CHECK(quantity >= 0.0)', 'Move quantity must be positive'),
diff --git a/move.xml b/move.xml
index 28d695abbc..1b6d462eba 100644
--- a/move.xml
+++ b/move.xml
@@ -29,24 +29,8 @@
-
-
-
-
-
-
-
-
-
+
+
diff --git a/packing.py b/packing.py
index 7f743a97fe..efae89bda2 100644
--- a/packing.py
+++ b/packing.py
@@ -208,6 +208,8 @@ 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.set_state_cancel(cursor, user,
+ [m.id for m in packing.incoming_moves], context=context)
move_obj.set_state_draft(cursor, user,
[m.id for m in packing.incoming_moves], context=context)
move_obj.delete(cursor, user,
@@ -431,6 +433,10 @@ class PackingOut(OSV):
packing = self.browse(cursor, user, packing_id, context=context)
self.write(
cursor, user, packing_id, {'state':'draft'}, context=context)
+ move_obj.set_state_cancel(
+ cursor, user,
+ [m.id for m in packing.inventory_moves + packing.outgoing_moves],
+ context=context)
move_obj.set_state_draft(
cursor, user,
[m.id for m in packing.inventory_moves + packing.outgoing_moves],
@@ -538,6 +544,15 @@ 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.set_state_cancel(
+ cursor, user,
+ [m.id for m in packing.inventory_moves + packing.outgoing_moves],
+ context=context)
+ move_obj.set_state_draft(
+ cursor, user,
+ [m.id for m in packing.inventory_moves + packing.outgoing_moves],
+ context=context)
self.write(
cursor, user, packing_id, {'state':'waiting'}, context=context)
@@ -681,12 +696,18 @@ class PackingInternal(OSV):
packing = self.browse(cursor, user, packing_id, context=context)
self.write(
cursor, user, packing_id, {'state':'draft'}, context=context)
+ move_obj.set_state_cancel(
+ cursor, user, [m.id for m in packing.moves], context=context)
move_obj.set_state_draft(
cursor, user, [m.id for m in packing.moves], context=context)
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.set_state_cancel(
+ cursor, user, [m.id for m in packing.moves], context=context)
+ move_obj.set_state_draft(
+ cursor, user, [m.id for m in packing.moves], context=context)
move_obj.write(
cursor, user, [m.id for m in packing.moves],
{'planned_date': packing.planned_date}, context=context)
diff --git a/packing.xml b/packing.xml
index 1d4c029a34..c49e7ab476 100644
--- a/packing.xml
+++ b/packing.xml
@@ -48,14 +48,16 @@
-
+ states="{'invisible': '''state in ('cancel', 'done') ''', 'readonly': '''%(group_stock)d not in groups'''}"/>
+
+ states="{'invisible': '''state != 'draft' ''', 'readonly': '''%(group_stock)d not in groups'''}"/>
+
+ states="{'invisible': '''state != 'cancel' ''', 'readonly': '''%(group_stock)d not in groups'''}"/>
@@ -185,21 +187,24 @@
-
+
-
-
-
+
+
+
+
@@ -336,19 +341,21 @@
-
+
-
-
-
+
+
+
]]>
@@ -510,6 +517,13 @@
received
+
+
+
+
+ draft
+
@@ -585,6 +599,13 @@
assign
assign_try()
+
+
+
+
+ waiting
+
@@ -600,6 +621,13 @@
waiting
+
+
+
+
+ draft
+
@@ -621,6 +649,13 @@
packed
+
+
+
+
+ assign
+
@@ -706,6 +741,13 @@
waiting
+
+
+
+
+ draft
+
@@ -714,6 +756,13 @@
assign
assign_try()
+
+
+
+
+ waiting
+
diff --git a/stock.xml b/stock.xml
index aea48e6081..12620dce44 100644
--- a/stock.xml
+++ b/stock.xml
@@ -16,6 +16,6 @@
icon="tryton-package"/>
+ sequence="0" icon="tryton-preferences"/>