From 8a51eb53f2f475816a1bc4f30a2a28a802ab31b3 Mon Sep 17 00:00:00 2001 From: Bertrand Chenal Date: Mon, 28 Apr 2008 22:24:35 +0200 Subject: [PATCH] Guidelines --- move.py | 10 +++++----- move.xml | 7 +++++-- packing.py | 10 +++++----- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/move.py b/move.py index b2356d2653..3be8cc8283 100644 --- a/move.py +++ b/move.py @@ -87,7 +87,7 @@ class Move(OSV): != move.from_location.id: return False if move.to_location.type and \ - move.to_location.type not in ('supplier','customer'): + move.to_location.type not in ('supplier', 'customer'): return False for packing_move in move.outgoing_packing_out.outgoing_moves: if packing_move.to_location.id != move.to_location.id: @@ -161,7 +161,7 @@ class Move(OSV): def set_state_draft(self, cursor, user, ids, context=None): self.set_by_state( cursor, user, ids, ['cancel', 'waiting'], - {'state':'draft',}) + {'state': 'draft',}) def set_state_cancel(self, cursor, user, ids, context=None): self.set_by_state( @@ -174,7 +174,7 @@ class Move(OSV): def unlink(self, cursor, user, ids, context=None): move_ids = self.search( - cursor, user, [('id', 'in',ids),('state', 'in', + cursor, user, [('id', 'in', ids), ('state', 'in', ['done', 'waiting', 'cancel'])], context) if move_ids: @@ -229,7 +229,7 @@ class CreatePacking(Wizard): cursor, user, [('input_location', 'in', [l for l in moves_by_location]), - ('type','=','warehouse')], context=context) + ('type', '=', 'warehouse')], context=context) wh_locations = location_obj.browse( cursor, user, warehouse_ids, context=context) loc2wh = dict([( whl.input_location.id, whl.id) for whl in wh_locations]) @@ -259,7 +259,7 @@ class CreatePacking(Wizard): context=context) res = act_window_obj.read(cursor, user, model_data.db_id, context=context) - res["domain"]= str([('id', 'in',packing_ids)]) + res["domain"]= str([('id', 'in', packing_ids)]) return res diff --git a/move.xml b/move.xml index 9710207c12..2eafd232e2 100644 --- a/move.xml +++ b/move.xml @@ -99,7 +99,9 @@ Moves from suppliers to proceed stock.move form - [('from_location.usage', '=', 'supplier'),('state','in',['draft','waiting']),('incoming_packing_in','=',False),('inventory_packing_in','=',False)] + [('from_location.type', '=', 'supplier'), + ('state','in',['draft','waiting']),('incoming_packing_in','=',False), + ('inventory_packing_in','=',False)] @@ -139,7 +141,8 @@ Moves to customers to proceed stock.move form - [('to_location.usage', '=', 'customer'),('state','in',['draft','waiting'])] + [('to_location.type', '=', 'customer'), + ('state','in',['draft','waiting'])] diff --git a/packing.py b/packing.py index 984e41f848..ee8872ba63 100644 --- a/packing.py +++ b/packing.py @@ -16,20 +16,20 @@ class PackingIn(OSV): effective_date =fields.DateTime('Effective Date', readonly=True) planned_date = fields.DateTime('Planned Date', readonly=True) warehouse = fields.Many2One( - 'stock.location',"Warehouse", required=True, states=STATES, + 'stock.location', "Warehouse", required=True, states=STATES, domain="[('type', '=', 'warehouse')]",) incoming_moves = fields.One2Many( 'stock.move', 'incoming_packing_in', 'Incoming Moves', - states={'readonly':"state in ('received','done')",}, + states={'readonly': "state in ('received', 'done')",}, context="{'warehouse': warehouse, 'packing_state': state, 'type':'incoming'}") inventory_moves = fields.One2Many( 'stock.move', 'inventory_packing_in', 'Inventory Moves', - states={'readonly':"state in ('draft','waiting')",}, + states={'readonly': "state in ('draft', 'waiting')",}, context="{'warehouse': warehouse, 'packing_state': state, 'type':'inventory_in'}") code = fields.Char("Code", size=None, select=1, readonly=True,) state = fields.Selection( - [('draft','Draft'),('done','Done'),('cancel','Cancel'), - ('waiting','Waiting'),('received','Received')], 'State', readonly=True) + [('draft', 'Draft'), ('done', 'Done'), ('cancel', 'Cancel'), + ('waiting', 'Waiting'), ('received', 'Received')], 'State', readonly=True) def __init__(self): super(PackingIn, self).__init__()