From cd7da198fdd23b1a61efd3ce452debc044f16f22 Mon Sep 17 00:00:00 2001 From: "Pedro M. Baeza" Date: Sun, 9 Oct 2022 01:24:43 +0200 Subject: [PATCH] [MIG] stock_request_mrp: Migration to 14.0 --- stock_request_mrp/README.rst | 13 ++++--- stock_request_mrp/__manifest__.py | 3 +- stock_request_mrp/models/mrp_production.py | 13 ++++--- stock_request_mrp/models/stock_request.py | 4 +- .../models/stock_request_order.py | 4 +- stock_request_mrp/readme/CONTRIBUTORS.rst | 3 ++ .../static/description/index.html | 12 ++++-- .../tests/test_stock_request_mrp.py | 39 ++++--------------- 8 files changed, 43 insertions(+), 48 deletions(-) diff --git a/stock_request_mrp/README.rst b/stock_request_mrp/README.rst index 3ca40cef5..2ca989e53 100644 --- a/stock_request_mrp/README.rst +++ b/stock_request_mrp/README.rst @@ -14,13 +14,13 @@ Stock Request MRP :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/13.0/stock_request_mrp + :target: https://github.com/OCA/stock-logistics-warehouse/tree/14.0/stock_request_mrp :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-13-0/stock-logistics-warehouse-13-0-stock_request_mrp + :target: https://translation.odoo-community.org/projects/stock-logistics-warehouse-14-0/stock-logistics-warehouse-14-0-stock_request_mrp :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/13.0 + :target: https://runbot.odoo-community.org/runbot/153/14.0 :alt: Try me on Runbot |badge1| |badge2| |badge3| |badge4| |badge5| @@ -52,7 +52,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. @@ -68,6 +68,9 @@ Contributors ~~~~~~~~~~~~ * Héctor Villarreal . +* `Tecnativa `__: + + * Pedro M. Baeza Maintainers ~~~~~~~~~~~ @@ -82,6 +85,6 @@ 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. +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_request_mrp/__manifest__.py b/stock_request_mrp/__manifest__.py index 39d50aa0d..6daaef145 100644 --- a/stock_request_mrp/__manifest__.py +++ b/stock_request_mrp/__manifest__.py @@ -1,10 +1,11 @@ # Copyright 2017-20 ForgeFlow S.L. (https://www.forgeflow.com) +# Copyright 2022 Tecnativa - Pedro M. Baeza # License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). { "name": "Stock Request MRP", "summary": "Manufacturing request for stock", - "version": "13.0.1.0.0", + "version": "14.0.1.0.0", "license": "LGPL-3", "website": "https://github.com/OCA/stock-logistics-warehouse", "author": "ForgeFlow, Odoo Community Association (OCA)", diff --git a/stock_request_mrp/models/mrp_production.py b/stock_request_mrp/models/mrp_production.py index c2ab9249c..30756b621 100644 --- a/stock_request_mrp/models/mrp_production.py +++ b/stock_request_mrp/models/mrp_production.py @@ -1,4 +1,5 @@ # Copyright 2020 ForgeFlow S.L. (https://www.forgeflow.com) +# Copyright 2022 Tecnativa - Pedro M. Baeza # License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). from odoo import api, fields, models @@ -27,8 +28,9 @@ class MrpProduction(models.Model): """ :return dict: dictionary value for created view """ - action = self.env.ref("stock_request.action_stock_request_form").read()[0] - + action = self.env["ir.actions.act_window"]._for_xml_id( + "stock_request.action_stock_request_form" + ) requests = self.mapped("stock_request_ids") if len(requests) > 1: action["domain"] = [("id", "in", requests.ids)] @@ -39,7 +41,7 @@ class MrpProduction(models.Model): action["res_id"] = requests.id return action - def _get_finished_move_value( + def _get_move_finished_values( self, product_id, product_uom_qty, @@ -47,7 +49,8 @@ class MrpProduction(models.Model): operation_id=False, byproduct_id=False, ): - res = super()._get_finished_move_value( + """Inject stock request allocations when creating the finished move.""" + res = super()._get_move_finished_values( product_id, product_uom_qty, product_uom, @@ -61,7 +64,7 @@ class MrpProduction(models.Model): 0, { "stock_request_id": request.id, - "requested_product_uom_qty": request.product_qty, + "requested_product_uom_qty": product_uom_qty, }, ) for request in self.stock_request_ids diff --git a/stock_request_mrp/models/stock_request.py b/stock_request_mrp/models/stock_request.py index 3d7e483c9..0bd3794ee 100644 --- a/stock_request_mrp/models/stock_request.py +++ b/stock_request_mrp/models/stock_request.py @@ -44,7 +44,9 @@ class StockRequest(models.Model): ) def action_view_mrp_production(self): - action = self.env.ref("mrp.mrp_production_action").read()[0] + action = self.env["ir.actions.act_window"]._for_xml_id( + "mrp.mrp_production_action" + ) productions = self.mapped("production_ids") if len(productions) > 1: action["domain"] = [("id", "in", productions.ids)] diff --git a/stock_request_mrp/models/stock_request_order.py b/stock_request_mrp/models/stock_request_order.py index 5ad225c09..77414631e 100644 --- a/stock_request_mrp/models/stock_request_order.py +++ b/stock_request_mrp/models/stock_request_order.py @@ -26,7 +26,9 @@ class StockRequestOrder(models.Model): req.production_count = len(req.production_ids) def action_view_mrp_production(self): - action = self.env.ref("mrp.mrp_production_action").read()[0] + action = self.env["ir.actions.act_window"]._for_xml_id( + "mrp.mrp_production_action" + ) productions = self.mapped("production_ids") if len(productions) > 1: action["domain"] = [("id", "in", productions.ids)] diff --git a/stock_request_mrp/readme/CONTRIBUTORS.rst b/stock_request_mrp/readme/CONTRIBUTORS.rst index 45e6392e8..2bedbdf60 100644 --- a/stock_request_mrp/readme/CONTRIBUTORS.rst +++ b/stock_request_mrp/readme/CONTRIBUTORS.rst @@ -1 +1,4 @@ * Héctor Villarreal . +* `Tecnativa `__: + + * Pedro M. Baeza diff --git a/stock_request_mrp/static/description/index.html b/stock_request_mrp/static/description/index.html index 68f178877..d92955bab 100644 --- a/stock_request_mrp/static/description/index.html +++ b/stock_request_mrp/static/description/index.html @@ -3,7 +3,7 @@ - + Stock Request MRP