2010-03-10 09:42:47 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
##############################################################################
|
|
|
|
#
|
|
|
|
# OpenERP, Open Source Management Solution
|
|
|
|
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
|
|
|
#
|
|
|
|
# This program is free software: you can redistribute it and/or modify
|
|
|
|
# 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.
|
|
|
|
#
|
|
|
|
# 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
|
|
|
|
# GNU Affero General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU Affero General Public License
|
|
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
#
|
|
|
|
##############################################################################
|
|
|
|
|
2012-12-06 14:56:32 +00:00
|
|
|
from openerp.osv import fields, osv
|
|
|
|
from openerp.tools.translate import _
|
2010-03-10 09:42:47 +00:00
|
|
|
|
|
|
|
class stock_location_product(osv.osv_memory):
|
|
|
|
_name = "stock.location.product"
|
|
|
|
_description = "Products by Location"
|
|
|
|
_columns = {
|
2010-04-22 06:47:21 +00:00
|
|
|
'from_date': fields.datetime('From'),
|
2012-08-01 10:59:01 +00:00
|
|
|
'to_date': fields.datetime('To'),
|
2014-04-22 07:38:26 +00:00
|
|
|
'type': fields.selection([('inventory','Analyze current inventory'),
|
|
|
|
('period','Analyze period')], 'Analysis Type', required=True),
|
2010-03-18 07:14:05 +00:00
|
|
|
}
|
2010-03-10 09:42:47 +00:00
|
|
|
|
2010-11-22 10:37:53 +00:00
|
|
|
def action_open_window(self, cr, uid, ids, context=None):
|
2010-05-26 12:59:30 +00:00
|
|
|
""" To open location wise product information specific to given duration
|
2010-04-22 06:47:21 +00:00
|
|
|
@param self: The object pointer.
|
|
|
|
@param cr: A database cursor
|
|
|
|
@param uid: ID of the user currently logged in
|
2011-11-16 10:16:04 +00:00
|
|
|
@param ids: An ID or list of IDs (but only the first ID will be processed)
|
2010-04-22 06:47:21 +00:00
|
|
|
@param context: A standard dictionary
|
2010-05-26 12:59:30 +00:00
|
|
|
@return: Invoice type
|
2010-04-22 06:47:21 +00:00
|
|
|
"""
|
2011-11-16 10:14:13 +00:00
|
|
|
if context is None:
|
|
|
|
context = {}
|
2011-11-16 10:16:04 +00:00
|
|
|
location_products = self.read(cr, uid, ids, ['from_date', 'to_date'], context=context)
|
|
|
|
if location_products:
|
2010-03-10 09:42:47 +00:00
|
|
|
return {
|
2012-08-01 10:59:01 +00:00
|
|
|
'name': _('Current Inventory'),
|
2011-11-21 16:33:36 +00:00
|
|
|
'view_type': 'form',
|
|
|
|
'view_mode': 'tree,form',
|
|
|
|
'res_model': 'product.product',
|
|
|
|
'type': 'ir.actions.act_window',
|
|
|
|
'context': {'location': context['active_id'],
|
|
|
|
'from_date': location_products[0]['from_date'],
|
|
|
|
'to_date': location_products[0]['to_date']},
|
|
|
|
'domain': [('type', '<>', 'service')],
|
2010-03-18 07:14:05 +00:00
|
|
|
}
|
2010-03-10 09:42:47 +00:00
|
|
|
|
|
|
|
|
|
|
|
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|