diff --git a/stock_orderpoint_creator/__init__.py b/stock_orderpoint_creator/__init__.py deleted file mode 100644 index 34ffb14a7..000000000 --- a/stock_orderpoint_creator/__init__.py +++ /dev/null @@ -1,24 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# Author: Yannick Vaucher (Camptocamp) -# Copyright 2012 Camptocamp SA -# -# 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 . import base_product_config_template -from . import orderpoint_template -import wizard diff --git a/stock_orderpoint_creator/__openerp__.py b/stock_orderpoint_creator/__openerp__.py deleted file mode 100644 index b31de413d..000000000 --- a/stock_orderpoint_creator/__openerp__.py +++ /dev/null @@ -1,43 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# Author: Yannick Vaucher (Camptocamp) -# Copyright 2012 Camptocamp SA -# -# 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': 'Configuration of order point in mass', - 'version': '1.0', - 'author': "Camptocamp,Odoo Community Association (OCA)", - 'maintainer': 'Camptocamp', - 'category': 'Warehouse', - 'complexity': 'easy', #easy, normal, expert - 'depends': ['procurement'], - 'description': """ -Add a wizard to configure massively order points for multiple product""", - 'website': 'http://www.openerp.com', - 'init_xml': [], - 'update_xml': ["wizard/orderpoint_creator_view.xml", "security/ir.model.access.csv"], - 'demo_xml': [], - 'test': [], - 'installable': False, - 'images': [], - 'auto_install': False, - 'license': 'AGPL-3', - 'active': False, -} - -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/stock_orderpoint_creator/base_product_config_template.py b/stock_orderpoint_creator/base_product_config_template.py deleted file mode 100644 index 1f6cd9389..000000000 --- a/stock_orderpoint_creator/base_product_config_template.py +++ /dev/null @@ -1,85 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# Author: Yannick Vaucher (Camptocamp) -# Copyright 2012 Camptocamp SA -# -# 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 . -# -############################################################################## - -""" Base template for product config """ -from openerp.osv.orm import browse_record, browse_record_list - -class BaseProductConfigTemplate(): - """ Abstract class for product config """ - - - def _get_model(self): - """ Get the model for which this template is defined - - return a browse record of the model for which - is represented by this template - """ - model = self._inherit - model_obj = self.pool.get(model) - return model_obj - - def _get_ids_2_clean(self, cursor, uid, template_br, - product_ids, context=None): - """ hook to select model specific objects to clean - return must return a list of id""" - return [] - - def _disable_old_instances(self, cursor, uid, template_br_list, - product_ids, context=None): - """ Clean old instance by setting those inactives """ - model_obj = self._get_model() - for template in template_br_list: - ids2clean = self._get_ids_2_clean(cursor, uid, template, - product_ids, context=context) - if self._clean_mode == 'deactivate': - model_obj.write(cursor, uid, ids2clean, - {'active': False}, context=context) - elif self._clean_mode == 'unlink': - model_obj.unlink(cursor, uid, ids2clean, context=context) - - - def create_instances(self, cursor, uid, template_br, - product_ids, context=None): - """ Create instances of model using template inherited model """ - if not isinstance(product_ids, list): - product_ids = [product_ids] - - # data = self.copy_data(cursor, uid, template_br.id, context=context) - # copy data will not work in all case and may retrieve erronus value - - model_obj = self._get_model() - - data = {} - #May rais error on function fields in future - for key in model_obj._columns.keys(): - tmp = template_br[key] - if isinstance(tmp, browse_record): - tmp = tmp.id - if isinstance(tmp, browse_record_list): - tmp = [(6, 0, tmp)] - data[key] = tmp - - for product_id in product_ids: - data['product_id'] = product_id - model_obj.create(cursor, uid, data, context=context) - - -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/stock_orderpoint_creator/orderpoint_template.py b/stock_orderpoint_creator/orderpoint_template.py deleted file mode 100644 index 2de2e6e76..000000000 --- a/stock_orderpoint_creator/orderpoint_template.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# Author: Yannick Vaucher (Camptocamp) -# Copyright 2012 Camptocamp SA -# -# 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 . -# -############################################################################## - -""" Template of order point object """ - -from openerp.osv.orm import Model, fields -from base_product_config_template import BaseProductConfigTemplate - -class OrderpointTemplate(BaseProductConfigTemplate, Model): - """ Template for orderpoints """ - _name = 'stock.warehouse.orderpoint.template' - - _inherit = 'stock.warehouse.orderpoint' - _table = 'stock_warehouse_orderpoint_template' - _clean_mode = 'deactivate' - - - _columns = { - 'product_id': fields.many2one('product.product', - 'Product', - required=False, - ondelete='cascade', - domain=[('type','=','product')]), - } - - def _get_ids_2_clean(self, cursor, uid, template_br, product_ids, context=None): - """ hook to select model specific objects to clean - return must return a list of id""" - model_obj = self._get_model() - ids_to_del = model_obj.search(cursor, uid, - [('product_id', 'in', product_ids)]) - return ids_to_del - -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/stock_orderpoint_creator/wizard/__init__.py b/stock_orderpoint_creator/wizard/__init__.py deleted file mode 100644 index f6057e212..000000000 --- a/stock_orderpoint_creator/wizard/__init__.py +++ /dev/null @@ -1,22 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# Author: Yannick Vaucher (Camptocamp) -# Copyright 2012 Camptocamp SA -# -# 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 . import orderpoint_creator diff --git a/stock_orderpoint_creator/wizard/orderpoint_creator.py b/stock_orderpoint_creator/wizard/orderpoint_creator.py deleted file mode 100644 index f84abd5d0..000000000 --- a/stock_orderpoint_creator/wizard/orderpoint_creator.py +++ /dev/null @@ -1,69 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# Author: Yannick Vaucher (Camptocamp) -# Copyright 2012 Camptocamp SA -# -# 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 . -# -############################################################################## - -""" Wizard defining stock.warehouse.orderpoint configurations for selected -products. Those configs are generated using templates """ - -from openerp.osv.orm import browse_record, TransientModel, fields - -_template_register = ['orderpoint_template_id'] - -class OrderpointCreator(TransientModel): - _name = 'stock.warehouse.orderpoint.creator' - _description = 'Orderpoint Creator' - - _columns = {'orderpoint_template_id': fields.many2many( - 'stock.warehouse.orderpoint.template', - rel='order_point_creator_rel', - string='Stock rule template') - } - - - def _get_template_register(self): - """return a list of the field names which defines a template - This is a hook to allow expending the list of template""" - return _template_register - - - def action_configure(self, cursor, uid, wiz_id, context=None): - """ action to retrieve wizard data and launch creation of items """ - - product_ids = context['active_ids'] - if isinstance(wiz_id, list): - wiz_id = wiz_id[0] - current = self.browse(cursor, uid, wiz_id, context=context) - for template_field in self._get_template_register(): - template_br_list = current[template_field] - if template_br_list: - if isinstance(template_br_list, browse_record): - template_br_list = [template_br_list] - template_model = template_br_list[0]._model._name - template_obj = self.pool.get(template_model) - template_obj._disable_old_instances(cursor, uid, template_br_list, - product_ids, context=context) - for template_br in template_br_list: - template_obj.create_instances(cursor, uid, template_br, - product_ids, context=context) - - return {} - - -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/stock_orderpoint_creator/wizard/orderpoint_creator_view.xml b/stock_orderpoint_creator/wizard/orderpoint_creator_view.xml deleted file mode 100644 index efa42ece6..000000000 --- a/stock_orderpoint_creator/wizard/orderpoint_creator_view.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - stock.warehouse.orderpoint.creator - stock.warehouse.orderpoint.creator - form - -
- - - - -