1
# -*- coding: utf-8 -*-
2
##############################################################################
4
# OpenERP, Open Source Management Solution
5
# Copyright (C) 2011 TeMPO Consulting, MSF
7
# This program is free software: you can redistribute it and/or modify
8
# it under the terms of the GNU Affero General Public License as
9
# published by the Free Software Foundation, either version 3 of the
10
# License, or (at your option) any later version.
12
# This program is distributed in the hope that it will be useful,
13
# but WITHOUT ANY WARRANTY; without even the implied warranty of
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
# GNU Affero General Public License for more details.
17
# You should have received a copy of the GNU Affero General Public License
18
# along with this program. If not, see <http://www.gnu.org/licenses/>.
20
##############################################################################
22
from osv import osv, fields
24
class stock_move(osv.osv):
26
_inherit = 'stock.move'
28
def _get_picking_ids(self, cr, uid, ids, context={}):
30
picking_ids = self.pool.get('stock.picking').browse(cr, uid, ids, context=context)
31
for pick in picking_ids:
32
res += self.pool.get('stock.move').search(cr, uid, [('picking_id', '=', pick.id)])
36
def _get_lot_ids(self, cr, uid, ids, context={}):
38
lot_ids = self.pool.get('stock.production.lot').browse(cr, uid, ids, context=context)
40
res += self.pool.get('stock.move').search(cr, uid, [('prodlot_id', '=', lot.id)])
45
'type': fields.related('picking_id', 'type', string='Type', type='selection',
46
selection=[('out', 'Sending Goods'), ('in', 'Getting Goods'), ('internal', 'Internal')], readonly=True,
48
'stock.picking': (_get_picking_ids, ['type'], 20),
49
'stock.move': (lambda self, cr, uid, ids, c={}: ids, ['picking_id'], 20),
53
'expired_date': fields.related('prodlot_id', 'life_date', string='Expired Date', type='datetime', readonly=True,
55
'stock.production.lot': (_get_lot_ids, ['life_date'], 20),
56
'stock.move': (lambda self, cr, uid, ids, c={}: ids, ['prodlot_id'], 20),
63
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: