diff --git a/mrp_product_characterisation/README.rst b/mrp_product_characterisation/README.rst new file mode 100644 index 000000000..cfa555cf8 --- /dev/null +++ b/mrp_product_characterisation/README.rst @@ -0,0 +1,85 @@ +============================ +MRP Product Characterisation +============================ + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:b585ec95c2b4eaec64e8d2412f583b1715e3ddc61c1572ebdf7933d6ea3d097f + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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-AGPL--3-blue.png + :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/16.0/mrp_product_characterisation + :alt: OCA/manufacture +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/manufacture-16-0/manufacture-16-0-mrp_product_characterisation + :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=16.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +Adds characterisation "Intermediate Products" and adjust Components characterisation for Products. +Adds BoM filter with theses characterisations. + +Intermediate products : contained in a BoM AND manufactured (has a BoM) +Component products : contained in a BoM AND NOT manufactured (has no BoM) + +For example in bakeries, leavening is a intermediate product, and buckwheat flour +a component product. + +.. figure:: https://raw.githubusercontent.com/OCA/manufacture/16.0/mrp_product_characterisation/static/description/intermediate_product.png + +**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 +~~~~~~~ + +* GRAP + +Contributors +~~~~~~~~~~~~ + +* Quentin Dupont (quentin.dupont@grap.coop) + +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. + +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_product_characterisation/__init__.py b/mrp_product_characterisation/__init__.py new file mode 100644 index 000000000..0650744f6 --- /dev/null +++ b/mrp_product_characterisation/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/mrp_product_characterisation/__manifest__.py b/mrp_product_characterisation/__manifest__.py new file mode 100644 index 000000000..37b68647a --- /dev/null +++ b/mrp_product_characterisation/__manifest__.py @@ -0,0 +1,22 @@ +# Copyright (C) 2022 - Today: GRAP (http://www.grap.coop) +# @author: Quentin Dupont (quentin.dupont@grap.coop) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +{ + "name": "MRP Product Characterisation", + "summary": "Adds product characterisation 'Intermediate Products'.", + "version": "16.0.1.0.0", + "category": "Manufacturing", + "author": "GRAP, Odoo Community Association (OCA)", + "website": "https://github.com/OCA/manufacture", + "license": "AGPL-3", + "depends": [ + "mrp", + ], + "data": [ + "views/view_mrp_bom.xml", + "views/view_product_product.xml", + "views/view_product_template.xml", + ], + "installable": True, +} diff --git a/mrp_product_characterisation/i18n/fr.po b/mrp_product_characterisation/i18n/fr.po new file mode 100644 index 000000000..8792719b4 --- /dev/null +++ b/mrp_product_characterisation/i18n/fr.po @@ -0,0 +1,82 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * mrp_product_characterisation +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-07-25 15:04+0000\n" +"PO-Revision-Date: 2024-07-25 15:04+0000\n" +"Last-Translator: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: mrp_product_characterisation +#: model_terms:ir.ui.view,arch_db:mrp_product_characterisation.view_mrp_bom_search +msgid "BoM for finished product" +msgstr "Fiche technique pour produit fini" + +#. module: mrp_product_characterisation +#: model_terms:ir.ui.view,arch_db:mrp_product_characterisation.view_mrp_bom_search +msgid "BoM for intermediate product" +msgstr "Fiche technique pour produit intermédiaire" + +#. module: mrp_product_characterisation +#: model_terms:ir.ui.view,arch_db:mrp_product_characterisation.view_mrp_product_product_search +#: model_terms:ir.ui.view,arch_db:mrp_product_characterisation.view_mrp_product_template_search +msgid "Components Products" +msgstr "Matières premières" + +#. module: mrp_product_characterisation +#: model_terms:ir.ui.view,arch_db:mrp_product_characterisation.view_mrp_product_product_search +#: model_terms:ir.ui.view,arch_db:mrp_product_characterisation.view_mrp_product_template_search +msgid "Intermediates Products" +msgstr "Produit intermédiaire" + +#. module: mrp_product_characterisation +#: model:ir.model.fields,field_description:mrp_product_characterisation.field_product_product__is_component +#: model:ir.model.fields,field_description:mrp_product_characterisation.field_product_template__is_component +msgid "Is Component" +msgstr "Est une matière première" + +#. module: mrp_product_characterisation +#: model:ir.model.fields,field_description:mrp_product_characterisation.field_product_product__is_intermediate +#: model:ir.model.fields,field_description:mrp_product_characterisation.field_product_template__is_intermediate +msgid "Is Intermediate" +msgstr "Est un produit intermédiaire" + +#. module: mrp_product_characterisation +#: model:ir.model.fields,help:mrp_product_characterisation.field_product_product__is_component +#: model:ir.model.fields,help:mrp_product_characterisation.field_product_template__is_component +msgid "" +"Is component a product which has no BoM based on it + is used " +"in a BoM line" +msgstr "" +"Est une matière première tout produit qui n'a pas de Fiche technique basée " +"sur elle + qui est utilisé dans une Fiche technique comme " +"composant" + +#. module: mrp_product_characterisation +#: model:ir.model.fields,help:mrp_product_characterisation.field_product_product__is_intermediate +#: model:ir.model.fields,help:mrp_product_characterisation.field_product_template__is_intermediate +msgid "" +"Is intermediate a product which has a BoM based on it + is used" +" in a BoM line" +msgstr "" +"Est un produit intermédiaire tout produit qui a une Fiche technique basée " +"sur elle + qui est utilisé dans une Fiche technique comme " +"composant" + +#. module: mrp_product_characterisation +#: model:ir.model,name:mrp_product_characterisation.model_product_template +msgid "Product" +msgstr "Produit" + +#. module: mrp_product_characterisation +#: model:ir.model,name:mrp_product_characterisation.model_product_product +msgid "Product Variant" +msgstr "Variante de produit" \ No newline at end of file diff --git a/mrp_product_characterisation/models/__init__.py b/mrp_product_characterisation/models/__init__.py new file mode 100644 index 000000000..18b37e853 --- /dev/null +++ b/mrp_product_characterisation/models/__init__.py @@ -0,0 +1,2 @@ +from . import product_product +from . import product_template diff --git a/mrp_product_characterisation/models/product_product.py b/mrp_product_characterisation/models/product_product.py new file mode 100644 index 000000000..81ed3c353 --- /dev/null +++ b/mrp_product_characterisation/models/product_product.py @@ -0,0 +1,33 @@ +# Copyright (C) 2022 - Today: GRAP (http://www.grap.coop) +# @author: Quentin DUPONT (quentin.dupont@grap.coop) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from odoo import api, fields, models + + +class ProductProduct(models.Model): + _inherit = "product.product" + + is_component = fields.Boolean( + compute="_compute_is_component_intermediate", + store=True, + help="Is component a product which has no BoM based on it +\ + is used in a BoM line", + ) + is_intermediate = fields.Boolean( + compute="_compute_is_component_intermediate", + store=True, + help="Is intermediate a product which has a BoM based on it +\ + is used in a BoM line", + ) + + @api.depends("bom_line_ids", "variant_bom_ids") + def _compute_is_component_intermediate(self): + for product in self: + if product.bom_line_ids: + # Difference is having a BoM with this product or not + product.is_intermediate = True if product.bom_count else False + product.is_component = not product.is_intermediate + else: + product.is_intermediate = False + product.is_component = False diff --git a/mrp_product_characterisation/models/product_template.py b/mrp_product_characterisation/models/product_template.py new file mode 100644 index 000000000..f8789322f --- /dev/null +++ b/mrp_product_characterisation/models/product_template.py @@ -0,0 +1,17 @@ +# Copyright (C) 2022 - Today: GRAP (http://www.grap.coop) +# @author: Quentin DUPONT (quentin.dupont@grap.coop) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from odoo import fields, models + + +class ProductTemplate(models.Model): + _inherit = "product.template" + + is_component = fields.Boolean( + related="product_variant_ids.is_component", + ) + + is_intermediate = fields.Boolean( + related="product_variant_ids.is_intermediate", + ) diff --git a/mrp_product_characterisation/readme/CONTRIBUTORS.rst b/mrp_product_characterisation/readme/CONTRIBUTORS.rst new file mode 100644 index 000000000..9ed470628 --- /dev/null +++ b/mrp_product_characterisation/readme/CONTRIBUTORS.rst @@ -0,0 +1 @@ +* Quentin Dupont (quentin.dupont@grap.coop) diff --git a/mrp_product_characterisation/readme/DESCRIPTION.rst b/mrp_product_characterisation/readme/DESCRIPTION.rst new file mode 100644 index 000000000..2d05f2cba --- /dev/null +++ b/mrp_product_characterisation/readme/DESCRIPTION.rst @@ -0,0 +1,10 @@ +Adds characterisation "Intermediate Products" and adjust Components characterisation for Products. +Adds BoM filter with theses characterisations. + +Intermediate products : contained in a BoM AND manufactured (has a BoM) +Component products : contained in a BoM AND NOT manufactured (has no BoM) + +For example in bakeries, leavening is a intermediate product, and buckwheat flour +a component product. + +.. figure:: ../static/description/intermediate_product.png diff --git a/mrp_product_characterisation/static/description/index.html b/mrp_product_characterisation/static/description/index.html new file mode 100644 index 000000000..32f0a5681 --- /dev/null +++ b/mrp_product_characterisation/static/description/index.html @@ -0,0 +1,432 @@ + + + + + + +MRP Product Characterisation + + + +
+

