diff --git a/mrp_bom_widget_section_and_note_one2many/README.rst b/mrp_bom_widget_section_and_note_one2many/README.rst new file mode 100644 index 000000000..49d2439fe --- /dev/null +++ b/mrp_bom_widget_section_and_note_one2many/README.rst @@ -0,0 +1,79 @@ +================================== +MRP Widget Section and Note in BoM +================================== + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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-quentinDupont%2Fmanufacture-lightgray.png?logo=github + :target: https://github.com/quentinDupont/manufacture/tree/12.0_ADD_MRP_Widget_Sectionnote/mrp_bom_widget_section_and_note_one2many + :alt: quentinDupont/manufacture + +|badge1| |badge2| |badge3| + +In a similar way to invoices, this module adds the possibility to add sections +ands notes in Bills of Materials. +It adds a page in BoM form view and hide the orignal page (you can see it +as admin in debug mode) + +Depends on account module since widget 'section_and_note' is defined on +section_and_note_fields_backend.js in account module. + +**Table of contents** + +.. contents:: + :local: + +Usage +===== + +* Go to Manufacture / Master Data / Bill Of Materials +* Edit one demo data +* Add a section or note and saved +* The new functionality is added in a transparent way and is compatible with the business logic of other MRP functionalities + +.. figure:: https://raw.githubusercontent.com/quentinDupont/manufacture/12.0_ADD_MRP_Widget_Sectionnote/mrp_bom_widget_section_and_note_one2many/static/description/mrp_bom_widget_add_section_and_note.gif + +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 `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* GRAP + +Contributors +~~~~~~~~~~~~ + +* BADEP +* Quentin Dupont (quentin.dupont@grap.coop) + +Other credits +~~~~~~~~~~~~~ + +* Code inspired by BADEP repo in v14 https://github.com/BADEP/addons/blob/14.0/mrp_bom_section + +Maintainers +~~~~~~~~~~~ + +This module is part of the `quentinDupont/manufacture `_ project on GitHub. + +You are welcome to contribute. diff --git a/mrp_bom_widget_section_and_note_one2many/__init__.py b/mrp_bom_widget_section_and_note_one2many/__init__.py new file mode 100644 index 000000000..0650744f6 --- /dev/null +++ b/mrp_bom_widget_section_and_note_one2many/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/mrp_bom_widget_section_and_note_one2many/__manifest__.py b/mrp_bom_widget_section_and_note_one2many/__manifest__.py new file mode 100644 index 000000000..f2b5c5928 --- /dev/null +++ b/mrp_bom_widget_section_and_note_one2many/__manifest__.py @@ -0,0 +1,23 @@ +# Copyright (C) 2022 - Today: GRAP (http://www.grap.coop) +# @author: BADEP +# @author: Quentin Dupont (quentin.dupont@grap.coop) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +{ + "name": "MRP Widget Section and Note in BoM", + "summary": "Add section and note in Bills of Materials", + "version": "12.0.1.1.0", + "category": "GRAP - Incubator", + "author": "GRAP," + "Odoo Community Association (OCA)", + "website": "https://github.com/grap/grap-odoo-incubator", + "license": "AGPL-3", + "depends": [ + "mrp", + "account", + ], + "data": [ + "views/view_mrp_bom.xml", + ], + "installable": True, +} diff --git a/mrp_bom_widget_section_and_note_one2many/i18n/fr.po b/mrp_bom_widget_section_and_note_one2many/i18n/fr.po new file mode 100644 index 000000000..cc78e380f --- /dev/null +++ b/mrp_bom_widget_section_and_note_one2many/i18n/fr.po @@ -0,0 +1,106 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * mrp_bom_widget_section_and_note_one2many +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2022-05-10 15:01+0000\n" +"PO-Revision-Date: 2022-05-10 15:01+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_bom_widget_section_and_note_one2many +#: model_terms:ir.ui.view,arch_db:mrp_bom_widget_section_and_note_one2many.mrp_bom_form_view_section +msgid "Add a note" +msgstr "Ajouter une note" + +#. module: mrp_bom_widget_section_and_note_one2many +#: model_terms:ir.ui.view,arch_db:mrp_bom_widget_section_and_note_one2many.mrp_bom_form_view_section +msgid "Add a product" +msgstr "Ajouter un produit" + +#. module: mrp_bom_widget_section_and_note_one2many +#: model_terms:ir.ui.view,arch_db:mrp_bom_widget_section_and_note_one2many.mrp_bom_form_view_section +msgid "Add a section" +msgstr "Ajouter une section" + +#. module: mrp_bom_widget_section_and_note_one2many +#: model_terms:ir.ui.view,arch_db:mrp_bom_widget_section_and_note_one2many.mrp_bom_form_view_section +msgid "Attachments" +msgstr "Pièces jointes" + +#. module: mrp_bom_widget_section_and_note_one2many +#: model:ir.model,name:mrp_bom_widget_section_and_note_one2many.model_mrp_bom +msgid "Bill of Material" +msgstr "Nomenclature" + +#. module: mrp_bom_widget_section_and_note_one2many +#: model:ir.model,name:mrp_bom_widget_section_and_note_one2many.model_mrp_bom_line +msgid "Bill of Material Line" +msgstr "Ligne de nomenclature" + +#. module: mrp_bom_widget_section_and_note_one2many +#: model:ir.model.fields,field_description:mrp_bom_widget_section_and_note_one2many.field_mrp_bom__bom_line_ids +msgid "BoM Lines" +msgstr "Lignes de nomenclature" + +#. module: mrp_bom_widget_section_and_note_one2many +#: model:ir.model.fields,field_description:mrp_bom_widget_section_and_note_one2many.field_mrp_bom__bom_line_with_sectionnote_ids +msgid "BoM Lines With Sections & Notes" +msgstr "Lignes de nomenclature avec Sections & Notes" + +#. module: mrp_bom_widget_section_and_note_one2many +#: model:ir.model.fields,field_description:mrp_bom_widget_section_and_note_one2many.field_mrp_bom_line__product_id +msgid "Component" +msgstr "Composant" + +#. module: mrp_bom_widget_section_and_note_one2many +#: model_terms:ir.ui.view,arch_db:mrp_bom_widget_section_and_note_one2many.mrp_bom_form_view_section +msgid "Components" +msgstr "Composants" + +#. module: mrp_bom_widget_section_and_note_one2many +#: model_terms:ir.ui.view,arch_db:mrp_bom_widget_section_and_note_one2many.mrp_bom_form_view_section +msgid "Components with sections and notes" +msgstr "Composants" + +#. module: mrp_bom_widget_section_and_note_one2many +#: model:ir.model.fields,field_description:mrp_bom_widget_section_and_note_one2many.field_mrp_bom_line__name +msgid "Description" +msgstr "" + +#. module: mrp_bom_widget_section_and_note_one2many +#: model:ir.model.fields,field_description:mrp_bom_widget_section_and_note_one2many.field_mrp_bom_line__display_type +msgid "Display Type" +msgstr "Type d'affichage" + +#. module: mrp_bom_widget_section_and_note_one2many +#: model_terms:ir.ui.view,arch_db:mrp_bom_widget_section_and_note_one2many.mrp_bom_form_view_section +msgid "No attachment" +msgstr "Pas de pièces jointes" + +#. module: mrp_bom_widget_section_and_note_one2many +#: selection:mrp.bom.line,display_type:0 +msgid "Note" +msgstr "" + +#. module: mrp_bom_widget_section_and_note_one2many +#: model:ir.model.fields,field_description:mrp_bom_widget_section_and_note_one2many.field_mrp_bom_line__product_qty +msgid "Quantity" +msgstr "Quantité" + +#. module: mrp_bom_widget_section_and_note_one2many +#: selection:mrp.bom.line,display_type:0 +msgid "Section" +msgstr "" + +#. module: mrp_bom_widget_section_and_note_one2many +#: model:ir.model.fields,help:mrp_bom_widget_section_and_note_one2many.field_mrp_bom_line__display_type +msgid "Technical field for UX purpose." +msgstr "Champ technique utilisé à des fins ergonomiques" diff --git a/mrp_bom_widget_section_and_note_one2many/models/__init__.py b/mrp_bom_widget_section_and_note_one2many/models/__init__.py new file mode 100644 index 000000000..6de1b8360 --- /dev/null +++ b/mrp_bom_widget_section_and_note_one2many/models/__init__.py @@ -0,0 +1,2 @@ +from . import mrp_bom +from . import mrp_bom_line diff --git a/mrp_bom_widget_section_and_note_one2many/models/mrp_bom.py b/mrp_bom_widget_section_and_note_one2many/models/mrp_bom.py new file mode 100644 index 000000000..29e4eed82 --- /dev/null +++ b/mrp_bom_widget_section_and_note_one2many/models/mrp_bom.py @@ -0,0 +1,21 @@ +# Copyright (C) 2022 - Today: GRAP (http://www.grap.coop) +# @author: BADEP +# @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 MrpBom(models.Model): + _inherit = "mrp.bom" + + # Split bom_line_ids in two fields handled thanks to domain + # Keeping original field bom_line_ids to keep all the native functionnalities + bom_line_ids = fields.One2many(domain=[("display_type", "=", False)]) + + bom_line_with_sectionnote_ids = fields.One2many( + comodel_name="mrp.bom.line", + inverse_name="bom_id", + string="BoM Lines With Sections & Notes", + copy=False, + ) diff --git a/mrp_bom_widget_section_and_note_one2many/models/mrp_bom_line.py b/mrp_bom_widget_section_and_note_one2many/models/mrp_bom_line.py new file mode 100644 index 000000000..81d187436 --- /dev/null +++ b/mrp_bom_widget_section_and_note_one2many/models/mrp_bom_line.py @@ -0,0 +1,23 @@ +# Copyright (C) 2022 - Today: GRAP (http://www.grap.coop) +# @author: BADEP +# @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 MrpBomLine(models.Model): + _inherit = "mrp.bom.line" + + # To handle bom_line section & note, we have to make these fiels not required + product_id = fields.Many2one(required=False) + product_qty = fields.Float(required=False) + + # New fields to handle section & note + name = fields.Text(string="Description") + + display_type = fields.Selection( + [("line_section", "Section"), ("line_note", "Note")], + default=False, + help="Technical field for UX purpose.", + ) diff --git a/mrp_bom_widget_section_and_note_one2many/readme/CONTRIBUTORS.rst b/mrp_bom_widget_section_and_note_one2many/readme/CONTRIBUTORS.rst new file mode 100644 index 000000000..9718272b6 --- /dev/null +++ b/mrp_bom_widget_section_and_note_one2many/readme/CONTRIBUTORS.rst @@ -0,0 +1,2 @@ +* BADEP +* Quentin Dupont (quentin.dupont@grap.coop) diff --git a/mrp_bom_widget_section_and_note_one2many/readme/CREDITS.rst b/mrp_bom_widget_section_and_note_one2many/readme/CREDITS.rst new file mode 100644 index 000000000..ba3604b04 --- /dev/null +++ b/mrp_bom_widget_section_and_note_one2many/readme/CREDITS.rst @@ -0,0 +1 @@ +* Code inspired by BADEP repo in v14 https://github.com/BADEP/addons/blob/14.0/mrp_bom_section diff --git a/mrp_bom_widget_section_and_note_one2many/readme/DESCRIPTION.rst b/mrp_bom_widget_section_and_note_one2many/readme/DESCRIPTION.rst new file mode 100644 index 000000000..0ecc33a8a --- /dev/null +++ b/mrp_bom_widget_section_and_note_one2many/readme/DESCRIPTION.rst @@ -0,0 +1,7 @@ +In a similar way to invoices, this module adds the possibility to add sections +ands notes in Bills of Materials. +It adds a page in BoM form view and hide the orignal page (you can see it +as admin in debug mode) + +Depends on account module since widget 'section_and_note' is defined on +section_and_note_fields_backend.js in account module. diff --git a/mrp_bom_widget_section_and_note_one2many/readme/USAGE.rst b/mrp_bom_widget_section_and_note_one2many/readme/USAGE.rst new file mode 100644 index 000000000..26f988079 --- /dev/null +++ b/mrp_bom_widget_section_and_note_one2many/readme/USAGE.rst @@ -0,0 +1,6 @@ +* Go to Manufacture / Master Data / Bill Of Materials +* Edit one demo data +* Add a section or note and saved +* The new functionality is added in a transparent way and is compatible with the business logic of other MRP functionalities + +.. figure:: ../static/description/mrp_bom_widget_add_section_and_note.gif diff --git a/mrp_bom_widget_section_and_note_one2many/static/description/index.html b/mrp_bom_widget_section_and_note_one2many/static/description/index.html new file mode 100644 index 000000000..4260f9cfd --- /dev/null +++ b/mrp_bom_widget_section_and_note_one2many/static/description/index.html @@ -0,0 +1,440 @@ + + + + + + +MRP Widget Section and Note in BoM + + + +
+

