diff --git a/mrp_helper/README.rst b/mrp_helper/README.rst new file mode 100644 index 00000000000..b2edac0fbaa --- /dev/null +++ b/mrp_helper/README.rst @@ -0,0 +1,84 @@ +========== +MRP Helper +========== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:237ce04ef9ed50d9476fd834b807818343a4f5881ff19ddaa819d4d4a99f4a01 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |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%2Fmanufacture-lightgray.png?logo=github + :target: https://github.com/OCA/manufacture/tree/14.0/mrp_helper + :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_helper + :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 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +Add methods shared between various mrp modules + +**Table of contents** + +.. contents:: + :local: + +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 `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* MT Software + +Contributors +~~~~~~~~~~~~ + +* Michael Tietz (MT Software) + +Maintainers +~~~~~~~~~~~ + +This module is maintained by the OCA. + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +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. + +.. |maintainer-mt-software-de| image:: https://github.com/mt-software-de.png?size=40px + :target: https://github.com/mt-software-de + :alt: mt-software-de + +Current `maintainer `__: + +|maintainer-mt-software-de| + +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_helper/__init__.py b/mrp_helper/__init__.py new file mode 100644 index 00000000000..0650744f6bc --- /dev/null +++ b/mrp_helper/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/mrp_helper/__manifest__.py b/mrp_helper/__manifest__.py new file mode 100644 index 00000000000..8c103d86bdd --- /dev/null +++ b/mrp_helper/__manifest__.py @@ -0,0 +1,14 @@ +# # Copyright 2023 Michael Tietz (MT Software) +# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl). +{ + "name": "MRP Helper", + "summary": "Add methods shared between various mrp modules", + "version": "14.0.1.0.0", + "category": "Manufacture", + "website": "https://github.com/OCA/manufacture", + "author": "MT Software, Odoo Community Association (OCA)", + "license": "LGPL-3", + "depends": ["mrp"], + "data": [], + "maintainers": ["mt-software-de"], +} diff --git a/mrp_helper/models/__init__.py b/mrp_helper/models/__init__.py new file mode 100644 index 00000000000..a352efe9bc5 --- /dev/null +++ b/mrp_helper/models/__init__.py @@ -0,0 +1 @@ +from . import mrp_bom diff --git a/mrp_helper/models/mrp_bom.py b/mrp_helper/models/mrp_bom.py new file mode 100644 index 00000000000..3bbe92cf7cf --- /dev/null +++ b/mrp_helper/models/mrp_bom.py @@ -0,0 +1,13 @@ +# Copyright 2023 Michael Tietz (MT Software) +# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl). +from odoo import api, models + + +class MrpBom(models.Model): + _inherit = "mrp.bom" + + @api.model + def _bom_find(self, *args, **kwargs): + if self.env.context.get("ignore_bom_find"): + return self.env["mrp.bom"] + return super()._bom_find(*args, **kwargs) diff --git a/mrp_helper/readme/CONTRIBUTORS.rst b/mrp_helper/readme/CONTRIBUTORS.rst new file mode 100644 index 00000000000..446fd1d5769 --- /dev/null +++ b/mrp_helper/readme/CONTRIBUTORS.rst @@ -0,0 +1 @@ +* Michael Tietz (MT Software) diff --git a/mrp_helper/readme/DESCRIPTION.rst b/mrp_helper/readme/DESCRIPTION.rst new file mode 100644 index 00000000000..f3ea02924ad --- /dev/null +++ b/mrp_helper/readme/DESCRIPTION.rst @@ -0,0 +1 @@ +Add methods shared between various mrp modules diff --git a/mrp_helper/static/description/index.html b/mrp_helper/static/description/index.html new file mode 100644 index 00000000000..36bf475020d --- /dev/null +++ b/mrp_helper/static/description/index.html @@ -0,0 +1,423 @@ + + + + + + +MRP Helper + + + +
+

MRP Helper

+ + +

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

+

Add methods shared between various mrp modules

+

Table of contents

+ +
+

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.

+

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

+
+
+

Credits

+
+

Authors

+
    +
  • MT Software
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

This module is maintained by the OCA.

+Odoo Community Association +

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.

+

Current maintainer:

+

mt-software-de

+

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_helper/tests/__init__.py b/mrp_helper/tests/__init__.py new file mode 100644 index 00000000000..0907ccdbd83 --- /dev/null +++ b/mrp_helper/tests/__init__.py @@ -0,0 +1 @@ +from . import test_mrp_bom_find diff --git a/mrp_helper/tests/test_mrp_bom_find.py b/mrp_helper/tests/test_mrp_bom_find.py new file mode 100644 index 00000000000..0ba8a925153 --- /dev/null +++ b/mrp_helper/tests/test_mrp_bom_find.py @@ -0,0 +1,16 @@ +# Copyright 2023 Michael Tietz (MT Software) +from odoo.addons.mrp.tests.common import TestMrpCommon + + +class MrpBomFind(TestMrpCommon): + def test_bom_find(self): + product = self.bom_1.product_id + bom = self.env["mrp.bom"]._bom_find(product=product) + self.assertEqual(bom, self.bom_1) + + bom = ( + self.env["mrp.bom"] + .with_context(ignore_bom_find=True) + ._bom_find(product=product) + ) + self.assertFalse(bom) diff --git a/setup/mrp_helper/odoo/addons/mrp_helper b/setup/mrp_helper/odoo/addons/mrp_helper new file mode 120000 index 00000000000..4f365a666a1 --- /dev/null +++ b/setup/mrp_helper/odoo/addons/mrp_helper @@ -0,0 +1 @@ +../../../../mrp_helper \ No newline at end of file diff --git a/setup/mrp_helper/setup.py b/setup/mrp_helper/setup.py new file mode 100644 index 00000000000..28c57bb6403 --- /dev/null +++ b/setup/mrp_helper/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +)