1 # -*- coding: utf-8 -*-
2 ##############################################################################
4 # OpenERP, Open Source Management Solution
5 # Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
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 fields, osv
23 from tools.translate import _
25 class action_traceability(osv.osv_memory):
27 This class defines a function action_traceability for wizard
30 _name = "action.traceability"
31 _description = "Action traceability "
33 def action_traceability(self, cr, uid, ids, context=None):
34 """ It traces the information of a product
35 @param self: The object pointer.
36 @param cr: A database cursor
37 @param uid: ID of the user currently logged in
38 @param ids: List of IDs selected
39 @param context: A standard dictionary
40 @return: A dictionary of values
45 type1 = context['type'] or 'move_history_ids2'
46 field = context['field'] or 'tracking_id'
47 obj = self.pool.get('stock.move')
48 ids = obj.search(cr, uid, [(field, 'in',lot_id)])
49 cr.execute('select id from ir_ui_view where model=%s and field_parent=%s and type=%s', ('stock.move', type1, 'tree'))
50 view_id = cr.fetchone()[0]
52 'domain': "[('id','in',["+','.join(map(str, ids))+"])]",
53 'name': ((type1=='move_history_ids2') and _('Upstream Traceability')) or _('Downstream Traceability'),
56 'res_model': 'stock.move',
57 'field_parent': type1,
58 'view_id': (view_id,'View'),
59 'type': 'ir.actions.act_window',
66 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: