2009-10-13 05:58:37 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
2006-12-07 13:41:40 +00:00
|
|
|
##############################################################################
|
2010-11-25 10:47:19 +00:00
|
|
|
#
|
2009-10-14 11:15:34 +00:00
|
|
|
# OpenERP, Open Source Management Solution
|
2010-01-12 09:18:39 +00:00
|
|
|
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
2008-06-16 11:00:21 +00:00
|
|
|
#
|
2008-11-03 19:18:56 +00:00
|
|
|
# This program is free software: you can redistribute it and/or modify
|
2009-10-14 11:15:34 +00:00
|
|
|
# it under the terms of the GNU Affero General Public License as
|
|
|
|
# published by the Free Software Foundation, either version 3 of the
|
|
|
|
# License, or (at your option) any later version.
|
2006-12-07 13:41:40 +00:00
|
|
|
#
|
2008-11-03 19:18:56 +00:00
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
2009-10-14 11:15:34 +00:00
|
|
|
# GNU Affero General Public License for more details.
|
2006-12-07 13:41:40 +00:00
|
|
|
#
|
2009-10-14 11:15:34 +00:00
|
|
|
# You should have received a copy of the GNU Affero General Public License
|
2010-11-25 10:47:19 +00:00
|
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2006-12-07 13:41:40 +00:00
|
|
|
#
|
|
|
|
##############################################################################
|
|
|
|
|
2010-08-04 11:07:44 +00:00
|
|
|
from osv import fields, osv
|
2011-07-11 16:09:56 +00:00
|
|
|
from tools.translate import _
|
2006-12-07 13:41:40 +00:00
|
|
|
|
2010-03-26 13:04:16 +00:00
|
|
|
class action_traceability(osv.osv_memory):
|
2010-11-25 10:47:19 +00:00
|
|
|
"""
|
2010-03-26 13:04:16 +00:00
|
|
|
This class defines a function action_traceability for wizard
|
|
|
|
|
|
|
|
"""
|
|
|
|
_name = "action.traceability"
|
|
|
|
_description = "Action traceability "
|
|
|
|
|
2010-11-22 10:37:53 +00:00
|
|
|
def action_traceability(self, cr, uid, ids, context=None):
|
2010-05-26 12:59:30 +00:00
|
|
|
""" It traces the information of a product
|
|
|
|
@param self: The object pointer.
|
|
|
|
@param cr: A database cursor
|
|
|
|
@param uid: ID of the user currently logged in
|
2010-11-25 10:47:19 +00:00
|
|
|
@param ids: List of IDs selected
|
|
|
|
@param context: A standard dictionary
|
2010-05-26 12:59:30 +00:00
|
|
|
@return: A dictionary of values
|
2010-03-26 13:04:16 +00:00
|
|
|
"""
|
2010-11-25 10:47:19 +00:00
|
|
|
lot_id = ids
|
2010-11-23 07:05:05 +00:00
|
|
|
if context is None:
|
2010-11-22 10:37:53 +00:00
|
|
|
context = {}
|
2011-12-22 06:06:59 +00:00
|
|
|
type1 = context.get('type', 'move_history_ids2')
|
|
|
|
field = context.get('field', 'tracking_id')
|
2010-03-26 13:04:16 +00:00
|
|
|
obj = self.pool.get('stock.move')
|
2010-11-25 10:47:19 +00:00
|
|
|
ids = obj.search(cr, uid, [(field, 'in',lot_id)])
|
2010-03-26 13:04:16 +00:00
|
|
|
cr.execute('select id from ir_ui_view where model=%s and field_parent=%s and type=%s', ('stock.move', type1, 'tree'))
|
2012-01-30 14:17:11 +00:00
|
|
|
view_ids = cr.fetchone()
|
|
|
|
view_id = view_ids and view_ids[0] or False
|
2008-07-22 15:11:28 +00:00
|
|
|
value = {
|
2010-12-07 05:55:04 +00:00
|
|
|
'domain': "[('id','in',["+','.join(map(str, ids))+"])]",
|
2011-07-11 16:09:56 +00:00
|
|
|
'name': ((type1=='move_history_ids2') and _('Upstream Traceability')) or _('Downstream Traceability'),
|
2008-07-22 15:11:28 +00:00
|
|
|
'view_type': 'tree',
|
2011-10-10 06:31:27 +00:00
|
|
|
'view_mode': 'tree',
|
2008-07-22 15:11:28 +00:00
|
|
|
'res_model': 'stock.move',
|
2010-03-26 13:04:16 +00:00
|
|
|
'field_parent': type1,
|
2008-07-22 15:11:28 +00:00
|
|
|
'view_id': (view_id,'View'),
|
2010-09-06 10:47:40 +00:00
|
|
|
'type': 'ir.actions.act_window',
|
2010-11-25 10:47:19 +00:00
|
|
|
'nodestroy':True,
|
2010-08-13 12:20:05 +00:00
|
|
|
}
|
2008-07-22 15:11:28 +00:00
|
|
|
return value
|
2010-08-13 12:20:05 +00:00
|
|
|
|
2010-03-26 13:04:16 +00:00
|
|
|
action_traceability()
|
|
|
|
|
2008-07-23 14:41:47 +00:00
|
|
|
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
|
|
|
|