Allow to update move from assign to draft. Avoid cancellation accordingly.

This commit is contained in:
Bertrand Chenal committed 2008-11-13 17:19:28 +01:00
1 parent 343ad56388
commit 7983747aad
3 files changed
+3 -29

No files matched your search

+1 -1
View File
@@ -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':
+2 -25
View File
@@ -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)
-3
View File
@@ -51,9 +51,6 @@ this repository contains the full copyright notices and license terms. -->
<button string="Cancel" name="cancel"
states="{'invisible': '''state in ('cancel', 'done') ''', 'readonly': '''%(group_stock)d not in groups'''}"
icon="tryton-cancel"/>
<button string="Draft" name="draft"
states="{'invisible': '''state != 'received' ''', 'readonly': '''%(group_stock)d not in groups'''}"
icon="tryton-clear"/>
<button string="Received" name="received"
states="{'invisible': '''state != 'draft' ''', 'readonly': '''%(group_stock)d not in groups'''}"
icon="tryton-go-next"/>