diff --git a/stock_available_unreserved/README.rst b/stock_available_unreserved/README.rst index dcf69d808..dbaebc69e 100644 --- a/stock_available_unreserved/README.rst +++ b/stock_available_unreserved/README.rst @@ -23,7 +23,7 @@ Usage .. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas :alt: Try me on Runbot - :target: https://runbot.odoo-community.org/runbot/153/9.0 + :target: https://runbot.odoo-community.org/runbot/153/10.0 Bug Tracker @@ -46,6 +46,7 @@ Contributors ------------ * Jordi Ballester Alomar +* Stefan Rijnhart Maintainer diff --git a/stock_available_unreserved/__openerp__.py b/stock_available_unreserved/__manifest__.py similarity index 88% rename from stock_available_unreserved/__openerp__.py rename to stock_available_unreserved/__manifest__.py index f2b1189bd..c43c438fe 100644 --- a/stock_available_unreserved/__openerp__.py +++ b/stock_available_unreserved/__manifest__.py @@ -5,8 +5,8 @@ # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). { "name": "Stock Available Unreserved", - "summary": "Quantity of stock available for inmediate use", - "version": "9.0.1.0.0", + "summary": "Quantity of stock available for immediate use", + "version": "10.0.1.0.0", "author": "Eficent Business and IT Consulting Services S.L," "Odoo Community Association (OCA)", "website": "https://www.odoo-community.org", diff --git a/stock_available_unreserved/models/product.py b/stock_available_unreserved/models/product.py index 74e2a087c..d638215ad 100644 --- a/stock_available_unreserved/models/product.py +++ b/stock_available_unreserved/models/product.py @@ -4,9 +4,9 @@ # (http://www.eficent.com) # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). -from openerp import api, fields, models, _ -from openerp.tools.float_utils import float_round -from openerp.addons import decimal_precision as dp +from odoo import api, fields, models, _ +from odoo.tools.float_utils import float_round +from odoo.addons import decimal_precision as dp UNIT = dp.get_precision('Product Unit of Measure') @@ -38,9 +38,7 @@ class ProductTemplate(models.Model): prod_available = super(ProductTemplate, self)._product_available(name, arg) - variants = self.env['product.product'] - for product in self: - variants += product.product_variant_ids + variants = self.mapped('product_variant_ids') variant_available = variants._product_available() for product in self: @@ -60,8 +58,8 @@ class ProductTemplate(models.Model): @api.multi def action_open_quants_unreserved(self): - products = self._get_products() - result = self._get_act_window_dict('stock.product_open_quants') + products = self.mapped('product_variant_ids').ids + result = self.env.ref('stock.product_open_quants').read()[0] result['domain'] = "[('product_id','in',[" + ','.join( map(str, products)) + "]), ('reservation_id', '=', False)]" result[ @@ -93,7 +91,7 @@ class ProductProduct(models.Model): def _prepare_domain_available_not_res(self, products): domain_products = [('product_id', 'in', products.mapped('id'))] domain_quant = [] - domain_quant_loc, _, _ = products._get_domain_locations() + domain_quant_loc = products._get_domain_locations()[0] domain_quant += domain_products diff --git a/stock_available_unreserved/tests/test_stock_available_unreserved.py b/stock_available_unreserved/tests/test_stock_available_unreserved.py index e440e4a1b..f0ef3b932 100644 --- a/stock_available_unreserved/tests/test_stock_available_unreserved.py +++ b/stock_available_unreserved/tests/test_stock_available_unreserved.py @@ -5,7 +5,7 @@ # Copyright 2016 Therp BV # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). -from openerp.tests.common import TransactionCase +from odoo.tests.common import TransactionCase class TestStockLogisticsWarehouse(TransactionCase): @@ -134,3 +134,5 @@ class TestStockLogisticsWarehouse(TransactionCase): pickingOutA.action_done() compare_qty_available_not_res(productB, 1) compare_qty_available_not_res(templateAB, 3) + + templateAB.action_open_quants_unreserved() diff --git a/stock_available_unreserved/views/product_view.xml b/stock_available_unreserved/views/product_view.xml index bc2a0c08d..d452199d3 100644 --- a/stock_available_unreserved/views/product_view.xml +++ b/stock_available_unreserved/views/product_view.xml @@ -1,6 +1,5 @@ - - + @@ -74,5 +73,4 @@ - - + diff --git a/stock_available_unreserved/views/stock_quant_view.xml b/stock_available_unreserved/views/stock_quant_view.xml index 4a6b56ac4..8d4b42895 100644 --- a/stock_available_unreserved/views/stock_quant_view.xml +++ b/stock_available_unreserved/views/stock_quant_view.xml @@ -1,6 +1,5 @@ - - + stock.quant.search @@ -27,5 +26,4 @@ stock.quant - - +