From 9fecf393992422ecee262ce956c1aaff2fba0187 Mon Sep 17 00:00:00 2001 From: Lois Rilo Date: Fri, 20 Dec 2019 14:00:53 +0100 Subject: [PATCH] [13.0][MIG] stock_available_unreserved Standard migration. Also some copyrights are removed because they were added by mistake in the fist place (copy+paste issues ;) ) --- stock_available_unreserved/README.rst | 22 ++- stock_available_unreserved/__manifest__.py | 8 +- stock_available_unreserved/models/product.py | 17 +- stock_available_unreserved/models/quant.py | 2 +- .../static/description/index.html | 10 +- .../tests/test_stock_available_unreserved.py | 51 +++--- .../views/product_view.xml | 149 +++++++++--------- .../views/stock_quant_view.xml | 3 +- 8 files changed, 132 insertions(+), 130 deletions(-) diff --git a/stock_available_unreserved/README.rst b/stock_available_unreserved/README.rst index d92271d30..2129fdd74 100644 --- a/stock_available_unreserved/README.rst +++ b/stock_available_unreserved/README.rst @@ -7,20 +7,20 @@ Stock Available Unreserved !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png +.. |badge1| image:: https://img.shields.io/badge/maturity-Production%2FStable-green.png :target: https://odoo-community.org/page/development-status - :alt: Beta + :alt: Production/Stable .. |badge2| image:: https://img.shields.io/badge/licence-LGPL--3-blue.png :target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html :alt: License: LGPL-3 .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fstock--logistics--warehouse-lightgray.png?logo=github - :target: https://github.com/OCA/stock-logistics-warehouse/tree/12.0/stock_available_unreserved + :target: https://github.com/OCA/stock-logistics-warehouse/tree/13.0/stock_available_unreserved :alt: OCA/stock-logistics-warehouse .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png - :target: https://translation.odoo-community.org/projects/stock-logistics-warehouse-12-0/stock-logistics-warehouse-12-0-stock_available_unreserved + :target: https://translation.odoo-community.org/projects/stock-logistics-warehouse-13-0/stock-logistics-warehouse-13-0-stock_available_unreserved :alt: Translate me on Weblate .. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png - :target: https://runbot.odoo-community.org/runbot/153/12.0 + :target: https://runbot.odoo-community.org/runbot/153/13.0 :alt: Try me on Runbot |badge1| |badge2| |badge3| |badge4| |badge5| @@ -47,7 +47,7 @@ Bug Tracker Bugs are tracked on `GitHub Issues `_. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us smashing it by providing a detailed and welcomed -`feedback `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -81,6 +81,14 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use. -This module is part of the `OCA/stock-logistics-warehouse `_ project on GitHub. +.. |maintainer-LoisBForgeFlow| image:: https://github.com/LoisBForgeFlow.png?size=40px + :target: https://github.com/LoisBForgeFlow + :alt: LoisBForgeFlow + +Current `maintainer `__: + +|maintainer-LoisBForgeFlow| + +This module is part of the `OCA/stock-logistics-warehouse `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/stock_available_unreserved/__manifest__.py b/stock_available_unreserved/__manifest__.py index 499e25937..35a00fb6b 100644 --- a/stock_available_unreserved/__manifest__.py +++ b/stock_available_unreserved/__manifest__.py @@ -1,12 +1,14 @@ # Copyright 2018 Camptocamp SA -# Copyright 2016 ACSONE SA/NV () -# Copyright 2016 ForgeFlow S.L. (https://www.forgeflow.com) +# Copyright 2016-19 ForgeFlow S.L. (https://www.forgeflow.com) # License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). + { "name": "Stock Available Unreserved", "summary": "Quantity of stock available for immediate use", - "version": "12.0.1.0.0", + "version": "13.0.1.0.0", "author": "ForgeFlow, Odoo Community Association (OCA)", + "development_status": "Production/Stable", + "maintainers": ["LoisRForgeFlow"], "website": "https://github.com/OCA/stock-logistics-warehouse", "category": "Warehouse Management", "depends": ["stock"], diff --git a/stock_available_unreserved/models/product.py b/stock_available_unreserved/models/product.py index da5428046..3422f6699 100644 --- a/stock_available_unreserved/models/product.py +++ b/stock_available_unreserved/models/product.py @@ -1,29 +1,24 @@ # Copyright 2018 Camptocamp SA -# Copyright 2016 ACSONE SA/NV () -# Copyright 2016 ForgeFlow S.L. (https://www.forgeflow.com) +# Copyright 2016-19 ForgeFlow S.L. (https://www.forgeflow.com) # License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). from odoo import _, api, fields, models from odoo.exceptions import UserError from odoo.tools.float_utils import float_round -from odoo.addons import decimal_precision as dp from odoo.addons.stock.models.product import OPERATORS -UNIT = dp.get_precision("Product Unit of Measure") - class ProductTemplate(models.Model): _inherit = "product.template" qty_available_not_res = fields.Float( string="Quantity On Hand Unreserved", - digits=UNIT, + digits="Product Unit of Measure", compute="_compute_product_available_not_res", search="_search_quantity_unreserved", ) - @api.multi @api.depends("product_variant_ids.qty_available_not_res") def _compute_product_available_not_res(self): for tmpl in self: @@ -33,14 +28,13 @@ class ProductTemplate(models.Model): tmpl.mapped("product_variant_ids.qty_available_not_res") ) - @api.multi def action_open_quants_unreserved(self): products_ids = self.mapped("product_variant_ids").ids quants = self.env["stock.quant"].search([("product_id", "in", products_ids)]) quant_ids = quants.filtered( lambda x: x.product_id.qty_available_not_res > 0 ).ids - result = self.env.ref("stock.product_open_quants").read()[0] + result = self.env.ref("stock.product_template_open_quants").read()[0] result["domain"] = [("id", "in", quant_ids)] result["context"] = { "search_default_locationgroup": 1, @@ -59,19 +53,17 @@ class ProductProduct(models.Model): qty_available_not_res = fields.Float( string="Qty Available Not Reserved", - digits=UNIT, + digits="Product Unit of Measure", compute="_compute_qty_available_not_reserved", search="_search_quantity_unreserved", ) - @api.multi def _prepare_domain_available_not_reserved(self): domain_quant = [("product_id", "in", self.ids)] domain_quant_locations = self._get_domain_locations()[0] domain_quant.extend(domain_quant_locations) return domain_quant - @api.multi def _compute_product_available_not_res_dict(self): res = {} @@ -102,7 +94,6 @@ class ProductProduct(models.Model): res[product.id] = {"qty_available_not_res": available_not_res} return res - @api.multi @api.depends("stock_move_ids.product_qty", "stock_move_ids.state") def _compute_qty_available_not_reserved(self): res = self._compute_product_available_not_res_dict() diff --git a/stock_available_unreserved/models/quant.py b/stock_available_unreserved/models/quant.py index c297c3989..ede236e55 100644 --- a/stock_available_unreserved/models/quant.py +++ b/stock_available_unreserved/models/quant.py @@ -1,5 +1,5 @@ # Copyright 2018 Camptocamp SA -# Copyright 2016 ForgeFlow S.L. (https://www.forgeflow.com) +# Copyright 2016-19 ForgeFlow S.L. (https://www.forgeflow.com) # License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). from odoo import api, fields, models diff --git a/stock_available_unreserved/static/description/index.html b/stock_available_unreserved/static/description/index.html index b6cd7b0b8..08402439c 100644 --- a/stock_available_unreserved/static/description/index.html +++ b/stock_available_unreserved/static/description/index.html @@ -3,7 +3,7 @@ - + Stock Available Unreserved