diff --git a/move.py b/move.py
index 9fe670157f..4a7b02a78c 100644
--- a/move.py
+++ b/move.py
@@ -146,7 +146,7 @@ class Move(OSV):
def unlink(self, cursor, user, ids, context=None):
move_ids = self.search(
cursor, user, [('id', 'in', ids), ('state', 'in',
- ['done', 'waiting', 'cancel'])], context)
+ ['done', 'waiting'])], context)
if move_ids:
raise ExceptORM('UserError', 'You can only delete draft moves !')
return super(Move, self).unlink(cursor, user, ids, context=context)
diff --git a/packing.py b/packing.py
index f2ca9b4b4c..97e009e72c 100644
--- a/packing.py
+++ b/packing.py
@@ -2,6 +2,7 @@
from trytond.osv import fields, OSV
from trytond.wizard import Wizard, WizardOSV
import time
+from trytond.netsvc import LocalService
STATES = {
'readonly': "state in ('cancel', 'done')",
@@ -29,7 +30,7 @@ class PackingIn(OSV):
relation='stock.move', string='Inventory Moves',
fnct_inv='set_inventory_moves',
states={
- 'readonly': "state in ('draft', 'waiting')",
+ 'readonly': "state == 'draft'",
}, context="{'warehouse': warehouse, "\
"'packing_state': state, 'type':'inventory_in'}")
moves = fields.One2Many('stock.move', 'packing_in', 'Moves',
@@ -39,19 +40,14 @@ class PackingIn(OSV):
('draft', 'Draft'),
('done', 'Done'),
('cancel', 'Cancel'),
- ('waiting', 'Waiting'),
('received', 'Received'),
], 'State', readonly=True)
def __init__(self):
super(PackingIn, self).__init__()
self._rpc_allowed += [
- 'set_state_done',
- 'set_state_waiting',
- 'set_state_draft',
- 'set_state_cancel',
- 'set_state_received',
- ]
+ 'button_draft',
+ ]
self._order[0] = ('id', 'DESC')
def default_state(self, cursor, user, context=None):
@@ -163,14 +159,6 @@ class PackingIn(OSV):
self.write(cursor, user, packing_id, {'state':'cancel'},
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_waiting(
- cursor, user, [m.id for m in packing.incoming_moves], context)
- self.write(cursor, user, packing_id, {'state':'waiting'},
- context=context)
-
def set_state_received(self, cursor, user, packing_id, context=None):
move_obj = self.pool.get('stock.move')
packing = self.browse(cursor, user, packing_id, context=context)
@@ -184,7 +172,9 @@ class PackingIn(OSV):
packing = self.browse(cursor, user, packing_id, context=context)
move_obj.set_state_draft(
cursor, user, [m.id for m in packing.incoming_moves], context)
- move_obj.set_state_cancel(
+ move_obj.set_state_waiting(
+ cursor, user, [m.id for m in packing.incoming_moves], context)
+ move_obj.unlink(
cursor, user, [m.id for m in packing.inventory_moves], context)
self.write(
cursor, user, packing_id, {'state':'draft'}, context=context)
@@ -219,6 +209,12 @@ class PackingIn(OSV):
'inventory_moves': [('create', vals)]
}, context=context)
+ 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)
+ return True
+
PackingIn()
diff --git a/packing.xml b/packing.xml
index 44d63e0931..8bc11ee4cc 100644
--- a/packing.xml
+++ b/packing.xml
@@ -49,18 +49,15 @@
-
-
-
-
+
+
+
+
@@ -344,12 +341,6 @@
function
set_state_done()
-
- Waiting
- function
-
- set_state_waiting()
-
Received
function
@@ -358,37 +349,26 @@
-
+ id="packingin_trans_draft_received">
+
- signal_received
+ received
- signal_done
-
-
-
-
- signal_waiting
-
-
-
-
- signal_cancel
+ done
- signal_cancel
+ cancel
- signal_cancel
+ cancel