Repository: grap/grap-odoo-custom
Pull request #446: [16.0][IMP] fermente_mrp_bom_form_view-Title-characterisation-and-hierarchy
Author: login: quentinDupont
Labels: name: TO MERGE
name: merged 🎉
Created: 2025-03-14T14:27:20Z | Merged: 2025-03-25T09:48:07Z

[Task](https://erp.grap.coop/web#id=1690&action=2148&active_id=40&model=project.task&view_type=form&menu_id=1673)


Diff:
diff --git a/fermente_mrp_bom_form_view/__init__.py b/fermente_mrp_bom_form_view/__init__.py
index e69de29bb..0650744f6 100644
--- a/fermente_mrp_bom_form_view/__init__.py
+++ b/fermente_mrp_bom_form_view/__init__.py
@@ -0,0 +1 @@
+from . import models
diff --git a/fermente_mrp_bom_form_view/__manifest__.py b/fermente_mrp_bom_form_view/__manifest__.py
index bcaf9e07f..e4086c11d 100644
--- a/fermente_mrp_bom_form_view/__manifest__.py
+++ b/fermente_mrp_bom_form_view/__manifest__.py
@@ -14,7 +14,10 @@
         # OCA
         "web_widget_numeric_step",
         "mrp_bom_widget_section_and_note_one2many",
+        "mrp_bom_image",
+        "mrp_bom_hierarchy",
         "mrp_bom_produce_delay_in_hour",
+        "mrp_product_characterisation",
         # GRAP
         "mrp_bom_tag",
         "mrp_bom_line_net_qty",
diff --git a/fermente_mrp_bom_form_view/i18n/fr.po b/fermente_mrp_bom_form_view/i18n/fr.po
index b873f0220..c57efdac8 100644
--- a/fermente_mrp_bom_form_view/i18n/fr.po
+++ b/fermente_mrp_bom_form_view/i18n/fr.po
@@ -6,8 +6,8 @@ msgid ""
 msgstr ""
 "Project-Id-Version: Odoo Server 16.0\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2025-03-17 13:02+0000\n"
-"PO-Revision-Date: 2025-03-17 13:02+0000\n"
+"POT-Creation-Date: 2024-11-26 13:14+0000\n"
+"PO-Revision-Date: 2024-11-26 13:14+0000\n"
 "Last-Translator: \n"
 "Language-Team: \n"
 "MIME-Version: 1.0\n"
@@ -15,6 +15,11 @@ msgstr ""
 "Content-Transfer-Encoding: \n"
 "Plural-Forms: \n"
 
+#. module: fermente_mrp_bom_form_view
+#: model_terms:ir.ui.view,arch_db:fermente_mrp_bom_form_view.view_fermente_mrp_bom_form
+msgid "&gt;"
+msgstr "&gt;"
+
 #. module: fermente_mrp_bom_form_view
 #: model_terms:ir.ui.view,arch_db:fermente_mrp_bom_form_view.view_fermente_mrp_bom_form_base
 msgid "<b>Data sheet</b> - finished and intermediate product 🧩"
@@ -30,11 +35,6 @@ msgstr "<b>Fiche technique</b> - produit fini"
 msgid "<b>Data sheet</b> - intermediate product 🧩"
 msgstr "<b>Fiche technique</b> - produit intermédiaire 🧩"
 
-#. module: fermente_mrp_bom_form_view
-#: model_terms:ir.ui.view,arch_db:fermente_mrp_bom_form_view.view_fermente_mrp_bom_form_sections_and_notes
-msgid "Allergens"
-msgstr "Allergènes"
-
 #. module: fermente_mrp_bom_form_view
 #: model:ir.model,name:fermente_mrp_bom_form_view.model_mrp_bom
 msgid "Bill of Material"
@@ -43,7 +43,7 @@ msgstr "Fiche technique"
 #. module: fermente_mrp_bom_form_view
 #: model_terms:ir.ui.view,arch_db:fermente_mrp_bom_form_view.view_fermente_mrp_bom_form_sections_and_notes
 msgid "Components"
-msgstr "Lignes de recette"
+msgstr "Composants"
 
 #. module: fermente_mrp_bom_form_view
 #: model:ir.model.fields,field_description:fermente_mrp_bom_form_view.field_mrp_bom__sale_ok
@@ -64,21 +64,11 @@ msgstr ""
 "Un produit est intermédiaire s'il a une Fiche technique dédiée + s'il est "
 "utilisé dans une autre Fiche technique"
 
-#. module: fermente_mrp_bom_form_view
-#: model_terms:ir.ui.view,arch_db:fermente_mrp_bom_form_view.view_fermente_mrp_bom_form_sections_and_notes
-msgid "Labels"
-msgstr ""
-
 #. module: fermente_mrp_bom_form_view
 #: model:ir.model.fields,field_description:fermente_mrp_bom_form_view.field_mrp_bom__product_name
 msgid "Name"
 msgstr "Nom"
 
-#. module: fermente_mrp_bom_form_view
-#: model_terms:ir.ui.view,arch_db:fermente_mrp_bom_form_view.view_fermente_mrp_bom_form_sections_and_notes
-msgid "Net weight (kg)"
-msgstr "Poids net (kg)"
-
 #. module: fermente_mrp_bom_form_view
 #: model_terms:ir.ui.view,arch_db:fermente_mrp_bom_form_view.view_fermente_mrp_bom_form_produce_delay
 msgid "Produce time"
@@ -90,7 +80,7 @@ msgid "ST %"
 msgstr ""
 
 #. module: fermente_mrp_bom_form_view
-#: model_terms:ir.ui.view,arch_db:fermente_mrp_bom_form_view.view_fermente_mrp_bom_form_sections_and_notes
+#: model_terms:ir.ui.view,arch_db:fermente_mrp_bom_form_view.view_fermente_mrp_bom_form
 msgid ""
 "This will set product gross quantity with net quantity and loss percentage"
 msgstr ""
@@ -98,7 +88,7 @@ msgstr ""
 "pourcentage de perte."
 
 #. module: fermente_mrp_bom_form_view
-#: model_terms:ir.ui.view,arch_db:fermente_mrp_bom_form_view.view_fermente_mrp_bom_form_sections_and_notes
+#: model_terms:ir.ui.view,arch_db:fermente_mrp_bom_form_view.view_fermente_mrp_bom_form
 msgid ""
 "This will set product net quantity with gross quantity and loss percentage"
 msgstr ""
@@ -106,11 +96,11 @@ msgstr ""
 "pourcentage de perte."
 
 #. module: fermente_mrp_bom_form_view
-#: model_terms:ir.ui.view,arch_db:fermente_mrp_bom_form_view.view_fermente_mrp_bom_form_sections_and_notes
+#: model_terms:ir.ui.view,arch_db:fermente_mrp_bom_form_view.view_fermente_mrp_bom_form
 msgid "Total"
 msgstr ""
 
 #. module: fermente_mrp_bom_form_view
 #: model_terms:ir.ui.view,arch_db:fermente_mrp_bom_form_view.view_fermente_mrp_bom_form_sections_and_notes
 msgid "View product's BoM"
-msgstr "Voir ses Fiches techniques"
\ No newline at end of file
+msgstr "Voir ses Fiches techniques"
diff --git a/fermente_mrp_bom_form_view/models/__init__.py b/fermente_mrp_bom_form_view/models/__init__.py
new file mode 100644
index 000000000..a352efe9b
--- /dev/null
+++ b/fermente_mrp_bom_form_view/models/__init__.py
@@ -0,0 +1 @@
+from . import mrp_bom
diff --git a/fermente_mrp_bom_form_view/models/mrp_bom.py b/fermente_mrp_bom_form_view/models/mrp_bom.py
new file mode 100644
index 000000000..6fd404782
--- /dev/null
+++ b/fermente_mrp_bom_form_view/models/mrp_bom.py
@@ -0,0 +1,21 @@
+# Copyright (C) 2025 - 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 MrpBom(models.Model):
+    _inherit = "mrp.bom"
+
+    product_name = fields.Char(related="product_tmpl_id.name")
+
+    sale_ok = fields.Boolean(
+        string="Finished product",
+        related="product_tmpl_id.sale_ok",
+    )
+
+    product_intermediate = fields.Boolean(
+        string="Intermediate product",
+        related="product_tmpl_id.is_intermediate",
+    )
diff --git a/fermente_mrp_bom_form_view/views/view_mrp_bom.xml b/fermente_mrp_bom_form_view/views/view_mrp_bom.xml
index 8c2aa45f2..3dc1d54e6 100644
--- a/fermente_mrp_bom_form_view/views/view_mrp_bom.xml
+++ b/fermente_mrp_bom_form_view/views/view_mrp_bom.xml
@@ -11,7 +11,7 @@ License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
     <!-- ************************************************************ -->
 
 
-    <!-- ******** INHERIT BASE VIEW **************************************************** -->
+    <!-- ******** INHERIT BASE VIEW ************************************************ -->
     <record id="view_fermente_mrp_bom_form_base" model="ir.ui.view">
         <field name="model">mrp.bom</field>
         <field name="inherit_id" ref="mrp.mrp_bom_form_view" />
@@ -20,11 +20,27 @@ License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
             <xpath expr="//field[@name='type']" position="attributes">
                 <attribute name="invisible">1</attribute>
             </xpath>
+            <xpath expr="//field[@name='image_1024']" position="attributes">
+                <attribute name="invisible">1</attribute>
+            </xpath>
+
+            <xpath expr="//widget[@name='web_ribbon']" position="before">
+                <field name="image_1024" widget="image" class="oe_avatar" options="{'preview_image': 'image_128'}"/>
+                <div class="oe_title" name="bom_title" style="position:relative;left:15px">
+                    <field name="sale_ok" invisible="1" />
+                    <field name="product_intermediate" invisible="1" />
+                    <p attrs="{'invisible': ['|', ('sale_ok', '=', False), ('product_intermediate', '=', False)]}"><b>Data sheet</b> - finished and intermediate product 🧩</p>
+                    <p attrs="{'invisible': ['|', ('sale_ok', '=', False), '&amp;', ('sale_ok', '=', True), ('product_intermediate', '=', True)]}"><b>Data sheet</b> - finished product</p>
+                    <p attrs="{'invisible': ['|', ('product_intermediate', '=', False), '&amp;', ('sale_ok', '=', True), ('product_intermediate', '=', True)]}"><b>Data sheet</b> - intermediate product 🧩</p>
+                    <h1><field name="product_name" readonly="1"/></h1>
+                </div>
+            </xpath>
+
         </field>
     </record>
 
 
-    <!-- ******** INHERIT PRODUCE DELAY VIEW **************************************************** -->
+    <!-- ******** INHERIT PRODUCE DELAY VIEW *************************************** -->
     <record id="view_fermente_mrp_bom_form_produce_delay" model="ir.ui.view">
         <field name="model">mrp.bom</field>
         <field name="inherit_id" ref="mrp_bom_produce_delay_in_hour.view_mrp_bom_form_glue_module_produce_delay_add_fields" />
@@ -37,7 +53,7 @@ License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
         </field>
     </record>
 
-    <!-- ******** INHERIT SECTIONS AND NOTES VIEW **************************************************** -->
+    <!-- ******** INHERIT SECTIONS AND NOTES VIEW ********************************** -->
     <record id="view_fermente_mrp_bom_form_sections_and_notes" model="ir.ui.view">
         <field name="model">mrp.bom</field>
         <field name="inherit_id" ref="mrp_bom_widget_section_and_note_one2many.mrp_bom_form_view_section" />
@@ -53,6 +69,12 @@ License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
             </xpath>
 
             <!-- Add fields -->
+            <xpath expr="//notebook/page/field[@name='bom_line_with_sectionnote_ids']/tree/field[@name='product_id']" position="before">
+                <field name="has_bom" invisible="1"/>
+                <button title="View product's BoM" name="action_open_product_bom_tree_view" type="object" class="btn btn-link" string="🧩" attrs="{'invisible': [('has_bom', '!=', True)]}"/>
+            </xpath>
+
+
             <xpath
                 expr="//field[@name='bom_line_with_sectionnote_ids']/tree/field[@name='product_uom_id']"
                 position="before"


Reviews:
user: login: legalsylvain
body: remarque non bloquante.

state: APPROVED
author_association: MEMBER
submitted_at: 2025-03-14T18:56:24Z
user: login: quentinDupont
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-03-17T08:29:56Z
user: login: quentinDupont
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-03-17T08:33:08Z
user: login: legalsylvain
body: Coucou j'ai un conflit sur le fichier : 
fermente_mrp_bom_form_view/i18n/fr.po

quand je gitaggregate. Est-ce que tu peux voir ? 

dans l'attente, je commente.

https://gitlab.com/grap-rhone-alpes/grap-odoo-env/-/merge_requests/53/diffs#970739f4e1d20d171bb2a76bd13e0d0875c51dc8_802_871
state: CHANGES_REQUESTED
author_association: MEMBER
submitted_at: 2025-03-17T09:03:01Z
user: login: legalsylvain
body: merci ! 
state: APPROVED
author_association: MEMBER
submitted_at: 2025-03-17T14:09:08Z

Review comments:
diff_hunk: @@ -11,7 +11,7 @@ License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
     <!-- ************************************************************ -->
 
 
-    <!-- ******** INHERIT BASE VIEW **************************************************** -->
+    <!-- ******** INHERIT BASE VIEW ************************************************ -->
path: fermente_mrp_bom_form_view/views/view_mrp_bom.xml
user: login: legalsylvain
body: je suis pas sûr pour ce changement -;)
created_at: 2025-03-14T18:53:54Z
author_association: MEMBER
diff_hunk: @@ -0,0 +1,21 @@
+# Copyright (C) 2025 - 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 MrpBom(models.Model):
+    _inherit = "mrp.bom"
+
+    product_name = fields.Char(related="product_tmpl_id.name")
+
+    product_finished = fields.Boolean(
+        string="Finished product",
+        related="product_tmpl_id.sale_ok",
+    )
path: fermente_mrp_bom_form_view/models/mrp_bom.py
user: login: legalsylvain
body: ```suggestion
    sale_ok = fields.Boolean(
        related="product_tmpl_id.sale_ok",
    )
```

si c'est un related de sale_ok, je serais favorable 
- à utiliser le même terme technique (sale_ok). Plus simple à comprendre à la longue pour les développeurs.
- à ne pas surcharger le string. du coup, le string reprendrait le libellé de sale_ok "Peut-etre vendu".

Qu'en penses-tu ?
created_at: 2025-03-14T18:53:56Z
author_association: MEMBER
diff_hunk: @@ -11,7 +11,7 @@ License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
     <!-- ************************************************************ -->
 
 
-    <!-- ******** INHERIT BASE VIEW **************************************************** -->
+    <!-- ******** INHERIT BASE VIEW ************************************************ -->
path: fermente_mrp_bom_form_view/views/view_mrp_bom.xml
user: login: quentinDupont
body: jvais rajouter un * J'AVOUE
created_at: 2025-03-17T08:29:56Z
author_association: MEMBER
diff_hunk: @@ -0,0 +1,21 @@
+# Copyright (C) 2025 - 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 MrpBom(models.Model):
+    _inherit = "mrp.bom"
+
+    product_name = fields.Char(related="product_tmpl_id.name")
+
+    product_finished = fields.Boolean(
+        string="Finished product",
+        related="product_tmpl_id.sale_ok",
+    )
path: fermente_mrp_bom_form_view/models/mrp_bom.py
user: login: quentinDupont
body: Ok pour renommer en sale_ok pour faciliter la compréhension champ
Mais ce qui est important pour les users finaux, c'est qu'il y ait leur vocabulaire : les transfos parlent de Produit finis donc ça me paraît important de coller à leur vocabulaire (Produit fini, produit intermédiaire, tous les changements de Nomenclatures en Fiches techniques)

