diff --git a/stock_inventory_existing_lines/__init__.py b/stock_inventory_existing_lines/__init__.py deleted file mode 100644 index 50d10b8de..000000000 --- a/stock_inventory_existing_lines/__init__.py +++ /dev/null @@ -1,24 +0,0 @@ -# -*- coding: utf-8 -*- -################################################################################# -# -# OpenERP, Open Source Management Solution -# Copyright (C) 2011 Julius Network Solutions SARL -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU 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 General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . -# -################################################################################# - -import stock - -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file diff --git a/stock_inventory_existing_lines/__openerp__.py b/stock_inventory_existing_lines/__openerp__.py deleted file mode 100644 index 0d6b2823c..000000000 --- a/stock_inventory_existing_lines/__openerp__.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -################################################################################# -# -# OpenERP, Open Source Management Solution -# Copyright (C) 2011 Julius Network Solutions SARL -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU 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 General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . -# -################################################################################# - -{ - "name" : "Inventory Extended", - "version" : "1.0", - "author" : "Julius Network Solutions,Odoo Community Association (OCA)", - "description" : """ - -Presentation: - -This module adds a new field based on lines into the inventory -to know what are lines correctly in the system. - -This module adds a new tab 'Lines' in Physical Inventories with correct lines of Stock Inventory Lines. - - """, - "website" : "http://www.julius.fr", - "depends" : [ - "stock", - ], - "category" : "Customs/Stock", - "init_xml" : [], - "demo_xml" : [], - "images" : ['images/Inventory existing lines.png'], - "update_xml" : [ - 'stock_view.xml', - "security/ir.model.access.csv", - ], - 'test': [], - 'installable': False, - 'active': False, - 'certificate': '', -} diff --git a/stock_inventory_existing_lines/i18n/fr.po b/stock_inventory_existing_lines/i18n/fr.po deleted file mode 100644 index 0f3233e26..000000000 --- a/stock_inventory_existing_lines/i18n/fr.po +++ /dev/null @@ -1,100 +0,0 @@ -# Translation of OpenERP Server. -# This file contains the translation of the following modules: -# * stock_inventory_existing_lines -# -msgid "" -msgstr "" -"Project-Id-Version: OpenERP Server 6.0.3\n" -"Report-Msgid-Bugs-To: support@openerp.com\n" -"POT-Creation-Date: 2011-12-19 10:50+0000\n" -"PO-Revision-Date: 2011-12-19 10:50+0000\n" -"Last-Translator: <>\n" -"Language-Team: \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: \n" -"Plural-Forms: \n" - -#. module: stock_inventory_existing_lines -#: view:stock.inventory:0 -msgid "General Informations" -msgstr "Informations générales" - -#. module: stock_inventory_existing_lines -#: field:stock.inventory.line2,product_id:0 -msgid "Product" -msgstr "Produit" - -#. module: stock_inventory_existing_lines -#: model:ir.model,name:stock_inventory_existing_lines.model_stock_inventory_line2 -msgid "stock.inventory.line2" -msgstr "stock.inventory.line2" - -#. module: stock_inventory_existing_lines -#: field:stock.inventory.line2,state:0 -msgid "State" -msgstr "Statut" - -#. module: stock_inventory_existing_lines -#: field:stock.inventory.line2,company_id:0 -msgid "Company" -msgstr "Société" - -#. module: stock_inventory_existing_lines -#: view:stock.inventory:0 -msgid "Lines" -msgstr "Lignes correspondantes" - -#. module: stock_inventory_existing_lines -#: model:ir.module.module,description:stock_inventory_existing_lines.module_meta_information -msgid " This module adds a new field based on lines into the inventory\n" -" to know what are lines correctly in the system " -msgstr " Ce module ajoute un nouveau champ basé sur des lignes dans l'inventaire\n" -" pour savoir quelles sont les lignes qui existent déjà dans le système " - -#. module: stock_inventory_existing_lines -#: view:stock.inventory.line2:0 -msgid "Stock Inventory Lines" -msgstr "Lignes d'inventaires des stocks" - -#. module: stock_inventory_existing_lines -#: model:ir.module.module,shortdesc:stock_inventory_existing_lines.module_meta_information -msgid "Invetory Extended" -msgstr "Inventaire étendu" - -#. module: stock_inventory_existing_lines -#: field:stock.inventory.line2,product_qty:0 -msgid "Quantity" -msgstr "Quantité" - -#. module: stock_inventory_existing_lines -#: field:stock.inventory.line2,product_uom:0 -msgid "Product UOM" -msgstr "Produit UdM" - -#. module: stock_inventory_existing_lines -#: model:ir.model,name:stock_inventory_existing_lines.model_stock_inventory -#: field:stock.inventory.line2,inventory_id:0 -msgid "Inventory" -msgstr "Inventaire" - -#. module: stock_inventory_existing_lines -#: view:stock.inventory:0 -msgid "Correct lines" -msgstr "Lignes correspondantes" - -#. module: stock_inventory_existing_lines -#: field:stock.inventory,inventory_line_id2:0 -msgid "Inventories" -msgstr "Inventaires" - -#. module: stock_inventory_existing_lines -#: field:stock.inventory.line2,prod_lot_id:0 -msgid "Production Lot" -msgstr "Numéro de série" - -#. module: stock_inventory_existing_lines -#: field:stock.inventory.line2,location_id:0 -msgid "Location" -msgstr "Stockage" - diff --git a/stock_inventory_existing_lines/images/Inventory existing lines.png b/stock_inventory_existing_lines/images/Inventory existing lines.png deleted file mode 100644 index eeed64ab9..000000000 Binary files a/stock_inventory_existing_lines/images/Inventory existing lines.png and /dev/null differ diff --git a/stock_inventory_existing_lines/security/ir.model.access.csv b/stock_inventory_existing_lines/security/ir.model.access.csv deleted file mode 100644 index fb1953e81..000000000 --- a/stock_inventory_existing_lines/security/ir.model.access.csv +++ /dev/null @@ -1,3 +0,0 @@ -"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink" -"access_stock_inventory_line2_user","stock.inventory.line2 user","model_stock_inventory_line2","stock.group_stock_user",1,1,1,1 -"access_stock_inventory_line2_manager","stock.inventory.line2 manager","model_stock_inventory_line2","stock.group_stock_manager",1,1,1,1 diff --git a/stock_inventory_existing_lines/stock.py b/stock_inventory_existing_lines/stock.py deleted file mode 100644 index 7faa1a203..000000000 --- a/stock_inventory_existing_lines/stock.py +++ /dev/null @@ -1,92 +0,0 @@ -# -*- coding: utf-8 -*- -################################################################################# -# -# OpenERP, Open Source Management Solution -# Copyright (C) 2011 Julius Network Solutions SARL -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU 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 General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . -# -################################################################################# - -from osv import fields, osv -from tools.translate import _ - -import decimal_precision as dp - -class stock_inventory(osv.osv): - _inherit = "stock.inventory" - - _columns = { - 'inventory_line_id2': fields.one2many('stock.inventory.line2', 'inventory_id', 'Inventories', states={'done': [('readonly', True)]}), - } - - def action_confirm(self, cr, uid, ids, context=None): - if context is None: - context = {} - ''' to perform the correct inventory corrections we need analyze stock location by - location, never recursively, so we use a special context ''' - product_context = dict(context, compute_child=False) - - location_obj = self.pool.get('stock.location') - line_obj = self.pool.get('stock.inventory.line') - line2_obj = self.pool.get('stock.inventory.line2') - for inv in self.browse(cr, uid, ids, context=context): - move_ids = [] - for line in inv.inventory_line_id: -# ''' if the production lot is tracked but do not have a serial code then it is not taken into account ''' -# if line.product_id.categ_id.tracked and not line.prod_lot_id: -# continue - if not line.product_qty: - continue - pid = line.product_id.id - date = line.date or inv.date - product_context.update(uom=line.product_uom.id, date=date, to_date=date, prodlot_id=line.prod_lot_id.id) - amount = location_obj._product_get(cr, uid, line.location_id.id, [pid], product_context)[pid] - if not amount: - continue - val_qty = min(line.product_qty,amount) - if val_qty and val_qty > 0: - vals = line_obj.copy_data(cr, uid, line.id) - line2_obj.create(cr, uid, vals) -# location_id = line.product_id.product_tmpl_id.property_stock_inventory.id - res = super(stock_inventory, self).action_confirm(cr, uid, ids, context) - return res - -stock_inventory() - -#class stock_move(osv.osv): -# _inherit = "stock.move" -# -# _columns = { -# 'inventory_type': fields.selection([('in','In'),('out','Out')], 'Inventory type') -# } -#stock_move() - -class stock_inventory_line2(osv.osv): - _name = "stock.inventory.line2" - - _columns = { - 'inventory_id': fields.many2one('stock.inventory', 'Inventory', ondelete='cascade', select=True), - 'location_id': fields.many2one('stock.location', 'Location', required=True), - 'product_id': fields.many2one('product.product', 'Product', required=True, select=True), - 'product_uom': fields.many2one('product.uom', 'Product UOM', required=True), - 'product_qty': fields.float('Quantity', digits_compute=dp.get_precision('Product UoM')), - 'company_id': fields.related('inventory_id', 'company_id', type='many2one', relation='res.company', string='Company', store=True, select=True, readonly=True), - 'prod_lot_id': fields.many2one('stock.production.lot', 'Production Lot', domain="[('product_id','=',product_id)]"), - 'state': fields.related('inventory_id', 'state', type='char', string='State',readonly=True), - } - -stock_inventory_line2() - -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file diff --git a/stock_inventory_existing_lines/stock_view.xml b/stock_inventory_existing_lines/stock_view.xml deleted file mode 100755 index af8e099bb..000000000 --- a/stock_inventory_existing_lines/stock_view.xml +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - stock.inventory.line2.tree - stock.inventory.line2 - tree - - - - - - - - - - - - stock.inventory.line2.form - stock.inventory.line2 - form - -
- - - - - - - -
- - - stock.inventory.form - stock.inventory - form - - - - - - - - - - - - -
-
diff --git a/stock_inventory_extended/__init__.py b/stock_inventory_extended/__init__.py deleted file mode 100644 index c2c2ebef6..000000000 --- a/stock_inventory_extended/__init__.py +++ /dev/null @@ -1,25 +0,0 @@ -# -*- coding: utf-8 -*- -################################################################################# -# -# OpenERP, Open Source Management Solution -# Copyright (C) 2011 Julius Network Solutions SARL -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU 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 General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . -# -################################################################################# - -import stock -import wizard - -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file diff --git a/stock_inventory_extended/__openerp__.py b/stock_inventory_extended/__openerp__.py deleted file mode 100644 index d6d60a933..000000000 --- a/stock_inventory_extended/__openerp__.py +++ /dev/null @@ -1,50 +0,0 @@ -# -*- coding: utf-8 -*- -################################################################################# -# -# OpenERP, Open Source Management Solution -# Copyright (C) 2011 Julius Network Solutions SARL -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU 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 General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . -# -################################################################################# - -{ - "name" : "Move Inventory Extended", - "version" : "1.0", - "author" : "Julius Network Solutions,Odoo Community Association (OCA)", - "description" : """ - -Presentation: - -This module adds a new field based on lines into the inventory -to get all lines pre-filled and all lines scanned - -""", - "website" : "http://www.julius.fr", - "depends" : [ - "stock", - ], - "category" : "Customs/Stock", - "init_xml" : [], - "demo_xml" : [], - "images" : ['images/Inventory extended.png'], - "update_xml" : [ - 'stock_view.xml', -# 'wizard/stock_fill_inventory_view.xml', - ], - 'test': [], - 'installable': False, - 'active': False, - 'certificate': '', -} diff --git a/stock_inventory_extended/i18n/fr.po b/stock_inventory_extended/i18n/fr.po deleted file mode 100644 index 3c24b35bc..000000000 --- a/stock_inventory_extended/i18n/fr.po +++ /dev/null @@ -1,86 +0,0 @@ -# Translation of OpenERP Server. -# This file contains the translation of the following modules: -# * stock_inventory_extended -# -msgid "" -msgstr "" -"Project-Id-Version: OpenERP Server 6.0.3\n" -"Report-Msgid-Bugs-To: support@openerp.com\n" -"POT-Creation-Date: 2011-12-19 10:54+0000\n" -"PO-Revision-Date: 2011-12-19 10:54+0000\n" -"Last-Translator: <>\n" -"Language-Team: \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: \n" -"Plural-Forms: \n" - -#. module: stock_inventory_extended -#: code:addons/stock_inventory_extended/wizard/stock_fill_inventory.py:47 -#, python-format -msgid "You cannot perform this operation on more than one Stock Inventories." -msgstr "Vous ne pouvez pas effectuer cette opération sur plusieurs inventaires de stock." - -#. module: stock_inventory_extended -#: model:ir.model,name:stock_inventory_extended.model_stock_fill_inventory -msgid "Import Inventory" -msgstr "Importer un inventaire" - -#. module: stock_inventory_extended -#: model:ir.model,name:stock_inventory_extended.model_stock_inventory_line -msgid "Inventory Line" -msgstr "Lignes d'inventaire" - -#. module: stock_inventory_extended -#: field:stock.inventory.line,note:0 -msgid "Notes" -msgstr "Notes" - -#. module: stock_inventory_extended -#: code:addons/stock_inventory_extended/wizard/stock_fill_inventory.py:47 -#, python-format -msgid "Error!" -msgstr "Erreur!" - -#. module: stock_inventory_extended -#: code:addons/stock_inventory_extended/wizard/stock_fill_inventory.py:111 -#, python-format -msgid "No product in this location." -msgstr "Aucun produit à cet endroit." - -#. module: stock_inventory_extended -#: code:addons/stock_inventory_extended/wizard/stock_fill_inventory.py:53 -#, python-format -msgid "Stock Inventory is already Validated." -msgstr "L'inventaire est déjà validé." - -#. module: stock_inventory_extended -#: code:addons/stock_inventory_extended/stock.py:77 -#: model:ir.model,name:stock_inventory_extended.model_stock_inventory -#, python-format -msgid "Inventory" -msgstr "Inventaire" - -#. module: stock_inventory_extended -#: field:stock.inventory.line,date:0 -msgid "Date" -msgstr "Date" - -#. module: stock_inventory_extended -#: code:addons/stock_inventory_extended/wizard/stock_fill_inventory.py:111 -#, python-format -msgid "Warning !" -msgstr "Attention !" - -#. module: stock_inventory_extended -#: code:addons/stock_inventory_extended/stock.py:77 -#, python-format -msgid "is done." -msgstr "est fait." - -#. module: stock_inventory_extended -#: code:addons/stock_inventory_extended/wizard/stock_fill_inventory.py:53 -#, python-format -msgid "Warning!" -msgstr "Attention!" - diff --git a/stock_inventory_extended/images/Inventory extended.png b/stock_inventory_extended/images/Inventory extended.png deleted file mode 100644 index 6a973891f..000000000 Binary files a/stock_inventory_extended/images/Inventory extended.png and /dev/null differ diff --git a/stock_inventory_extended/stock.py b/stock_inventory_extended/stock.py deleted file mode 100644 index 7e2f78293..000000000 --- a/stock_inventory_extended/stock.py +++ /dev/null @@ -1,96 +0,0 @@ -# -*- coding: utf-8 -*- -################################################################################# -# -# OpenERP, Open Source Management Solution -# Copyright (C) 2011 Julius Network Solutions SARL -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU 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 General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . -# -################################################################################# - -from osv import fields, osv -from tools.translate import _ - -class stock_inventory(osv.osv): - _inherit = "stock.inventory" - - _columns = { - 'comments':fields.text('Comments'), - } - - def action_confirm(self, cr, uid, ids, context=None): - """ Confirm the inventory and writes its finished date - @return: True - """ - res = super(stock_inventory, self).action_confirm(cr, uid, ids, context) - - if context is None: - context = {} - # to perform the correct inventory corrections we need analyze stock location by - # location, never recursively, so we use a special context - product_context = dict(context, compute_child=False) - - location_obj = self.pool.get('stock.location') - for inv in self.browse(cr, uid, ids, context=context): - move_ids = [] - self.write(cr, uid, [inv.id], {'move_ids': [(6, 0, move_ids)]}) - for line in inv.inventory_line_id: - pid = line.product_id.id - date = line.date or inv.date - product_context.update(uom=line.product_uom.id, date=date, to_date=date, prodlot_id=line.prod_lot_id.id) - amount = location_obj._product_get(cr, uid, line.location_id.id, [pid], product_context)[pid] - - change = line.product_qty - amount - lot_id = line.prod_lot_id.id - if change: - location_id = line.product_id.product_tmpl_id.property_stock_inventory.id - value = { - 'name': 'INV:' + str(line.inventory_id.id) + ':' + line.inventory_id.name, - 'product_id': line.product_id.id, - 'product_uom': line.product_uom.id, - 'prodlot_id': lot_id, - 'date': date, - 'note': line.note or inv.comments or False, - } - if change > 0: - value.update( { - 'product_qty': change, - 'location_id': location_id, - 'location_dest_id': line.location_id.id, - }) - else: - value.update( { - 'product_qty': -change, - 'location_id': line.location_id.id, - 'location_dest_id': location_id, - }) - move_ids.append(self._inventory_line_hook(cr, uid, line, value)) - message = _('Inventory') + " '" + inv.name + "' "+ _("is done.") - self.log(cr, uid, inv.id, message) - self.write(cr, uid, [inv.id], {'state': 'confirm', 'move_ids': [(6, 0, move_ids)]}) - return res - -stock_inventory() - -class stock_inventory_line(osv.osv): - _inherit = "stock.inventory.line" - - _columns = { - 'date': fields.datetime('Date'), - 'note': fields.text('Notes'), - } - -stock_inventory_line() - -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file diff --git a/stock_inventory_extended/stock_view.xml b/stock_inventory_extended/stock_view.xml deleted file mode 100755 index 57dd7b984..000000000 --- a/stock_inventory_extended/stock_view.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - stock.inventory.form - stock.inventory - form - - 16 - - - - - - - - - - - - - - - - - - - diff --git a/stock_inventory_extended/wizard/__init__.py b/stock_inventory_extended/wizard/__init__.py deleted file mode 100644 index 98caa9231..000000000 --- a/stock_inventory_extended/wizard/__init__.py +++ /dev/null @@ -1,27 +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_fill_inventory -#import stock_inventory_line_split - -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: - diff --git a/stock_inventory_extended/wizard/stock_fill_inventory.py b/stock_inventory_extended/wizard/stock_fill_inventory.py deleted file mode 100644 index 0e143de5e..000000000 --- a/stock_inventory_extended/wizard/stock_fill_inventory.py +++ /dev/null @@ -1,132 +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 -from tools.translate import _ - -class stock_fill_inventory(osv.osv_memory): - _inherit = "stock.fill.inventory" -# _description = "Import Inventory" -# _columns = { -# 'location_id': fields.many2one('stock.location', 'Location', required=True), -# 'recursive': fields.boolean("Include children",help="If checked, products contained in child locations of selected location will be included as well."), -# 'set_stock_zero': fields.boolean("Set to zero",help="If checked, all product quantities will be set to zero to help ensure a real physical inventory is done"), -# } -# def view_init(self, cr, uid, fields_list, context=None): -# """ -# Creates view dynamically and adding fields at runtime. -# @param self: The object pointer. -# @param cr: A database cursor -# @param uid: ID of the user currently logged in -# @param context: A standard dictionary -# @return: New arch of view with new columns. -# """ -# if context is None: -# context = {} -# super(stock_fill_inventory2, self).view_init(cr, uid, fields_list, context=context) -# -# if len(context.get('active_ids',[])) > 1: -# raise osv.except_osv(_('Error!'), _('You cannot perform this operation on more than one Stock Inventories.')) -# -# if context.get('active_id', False): -# stock = self.pool.get('stock.inventory').browse(cr, uid, context.get('active_id', False)) -# -# if stock.state == 'done': -# raise osv.except_osv(_('Warning!'), _('Stock Inventory is already Validated.')) -# return True - - def fill_inventory(self, cr, uid, ids, context=None): - """ To Import stock inventory according to products available in the selected locations. - @param self: The object pointer. - @param cr: A database cursor - @param uid: ID of the user currently logged in - @param ids: the ID or list of IDs if we want more than one - @param context: A standard dictionary - @return: - """ - if context is None: - context = {} - - inventory_line_obj = self.pool.get('stock.inventory.line') - location_obj = self.pool.get('stock.location') - product_obj = self.pool.get('product.product') - move_obj = self.pool.get('stock.move') - - fill_inventory = self.browse(cr, uid, ids[0], context=context) - res = {} - res_location = {} - - if fill_inventory.recursive: - location_ids = location_obj.search(cr, uid, [('location_id', - 'child_of', [fill_inventory.location_id.id])],context=context) - else: - location_ids = [fill_inventory.location_id.id] - - res = {} - flag = False - - for location in location_ids: - datas = {} - res[location] = {} - domain = [('location_dest_id','=',location),('state','=','done')] - active_ids = context.get('active_ids', False) - if active_ids: - date = self.pool.get('stock.inventory').browse(cr, uid, active_ids[0]).date - domain.append(('date','<=',date)) - move_ids = move_obj.search(cr, uid, domain, context=context) - - for move in move_obj.browse(cr, uid, move_ids, context=context): - lot_id = move.prodlot_id.id - prod_id = move.product_id.id - qty = move.product_qty - - if datas.get((prod_id, lot_id)): - qty += datas[(prod_id, lot_id)]['product_qty'] - - datas[(prod_id, lot_id)] = {'product_id': prod_id, 'location_id': location, 'product_qty': qty, 'product_uom': move.product_id.uom_id.id, 'prod_lot_id': lot_id} - - if datas: - flag = True - res[location] = datas - - if not flag: - raise osv.except_osv(_('Warning !'), _('No product in this location.')) - - for stock_move in res.values(): - for stock_move_details in stock_move.values(): - stock_move_details.update({'inventory_id': context['active_ids'][0]}) - domain = [] - - if fill_inventory.set_stock_zero: - stock_move_details.update({'product_qty': 0}) - - for field, value in stock_move_details.items(): - domain.append((field, '=', value)) - line_ids = inventory_line_obj.search(cr, uid, domain, context=context) - - if not line_ids: - inventory_line_obj.create(cr, uid, stock_move_details, context=context) - - return {'type': 'ir.actions.act_window_close'} - -stock_fill_inventory() - -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/stock_inventory_extended/wizard/stock_fill_inventory_view.xml b/stock_inventory_extended/wizard/stock_fill_inventory_view.xml deleted file mode 100644 index 7fd20b284..000000000 --- a/stock_inventory_extended/wizard/stock_fill_inventory_view.xml +++ /dev/null @@ -1,48 +0,0 @@ - - - - - Import Inventory - stock.fill.inventory2 - form - -
- - - - - - - -