MRP Widget Section and Note in BoM

+ + +

Beta License: AGPL-3 quentinDupont/manufacture

+

In a similar way to invoices, this module adds the possibility to add sections +ands notes in Bills of Materials. +It adds a page in BoM form view and hide the orignal page (you can see it +as admin in debug mode)

+

Depends on account module since widget ‘section_and_note’ is defined on +section_and_note_fields_backend.js in account module.

+

Table of contents

+ +
+

Usage

+
    +
  • Go to Manufacture / Master Data / Bill Of Materials
  • +
  • Edit one demo data
  • +
  • Add a section or note and saved
  • +
  • The new functionality is added in a transparent way and is compatible with the business logic of other MRP functionalities
  • +
+
+https://raw.githubusercontent.com/quentinDupont/manufacture/12.0_ADD_MRP_Widget_Sectionnote/mrp_bom_widget_section_and_note_one2many/static/description/mrp_bom_widget_add_section_and_note.gif +
+
+
+

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.

+

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

+
+
+

Credits

+
+

Authors

+
    +
  • GRAP
  • +
+
+
+

Contributors

+ +
+ +
+

Maintainers

+

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

+

You are welcome to contribute.

+
+
+
+ + diff --git a/mrp_bom_widget_section_and_note_one2many/static/description/mrp_bom_widget_add_section_and_note.gif b/mrp_bom_widget_section_and_note_one2many/static/description/mrp_bom_widget_add_section_and_note.gif new file mode 100644 index 000000000..64efff090 Binary files /dev/null and b/mrp_bom_widget_section_and_note_one2many/static/description/mrp_bom_widget_add_section_and_note.gif differ diff --git a/mrp_bom_widget_section_and_note_one2many/views/view_mrp_bom.xml b/mrp_bom_widget_section_and_note_one2many/views/view_mrp_bom.xml new file mode 100644 index 000000000..757e97a8b --- /dev/null +++ b/mrp_bom_widget_section_and_note_one2many/views/view_mrp_bom.xml @@ -0,0 +1,49 @@ + + + + + + mrp.bom + + + + + + + + + + + + + + + + + +