From b0a2103e5973b73ff5bb752a7939777df6e03110 Mon Sep 17 00:00:00 2001 From: Fabien Pinckaers Date: Wed, 16 Jun 2010 14:25:03 +0200 Subject: [PATCH] removed not clean module bzr revid: fp@tinyerp.com-20100616122503-swfhu1nwxwzsmctk --- addons/stock_avg_consommation/__init__.py | 25 ----- addons/stock_avg_consommation/__openerp__.py | 35 ------ .../stock_avg_consommation.py | 100 ------------------ .../stock_avg_consommation_view.xml | 18 ---- .../stock_avg_consommation/wizard/__init__.py | 24 ----- .../wizard/stock_avg_consommation_wizard.py | 57 ---------- 6 files changed, 259 deletions(-) delete mode 100644 addons/stock_avg_consommation/__init__.py delete mode 100644 addons/stock_avg_consommation/__openerp__.py delete mode 100644 addons/stock_avg_consommation/stock_avg_consommation.py delete mode 100644 addons/stock_avg_consommation/stock_avg_consommation_view.xml delete mode 100644 addons/stock_avg_consommation/wizard/__init__.py delete mode 100644 addons/stock_avg_consommation/wizard/stock_avg_consommation_wizard.py diff --git a/addons/stock_avg_consommation/__init__.py b/addons/stock_avg_consommation/__init__.py deleted file mode 100644 index c4d17a90d9a..00000000000 --- a/addons/stock_avg_consommation/__init__.py +++ /dev/null @@ -1,25 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# OpenERP, Open Source Management Solution -# Copyright (C) 2004-2010 Tiny SPRL (). -# -# 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 . -# -############################################################################## - -import stock_avg_consommation -import wizard - -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/stock_avg_consommation/__openerp__.py b/addons/stock_avg_consommation/__openerp__.py deleted file mode 100644 index 37008770cae..00000000000 --- a/addons/stock_avg_consommation/__openerp__.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# OpenERP, Open Source Management Solution -# Copyright (C) 2004-2010 Tiny SPRL (). -# -# 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 . -# -############################################################################## - - -{ - 'name': 'Stock Average consommation', - 'version': '1.0', - 'category': 'Generic Modules/Inventory Control', - 'author': 'Tiny', - 'depends': ['stock'], - 'init_xml': [], - 'update_xml': ['stock_avg_consommation_view.xml'], - 'demo_xml': [], - 'installable': True, - 'active': False, -} -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/stock_avg_consommation/stock_avg_consommation.py b/addons/stock_avg_consommation/stock_avg_consommation.py deleted file mode 100644 index b9dab63d18b..00000000000 --- a/addons/stock_avg_consommation/stock_avg_consommation.py +++ /dev/null @@ -1,100 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# OpenERP, Open Source Management Solution -# Copyright (C) 2004-2010 Tiny SPRL (). -# -# 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 . -# -############################################################################## - -from osv import fields,osv -import tools -import ir -import pooler -from mx import DateTime -from datetime import datetime -import time -from dateutil.relativedelta import relativedelta - -class stock_avg_consommation(osv.osv): - _name = "stock.avg.consommation" - _inherit="product.product" - - def _compute_avg_consommation(self, cr, uid, ids, fields, args, context={}): - print ids, fields, args, context - date_str=False - from_date=context.get('from_date',False) - to_date=context.get('to_date',False) - - if from_date and to_date: - date_str="date_planned>='%s' and date_planned<='%s'"%(from_date,to_date) - elif from_date: - date_str="date_planned>='%s'"%(from_date) - elif to_date: - date_str="date_planned<='%s'"%(to_date) - - date_object_to = to_date and datetime.strptime(to_date, '%Y-%m-%d %H:%M:%S') or datetime.now() - date_object_from = from_date and datetime.strptime(from_date, '%Y-%m-%d %H:%M:%S') or (datetime.now() + relativedelta(days=-30)) - dd = date_object_to - date_object_from - total_days=dd.days+1 - if not from_date and not to_date: - date_str="date_planned>='%s' and date_planned<='%s'"%(date_object_from.strftime('%Y-%m-%d 00:00:00'), date_object_to.strftime('%Y-%m-%d 23:59:59')) - elif not from_date: - date_str="date_planned>='%s'"%(date_object_from.strftime('%Y-%m-%d 00:00:00')) - elif not to_date: - date_str="date_planned<='%s'"%(date_object_to.strftime('%Y-%m-%d 23:59:59')) - res={} - for line_id in ids: - res[line_id] = False - location_ids = [] - - if context.get('location', False): - if type(context['location']) == type(1): - location_ids = [context['location']] - elif type(context['location']) in (type(''), type(u'')): - location_ids = self.pool.get('stock.location').search(cr, uid, [('name','ilike',context['location'])], context=context) - else: - location_ids = context['location'] - else: - location_ids = [] - wids = self.pool.get('stock.warehouse').search(cr, uid, [], context=context) - for w in self.pool.get('stock.warehouse').browse(cr, uid, wids, context=context): - location_ids.append(w.lot_stock_id.id) - - # build the list of ids of children of the location given by id - if context.get('compute_child',True): - child_location_ids = self.pool.get('stock.location').search(cr, uid, [('location_id', 'child_of', location_ids)]) - location_ids = child_location_ids or location_ids - else: - location_ids = location_ids - - - - #sql = """select product_id,sum(product_qty) from stock_move sm,stock_picking sp where sm.picking_id=sp.id and sp.type in ('out','delivery') and %s and location_id <> ANY(%s) and location_dest_id =ANY(%s) group by product_id""" % (date_str, location_ids, location_ids) - sql = """select product_id,sum(product_qty) from stock_move sm,stock_picking sp where sm.picking_id=sp.id and sp.type in ('out','delivery') and """+date_str+""" and sm.location_id not in %s and sm.location_dest_id in %s group by product_id""" - cr.execute(sql, [tuple(location_ids), tuple(location_ids)]) - product_ids = [] - res_sum = cr.fetchall() - for line_id, avg in res_sum: - res[line_id] = avg/total_days - product_ids.append(avg) - return res - - _columns = { - 'avg_consommation':fields.function(_compute_avg_consommation,method=True, type='float', string="Average Consommation"), - } -stock_avg_consommation() - -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/stock_avg_consommation/stock_avg_consommation_view.xml b/addons/stock_avg_consommation/stock_avg_consommation_view.xml deleted file mode 100644 index d9afed69af3..00000000000 --- a/addons/stock_avg_consommation/stock_avg_consommation_view.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - stock.avg.consommation.tree - stock.avg.consommation - tree - - - - - - - - - - - diff --git a/addons/stock_avg_consommation/wizard/__init__.py b/addons/stock_avg_consommation/wizard/__init__.py deleted file mode 100644 index a7d7cfed3dc..00000000000 --- a/addons/stock_avg_consommation/wizard/__init__.py +++ /dev/null @@ -1,24 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# OpenERP, Open Source Management Solution -# Copyright (C) 2004-2010 Tiny SPRL (). -# -# 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 . -# -############################################################################## - -import stock_avg_consommation_wizard - -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/stock_avg_consommation/wizard/stock_avg_consommation_wizard.py b/addons/stock_avg_consommation/wizard/stock_avg_consommation_wizard.py deleted file mode 100644 index 7d5d8657aa2..00000000000 --- a/addons/stock_avg_consommation/wizard/stock_avg_consommation_wizard.py +++ /dev/null @@ -1,57 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# OpenERP, Open Source Management Solution -# Copyright (C) 2004-2010 Tiny SPRL (). -# -# 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 . -# -############################################################################## - -from osv import fields, osv - -class stock_location_product(osv.osv_memory): - _inherit = "stock.location.product" - - def action_open_window(self, cr, uid, ids, context): - """ To open location wise product information specific to given duration - @param self: The object pointer. - @param cr: A database cursor - @param uid: ID of the user currently logged in - @param ids: An ID or list of IDs if we want more than one - @param context: A standard dictionary - @return: Invoice type - """ - - mod_obj = self.pool.get('ir.model.data') - view = mod_obj._get_id(cr, uid, 'stock_avg_consommation', 'stock_avg_consommation_tree') - id = mod_obj.read(cr, uid, view, ['res_id']) - - for location_obj in self.read(cr, uid, ids, ['from_date', 'to_date']): - return { - 'name': False, - 'view_id':[id['res_id']], - 'view_type': 'form', - 'view_mode': 'tree,form', - 'res_model': 'stock.avg.consommation', - 'type': 'ir.actions.act_window', - 'context': {'location': context['active_id'], - 'from_date': location_obj['from_date'], - 'to_date': location_obj['to_date']}, - 'domain': [('type', '<>', 'service')], - } - -stock_location_product() - -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file