diff --git a/mrp_subcontracting_bom_dual_use/README.rst b/mrp_subcontracting_bom_dual_use/README.rst index 8fe86358d..61ad64af2 100644 --- a/mrp_subcontracting_bom_dual_use/README.rst +++ b/mrp_subcontracting_bom_dual_use/README.rst @@ -7,7 +7,7 @@ Mrp subcontracting bom dual use !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - !! source digest: sha256:cf72e158a61137dd42e16ae67e841c5960d7359e3cf430a6c7951e6607185476 + !! source digest: sha256:cafff56e6578794b77421691c0fa44a5f4daf8d002566a1eef763b360ec23198 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png @@ -17,13 +17,13 @@ Mrp subcontracting bom dual use :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :alt: License: AGPL-3 .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fmanufacture-lightgray.png?logo=github - :target: https://github.com/OCA/manufacture/tree/14.0/mrp_subcontracting_bom_dual_use + :target: https://github.com/OCA/manufacture/tree/16.0/mrp_subcontracting_bom_dual_use :alt: OCA/manufacture .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png - :target: https://translation.odoo-community.org/projects/manufacture-14-0/manufacture-14-0-mrp_subcontracting_bom_dual_use + :target: https://translation.odoo-community.org/projects/manufacture-16-0/manufacture-16-0-mrp_subcontracting_bom_dual_use :alt: Translate me on Weblate .. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png - :target: https://runboat.odoo-community.org/builds?repo=OCA/manufacture&target_branch=14.0 + :target: https://runboat.odoo-community.org/builds?repo=OCA/manufacture&target_branch=16.0 :alt: Try me on Runboat |badge1| |badge2| |badge3| |badge4| |badge5| @@ -48,7 +48,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 to smash it by providing a detailed and welcomed -`feedback `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -89,6 +89,6 @@ Current `maintainer `__: |maintainer-victoralmau| -This module is part of the `OCA/manufacture `_ project on GitHub. +This module is part of the `OCA/manufacture `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/mrp_subcontracting_bom_dual_use/__manifest__.py b/mrp_subcontracting_bom_dual_use/__manifest__.py index 553f8451a..9a368780a 100644 --- a/mrp_subcontracting_bom_dual_use/__manifest__.py +++ b/mrp_subcontracting_bom_dual_use/__manifest__.py @@ -2,7 +2,7 @@ # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). { "name": "Mrp subcontracting bom dual use", - "version": "14.0.1.1.0", + "version": "16.0.1.0.0", "category": "Manufacturing", "website": "https://github.com/OCA/manufacture", "author": "Tecnativa, Odoo Community Association (OCA)", diff --git a/mrp_subcontracting_bom_dual_use/models/mrp_bom.py b/mrp_subcontracting_bom_dual_use/models/mrp_bom.py index 5dba682ca..906f3617a 100644 --- a/mrp_subcontracting_bom_dual_use/models/mrp_bom.py +++ b/mrp_subcontracting_bom_dual_use/models/mrp_bom.py @@ -1,4 +1,4 @@ -# Copyright 2022 Tecnativa - Víctor Martínez +# Copyright 2022-2024 Tecnativa - Víctor Martínez # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from odoo import api, fields, models @@ -22,17 +22,11 @@ class MrpBom(models.Model): @api.model def _bom_find_domain( - self, - product_tmpl=None, - product=None, - picking_type=None, - company_id=False, - bom_type=False, + self, products, picking_type=None, company_id=False, bom_type=False ): """We need to overwrite the domain to get subcontract boms""" domain = super()._bom_find_domain( - product_tmpl=product_tmpl, - product=product, + products=products, picking_type=picking_type, company_id=company_id, bom_type=bom_type, diff --git a/mrp_subcontracting_bom_dual_use/static/description/index.html b/mrp_subcontracting_bom_dual_use/static/description/index.html index 00af5dcd2..f72d1a3d8 100644 --- a/mrp_subcontracting_bom_dual_use/static/description/index.html +++ b/mrp_subcontracting_bom_dual_use/static/description/index.html @@ -367,9 +367,9 @@ ul.auto-toc { !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -!! source digest: sha256:cf72e158a61137dd42e16ae67e841c5960d7359e3cf430a6c7951e6607185476 +!! source digest: sha256:cafff56e6578794b77421691c0fa44a5f4daf8d002566a1eef763b360ec23198 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

