← Back to team overview

openerp-community-reviewer team mailing list archive

lp:~camptocamp/stock-logistic-flows/7.0-add_and_update_stock_filter_none_zero_qty_addon into lp:stock-logistic-flows/7.0

 

Romain Deheele - Camptocamp has proposed merging lp:~camptocamp/stock-logistic-flows/7.0-add_and_update_stock_filter_none_zero_qty_addon into lp:stock-logistic-flows/7.0.

Requested reviews:
  Stock and Logistic Core Editors (stock-logistic-core-editors)

For more details, see:
https://code.launchpad.net/~camptocamp/stock-logistic-flows/7.0-add_and_update_stock_filter_none_zero_qty_addon/+merge/189835

Hello,

This branch :
- adds stock_filter_none_zero_qty addon from https://code.launchpad.net/~julius-network-solutions/julius-openobject-addons/7.0
- uses this new filter none_zero_qty in context on stock.location's button "More>Products" (via action window)

Best Regards,

Romain

-- 
https://code.launchpad.net/~camptocamp/stock-logistic-flows/7.0-add_and_update_stock_filter_none_zero_qty_addon/+merge/189835
Your team Stock and Logistic Core Editors is requested to review the proposed merge of lp:~camptocamp/stock-logistic-flows/7.0-add_and_update_stock_filter_none_zero_qty_addon into lp:stock-logistic-flows/7.0.
=== added directory 'stock_filter_none_zero_qty'
=== added file 'stock_filter_none_zero_qty/__init__.py'
--- stock_filter_none_zero_qty/__init__.py	1970-01-01 00:00:00 +0000
+++ stock_filter_none_zero_qty/__init__.py	2013-10-08 12:59:26 +0000
@@ -0,0 +1,24 @@
+# -*- coding: utf-8 -*-
+###############################################################################~!!~~!!!
+#
+# Copyright (c) 2010-2012, OPENTIA Group (<http://opentia.com>)
+# The word "OPENTIA" is an European Community Trademark property of the Opentia Group
+#
+# @author: Opentia "Happy Hacking" Team
+# @e-mail: consultoria@opentia·es
+#
+#    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/>.
+###############################################################################~!!~~!!!
+
+import product

=== added file 'stock_filter_none_zero_qty/__openerp__.py'
--- stock_filter_none_zero_qty/__openerp__.py	1970-01-01 00:00:00 +0000
+++ stock_filter_none_zero_qty/__openerp__.py	2013-10-08 12:59:26 +0000
@@ -0,0 +1,55 @@
+# -*- coding: utf-8 -*-
+###############################################################################~!!~~!!!
+#
+# Copyright (c) 2010-2012, OPENTIA Group (<http://opentia.com>)
+# The word "OPENTIA" is an European Community Trademark property of the Opentia Group
+#
+# @author: Opentia "Happy Hacking" Team
+# @e-mail: consultoria@opentia·es
+# 
+#    This module is an improvement of the module "zero_stock_filter"
+#    This is base on this module and improved by Julius Network Solutions
+#
+#    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/>.
+###############################################################################~!!~~!!!
+{
+    'name' : 'Filter products in stock',
+    'description' : '''
+       · Adds a "Stock" button to product's search view to show
+         stockable products with and without stock availability
+       · By default, only products with stock are shown (i.e.
+         button is enabled)
+       . This filter is applied on products view located in Warehouse menu.
+       . Adds this filter from a location on button "More>Products" (via action window)
+    
+    This is an improvement of the module "zero_stock_filter" developed by OPENTIA, but this is filtering on real quantity for version 6.1
+    It has been migrated to the 7.0 version (2013-04-30)
+    ''',
+    'version' : '1.0',
+    'depends' : [
+        "stock",
+        "product",
+    ],
+    'category': 'Warehouse',
+    'author' : 'OPENTIA,Julius Network Solutions',
+    'website': 'http://www.opentia.com/,http://www.julius.fr/',
+    'demo': [],
+    'data': [
+        'product_view.xml',
+    ],
+    'installable' : True,
+    'active' : False,
+}
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+

=== added directory 'stock_filter_none_zero_qty/i18n'
=== added file 'stock_filter_none_zero_qty/i18n/fr.mo'
Binary files stock_filter_none_zero_qty/i18n/fr.mo	1970-01-01 00:00:00 +0000 and stock_filter_none_zero_qty/i18n/fr.mo	2013-10-08 12:59:26 +0000 differ
=== added file 'stock_filter_none_zero_qty/i18n/fr.po'
--- stock_filter_none_zero_qty/i18n/fr.po	1970-01-01 00:00:00 +0000
+++ stock_filter_none_zero_qty/i18n/fr.po	2013-10-08 12:59:26 +0000
@@ -0,0 +1,39 @@
+# Translation of OpenERP Server.
+# This file contains the translation of the following modules:
+#	* stock_filter_none_zero_qty
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: OpenERP Server 7.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2013-05-07 13:13+0000\n"
+"PO-Revision-Date: 2013-05-07 15:25+0100\n"
+"Last-Translator: Yvan <yvan@xxxxxxxxx>\n"
+"Language-Team: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: \n"
+
+#. module: stock_filter_none_zero_qty
+#: code:addons/stock_filter_none_zero_qty/product.py:55
+#, python-format
+msgid "Operator %s not suported in searches for qty_available (product.product)."
+msgstr "L'opérateur %s n'est pas supporté dans les recherches sur 'qty_available' (product.product)."
+
+#. module: stock_filter_none_zero_qty
+#: model:ir.model,name:stock_filter_none_zero_qty.model_product_product
+msgid "Product"
+msgstr "Produit"
+
+#. module: stock_filter_none_zero_qty
+#: code:addons/stock_filter_none_zero_qty/product.py:55
+#, python-format
+msgid "Error !"
+msgstr "Erreur !"
+
+#. module: stock_filter_none_zero_qty
+#: view:product.product:0
+msgid "Real Stock"
+msgstr "Stock Reel"
+