Mais du coup si on renomme le champ en sale_ok, ça fait moins sens de mettre le string en "Finished product" ?
created_at: 2025-03-17T08:33:08Z
author_association: MEMBER

PR comments:
user: login: codecov[bot]
created_at: 2025-03-14T14:41:23Z
body: ## [Codecov](https://app.codecov.io/gh/grap/grap-odoo-custom/pull/446?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=grap) Report
All modified and coverable lines are covered by tests :white_check_mark:
> Project coverage is 80.50%. Comparing base [(`f7feace`)](https://app.codecov.io/gh/grap/grap-odoo-custom/commit/f7feaceb01e5b64564cbb83f5090f40280cbc326?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=grap) to head [(`d7464d2`)](https://app.codecov.io/gh/grap/grap-odoo-custom/commit/d7464d205c076307b9dcbd8ba8eacd205b34a51c?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=grap).
> Report is 7 commits behind head on 16.0.

<details><summary>Additional details and impacted files</summary>


```diff
@@            Coverage Diff             @@
##             16.0     #446      +/-   ##
==========================================
+ Coverage   80.34%   80.50%   +0.15%     
==========================================
  Files          83       86       +3     
  Lines         982      990       +8     
  Branches       90       90              
==========================================
+ Hits          789      797       +8     
  Misses        167      167              
  Partials       26       26              
```

</details>

[:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/grap/grap-odoo-custom/pull/446?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=grap).   
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=grap).

<details><summary> :rocket: New features to boost your workflow: </summary>

- :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
- :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
</details>
author_association: NONE
user: login: legalsylvain
created_at: 2025-03-24T23:15:10Z
body: @quentinDupont celle la aussi, please !
author_association: MEMBER
user: login: legalsylvain
created_at: 2025-03-25T09:42:33Z
body: MeP du 23/03/2025

/ocabot merge minor
author_association: MEMBER
user: login: github-grap-bot
created_at: 2025-03-25T09:42:40Z
body: Hey, thanks for contributing! Proceeding to merge this for you.
Prepared branch [16.0-ocabot-merge-pr-446-by-legalsylvain-bump-minor](https://github.com/grap/grap-odoo-custom/commits/16.0-ocabot-merge-pr-446-by-legalsylvain-bump-minor), awaiting test results.
author_association: CONTRIBUTOR
user: login: github-grap-bot
created_at: 2025-03-25T09:48:08Z
body: Congratulations, your PR was merged at c4bdc759d3301f91c6d92c3e16348d34ac9f0968. Thanks a lot for contributing to grap. ❤️
author_association: CONTRIBUTOR