diff --git a/stock_warehouse_orderpoint_stock_info_unreserved/README.rst b/stock_warehouse_orderpoint_stock_info_unreserved/README.rst index 8a6e23476..9c059fb9f 100644 --- a/stock_warehouse_orderpoint_stock_info_unreserved/README.rst +++ b/stock_warehouse_orderpoint_stock_info_unreserved/README.rst @@ -2,9 +2,9 @@ :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :alt: License: AGPL-3 -====================================== -Reordering Rules stock info unreserved -====================================== +================================================ +Stock Warehouse Orderpoint Stock Info Unreserved +================================================ This modules allows to display the availability of stock on hand and unreserved on a reordering rule. @@ -14,7 +14,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 =========== @@ -29,12 +29,16 @@ feedback. Credits ======= +Images +------ + +* Odoo Community Association: `Icon `_. + Contributors ------------ * Jordi Ballester Alomar - Maintainer ---------- diff --git a/stock_warehouse_orderpoint_stock_info_unreserved/__openerp__.py b/stock_warehouse_orderpoint_stock_info_unreserved/__manifest__.py similarity index 76% rename from stock_warehouse_orderpoint_stock_info_unreserved/__openerp__.py rename to stock_warehouse_orderpoint_stock_info_unreserved/__manifest__.py index 0e053289f..eff397007 100644 --- a/stock_warehouse_orderpoint_stock_info_unreserved/__openerp__.py +++ b/stock_warehouse_orderpoint_stock_info_unreserved/__manifest__.py @@ -3,15 +3,15 @@ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). { - "name": "Reordering rules stock info unreserved", - "version": "9.0.1.0.0", + "name": "Stock Warehouse Orderpoint Stock Info Unreserved", + "version": "10.0.1.0.0", "depends": [ "stock_warehouse_orderpoint_stock_info", "stock_available_unreserved" ], "author": "Eficent, " "Odoo Community Association (OCA)", - "website": "http://www.eficent.com", + "website": "https://github.com/OCA/stock-logistics-warehouse", "category": "Warehouse", "license": "AGPL-3", "data": [ diff --git a/stock_warehouse_orderpoint_stock_info_unreserved/models/stock_warehouse_orderpoint.py b/stock_warehouse_orderpoint_stock_info_unreserved/models/stock_warehouse_orderpoint.py index 6739d8f37..47d704052 100644 --- a/stock_warehouse_orderpoint_stock_info_unreserved/models/stock_warehouse_orderpoint.py +++ b/stock_warehouse_orderpoint_stock_info_unreserved/models/stock_warehouse_orderpoint.py @@ -2,7 +2,8 @@ # Copyright 2016 Eficent Business and IT Consulting Services, S.L. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from openerp import models, fields, api +from odoo import api, fields, models +from collections import defaultdict class StockWarehouseOrderpoint(models.Model): @@ -11,12 +12,16 @@ class StockWarehouseOrderpoint(models.Model): @api.multi def _compute_product_available_qty(self): super(StockWarehouseOrderpoint, self)._compute_product_available_qty() - for rec in self: - product_available = rec.product_id.with_context( - location=rec.location_id.id - )._product_available()[rec.product_id.id] - rec.product_location_qty_available_not_res = \ - product_available['qty_available_not_res'] + op_by_loc = defaultdict(lambda: self.env['stock.warehouse.orderpoint']) + for order in self: + op_by_loc[order.location_id] |= order + for location_id, order_in_loc in op_by_loc.items(): + products = order_in_loc.mapped('product_id').with_context( + location=location_id.id)._compute_qty_available_not_res() + for order in order_in_loc: + product = products[order.product_id.id] + order.product_location_qty_available_not_res = \ + product['qty_available_not_res'] product_location_qty_available_not_res = fields.Float( string='Quantity On Location (Unreserved)', diff --git a/stock_warehouse_orderpoint_stock_info_unreserved/static/description/icon.png b/stock_warehouse_orderpoint_stock_info_unreserved/static/description/icon.png new file mode 100644 index 000000000..3a0328b51 Binary files /dev/null and b/stock_warehouse_orderpoint_stock_info_unreserved/static/description/icon.png differ diff --git a/stock_warehouse_orderpoint_stock_info_unreserved/tests/test_stock_warehouse_orderpoint.py b/stock_warehouse_orderpoint_stock_info_unreserved/tests/test_stock_warehouse_orderpoint.py index d2edc8f95..41450062f 100644 --- a/stock_warehouse_orderpoint_stock_info_unreserved/tests/test_stock_warehouse_orderpoint.py +++ b/stock_warehouse_orderpoint_stock_info_unreserved/tests/test_stock_warehouse_orderpoint.py @@ -2,10 +2,10 @@ # Copyright 2016 Eficent Business and IT Consulting Services, S.L. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from openerp.tests import common +from odoo.tests.common import TransactionCase -class TestStockWarehouseOrderpoint(common.TransactionCase): +class TestStockWarehouseOrderpoint(TransactionCase): def setUp(self): super(TestStockWarehouseOrderpoint, self).setUp() diff --git a/stock_warehouse_orderpoint_stock_info_unreserved/views/stock_warehouse_orderpoint_view.xml b/stock_warehouse_orderpoint_stock_info_unreserved/views/stock_warehouse_orderpoint_view.xml index 2b7c27b7c..fe47abd70 100644 --- a/stock_warehouse_orderpoint_stock_info_unreserved/views/stock_warehouse_orderpoint_view.xml +++ b/stock_warehouse_orderpoint_stock_info_unreserved/views/stock_warehouse_orderpoint_view.xml @@ -1,6 +1,5 @@ - - + stock.warehouse.orderpoint.tree stock.warehouse.orderpoint @@ -24,6 +23,4 @@ - - - +