=== added file 'stock_filter_none_zero_qty/product.py'
--- stock_filter_none_zero_qty/product.py	1970-01-01 00:00:00 +0000
+++ stock_filter_none_zero_qty/product.py	2013-10-08 12:59:26 +0000
@@ -0,0 +1,80 @@
+# -*- coding: utf-8 -*-
+###############################################################################~!!~~!!!
+#
+# Copyright (c) 2010-2012, OPENTIA Group (<http://opentia.com>)
+# The word "OPENTIA" is an European Community Trademark property of the Opentia Group
+#
+# @author: Opentia "Happy Hacking" Team
+# @e-mail: consultoria@opentia·es
+# 
+#    This module is an improvement of the module "zero_stock_filter"
+#    This is base on this module and improved by Julius Network Solutions
+#
+#
+#    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/>.
+###############################################################################~!!~~!!!
+from osv import fields,orm
+from tools.translate import _
+import decimal_precision as dp
+
+class product_product(orm.Model):
+    _inherit = "product.product"
+
+#    def _get_product_available_func(states, what):
+#        def _product_available(self, cr, uid, ids, name, arg, context=None):
+#            return {}.fromkeys(ids, 0.0)
+#        return _product_available
+#    
+#    _product_qty_available = _get_product_available_func(('done',), ('in', 'out'))
+#    _product_virtual_available = _get_product_available_func(('confirmed','waiting','assigned','done'), ('in', 'out'))
+
+    def _product_available(self, cr, uid, ids, field_names=None, arg=False, context=None):
+        return super(product_product,self)._product_available(cr, uid, ids, field_names=field_names, arg=arg, context=context)
+
+    def _qty_available_search(self, cr, uid, obj, name, args, context=None):
+        ops = ['>',]
+        prod_ids = ()
+        if not len(args):
+            return []
+        prod_ids = []
+        for a in args:
+            operator = a[1]
+            value = a[2]
+            if not operator in ops:
+                raise osv.except_osv(_('Error !'), _('Operator %s not suported in searches for qty_available (product.product).' % operator))
+            if operator == '>':
+                todos = self.search(cr, uid, [], context=context)
+                ids = self.read(cr, uid, todos, ['qty_available'], context=context)
+                for d in ids:
+                    if d['qty_available'] > 0:
+                        prod_ids.append(d['id'])
+        return [('id','in',tuple(prod_ids))]
+
+    _columns = {
+        'qty_available': fields.function(_product_available, fnct_search=_qty_available_search, method=True, 
+            multi='qty_available',
+            type='float',  digits_compute=dp.get_precision('Product Unit of Measure'),
+            string='Quantity On Hand',
+            help="Current quantity of products.\n"
+                 "In a context with a single Stock Location, this includes "
+                 "goods stored at this Location, or any of its children.\n"
+                 "In a context with a single Warehouse, this includes "
+                 "goods stored in the Stock Location of this Warehouse, or any "
+                 "of its children.\n"
+                 "In a context with a single Shop, this includes goods "
+                 "stored in the Stock Location of the Warehouse of this Shop, "
+                 "or any of its children.\n"
+                 "Otherwise, this includes goods stored in any Stock Location "
+                 "with 'internal' type."),
+    }

=== added file 'stock_filter_none_zero_qty/product_view.xml'
--- stock_filter_none_zero_qty/product_view.xml	1970-01-01 00:00:00 +0000
+++ stock_filter_none_zero_qty/product_view.xml	2013-10-08 12:59:26 +0000
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+    <data>
+        <record id="product_search_form_view_zero_stock" model="ir.ui.view">
+            <field name="name">product.search.form</field>
+            <field name="model">product.product</field>
+            <field name="priority">17</field>
+            <field name="inherit_id" ref="product.product_search_form_view"/>
+            <field name="arch" type="xml">
+                <field name="name" position="before">
+                    <filter name="qty_stock" string="Real Stock" icon="terp-accessories-archiver" domain="[('qty_available','&gt;',0)]"/>
+                </field>
+            </field>
+        </record>
+        <record id="product.product_normal_action" model="ir.actions.act_window">
+            <field name="name">Products</field>
+            <field name="type">ir.actions.act_window</field>
+            <field name="res_model">product.product</field>
+            <field name="view_type">form</field>
+            <field name="view_id" ref="product.product_product_tree_view"/>
+            <field name="search_view_id" ref="product.product_search_form_view"/>
+            <field name="context">{'search_default_qty_stock':1, }</field>
+            <field name="help">You must define a Product for everything you buy or sell. Products can be raw materials, stockable products, consumables or services. The Product form contains detailed information about your products related to procurement logistics, sales price, product category, suppliers and so on.</field>
+        </record>
+
+        <act_window
+            context="{'location': active_id, 'search_default_qty_stock':1}"
+            domain="[('type','&lt;&gt;','service')]"
+            id="stock.act_product_location_open"
+            name="Products"
+            res_model="product.product"
+            src_model="stock.location"/>
+
+    </data>
+</openerp>
+


Follow ups