MRP Product Characterisation

+ + +

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

+

Adds characterisation “Intermediate Products” and adjust Components characterisation for Products. +Adds BoM filter with theses characterisations.

+

Intermediate products : contained in a BoM AND manufactured (has a BoM) +Component products : contained in a BoM AND NOT manufactured (has no BoM)

+

For example in bakeries, leavening is a intermediate product, and buckwheat flour +a component product.

+
+https://raw.githubusercontent.com/OCA/manufacture/16.0/mrp_product_characterisation/static/description/intermediate_product.png +
+

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

+
    +
  • GRAP
  • +
+
+
+

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.

+

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_product_characterisation/static/description/intermediate_product.png b/mrp_product_characterisation/static/description/intermediate_product.png new file mode 100644 index 000000000..2c855a661 Binary files /dev/null and b/mrp_product_characterisation/static/description/intermediate_product.png differ diff --git a/mrp_product_characterisation/tests/__init__.py b/mrp_product_characterisation/tests/__init__.py new file mode 100644 index 000000000..626580ed4 --- /dev/null +++ b/mrp_product_characterisation/tests/__init__.py @@ -0,0 +1 @@ +from . import test_product diff --git a/mrp_product_characterisation/tests/test_product.py b/mrp_product_characterisation/tests/test_product.py new file mode 100644 index 000000000..d83ac1962 --- /dev/null +++ b/mrp_product_characterisation/tests/test_product.py @@ -0,0 +1,39 @@ +# Copyright (C) 2022 - Today: GRAP (http://www.grap.coop) +# @author: Quentin DUPONT (quentin.dupont@grap.coop) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from odoo.tests.common import TransactionCase + + +class TestProductProduct(TransactionCase): + def setUp(self): + super(TestProductProduct, self).setUp() + self.mrp_bom = self.env["mrp.bom"] + self.product_product_screw = self.env.ref( + "mrp.product_product_computer_desk_screw" + ) + + def test_01_change_from_component_to_intermediate(self): + self.assertEqual( + self.product_product_screw.is_component, + True, + ) + self.assertEqual( + self.product_product_screw.is_intermediate, + False, + ) + self.mrp_bom.create( + { + "product_id": self.product_product_screw.id, + "product_tmpl_id": self.product_product_screw.product_tmpl_id.id, + } + ) + self.product_product_screw._compute_is_component_intermediate() + self.assertEqual( + self.product_product_screw.is_component, + False, + ) + self.assertEqual( + self.product_product_screw.is_intermediate, + True, + ) diff --git a/mrp_product_characterisation/views/view_mrp_bom.xml b/mrp_product_characterisation/views/view_mrp_bom.xml new file mode 100644 index 000000000..888954469 --- /dev/null +++ b/mrp_product_characterisation/views/view_mrp_bom.xml @@ -0,0 +1,33 @@ + + + + + + + + + mrp.bom + + + + + + + + + + + + diff --git a/mrp_product_characterisation/views/view_product_product.xml b/mrp_product_characterisation/views/view_product_product.xml new file mode 100644 index 000000000..6cce5f5ce --- /dev/null +++ b/mrp_product_characterisation/views/view_product_product.xml @@ -0,0 +1,33 @@ + + + + + + product.product + + + + + + + + + + 1 + + + + + diff --git a/mrp_product_characterisation/views/view_product_template.xml b/mrp_product_characterisation/views/view_product_template.xml new file mode 100644 index 000000000..437b65d98 --- /dev/null +++ b/mrp_product_characterisation/views/view_product_template.xml @@ -0,0 +1,56 @@ + + + + + + product.template + + + + + + + + + + + + + + + + + product.template + + + + + + + + + + 1 + + + + + diff --git a/setup/mrp_product_characterisation/odoo/addons/mrp_product_characterisation b/setup/mrp_product_characterisation/odoo/addons/mrp_product_characterisation new file mode 120000 index 000000000..cafe77dac --- /dev/null +++ b/setup/mrp_product_characterisation/odoo/addons/mrp_product_characterisation @@ -0,0 +1 @@ +../../../../mrp_product_characterisation \ No newline at end of file diff --git a/setup/mrp_product_characterisation/setup.py b/setup/mrp_product_characterisation/setup.py new file mode 100644 index 000000000..28c57bb64 --- /dev/null +++ b/setup/mrp_product_characterisation/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +)