1
# -*- coding: utf-8 -*-
2
##############################################################################
4
# OpenERP, Open Source Management Solution
5
# Copyright (c) 2013 Serv. Tecnol. Avanzados (http://www.serviciosbaeza.com)
6
# Pedro M. Baeza <pedro.baeza@serviciosbaeza.com>
8
# This program is free software: you can redistribute it and/or modify
9
# it under the terms of the GNU Affero General Public License as published by
10
# the Free Software Foundation, either version 3 of the License, or
11
# (at your option) any later version.
13
# This program is distributed in the hope that it will be useful,
14
# but WITHOUT ANY WARRANTY; without even the implied warranty of
15
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
# GNU Affero General Public License for more details.
18
# You should have received a copy of the GNU Affero General Public License
19
# along with this program. If not, see <http://www.gnu.org/licenses/>.
21
##############################################################################
22
from openerp.osv import fields, orm
24
class stock_picking(orm.Model):
25
_inherit = 'stock.picking'
27
def _get_return_ids(self, cr, uid, ids, name, arg, context=None):
29
for picking in self.browse(cr, uid, ids, context=context):
30
for line in picking.move_lines:
32
if line.state == 'done':
33
for rec in line.move_history_ids2:
34
if rec.location_dest_id.id == line.location_id.id \
35
and rec.location_id.id == line.location_dest_id.id:
36
return_ids.append(rec.picking_id.id)
37
result[picking.id] = return_ids
41
'return_ids': fields.function(_get_return_ids,
42
relation='stock.picking',
43
string="Return pickings",
47
class stock_picking_out(orm.Model):
48
_inherit = 'stock.picking.out'
50
def _get_return_ids(self, cr, uid, ids, name, arg, context=None):
51
return super(stock_picking_out, self)._get_return_ids(cr, uid, ids,
56
'return_ids': fields.function(_get_return_ids,
57
relation='stock.picking',
58
string="Return pickings",
62
class stock_picking_in(orm.Model):
63
_inherit = 'stock.picking.in'
65
def _get_return_ids(self, cr, uid, ids, name, arg, context=None):
66
return super(stock_picking_out, self)._get_return_ids(cr, uid, ids,
71
'return_ids': fields.function(_get_return_ids,
72
relation='stock.picking',
73
string="Return pickings",