Beta License: AGPL-3 OCA/manufacture Translate me on Weblate Try me on Runboat

+

Beta License: AGPL-3 OCA/manufacture Translate me on Weblate Try me on Runboat

This module allows subcontracting BOMs to be used for regular production orders as well.

Table of contents

@@ -397,7 +397,7 @@ ul.auto-toc {

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 to smash it by providing a detailed and welcomed -feedback.

+feedback.

Do not contact contributors directly about support or help with technical issues.

@@ -427,7 +427,7 @@ mission is to support the collaborative development of Odoo features and promote its widespread use.

Current maintainer:

victoralmau

-

This module is part of the OCA/manufacture project on GitHub.

+

This module is part of the OCA/manufacture project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

diff --git a/mrp_subcontracting_bom_dual_use/tests/test_mrp_subcontracting_bom_dual_use.py b/mrp_subcontracting_bom_dual_use/tests/test_mrp_subcontracting_bom_dual_use.py index 777ace650..b2a9dccf4 100644 --- a/mrp_subcontracting_bom_dual_use/tests/test_mrp_subcontracting_bom_dual_use.py +++ b/mrp_subcontracting_bom_dual_use/tests/test_mrp_subcontracting_bom_dual_use.py @@ -1,9 +1,12 @@ -# Copyright 2022 Tecnativa - Víctor Martínez +# Copyright 2022-2024 Tecnativa - Víctor Martínez # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from odoo.tests import Form, common +from odoo.tests import Form, new_test_user +from odoo.tests.common import users + +from odoo.addons.base.tests.common import BaseCommon -class TestMrpSubcontractingBomDualUse(common.SavepointCase): +class TestMrpSubcontractingBomDualUse(BaseCommon): @classmethod def setUpClass(cls): super().setUpClass() @@ -19,6 +22,11 @@ class TestMrpSubcontractingBomDualUse(common.SavepointCase): cls.component_a = cls.env["product.product"].create({"name": "Test Comp A"}) cls.workcenter = cls.env["mrp.workcenter"].create({"name": "Test workcenter"}) cls.mrp_production_model = cls.env["mrp.production"] + new_test_user( + cls.env, + login="test_mrp_routings_user", + groups="mrp.group_mrp_routings,mrp.group_mrp_manager", + ) def _create_bom(self, bom_type): mrp_bom_form = Form(self.env["mrp.bom"]) @@ -31,9 +39,6 @@ class TestMrpSubcontractingBomDualUse(common.SavepointCase): with mrp_bom_form.bom_line_ids.new() as line_form: line_form.product_id = self.component_a line_form.product_qty = 1 - with mrp_bom_form.operation_ids.new() as operation_form: - operation_form.name = "Test operation" - operation_form.workcenter_id = self.workcenter return mrp_bom_form.save() def test_mrp_production_misc_bom_normal(self): @@ -62,10 +67,17 @@ class TestMrpSubcontractingBomDualUse(common.SavepointCase): replenish = replenish_form.save() replenish.launch_replenishment() + @users("test_mrp_routings_user") def test_product_replenish(self): """We create a bill of materials of subcontract type. We run replenish and validate that the production order has been created with the correct BOM.""" bom = self._create_bom("subcontract") + mrp_bom_form = Form(bom) + with mrp_bom_form.operation_ids.new() as operation_form: + operation_form.name = "Test operation" + operation_form.bom_id = bom + operation_form.workcenter_id = self.workcenter + bom = mrp_bom_form.save() self._product_replenish(self.product, 1) item = self.mrp_production_model.search([("product_id", "=", self.product.id)]) self.assertEqual(item.bom_id, bom)