diff --git a/mrp_bom_widget_section_and_note_one2many/README.rst b/mrp_bom_widget_section_and_note_one2many/README.rst index 49d2439fe..76ec8c158 100644 --- a/mrp_bom_widget_section_and_note_one2many/README.rst +++ b/mrp_bom_widget_section_and_note_one2many/README.rst @@ -42,6 +42,13 @@ Usage .. 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 +Known issues / Roadmap +====================== + +mrp_bom_component_menu module (and maybe more) displays bom lines and it +display lines of sections and note, with product_id empty. It should not display +theses lines + Bug Tracker =========== diff --git a/mrp_bom_widget_section_and_note_one2many/__manifest__.py b/mrp_bom_widget_section_and_note_one2many/__manifest__.py index f2b5c5928..44c826b35 100644 --- a/mrp_bom_widget_section_and_note_one2many/__manifest__.py +++ b/mrp_bom_widget_section_and_note_one2many/__manifest__.py @@ -7,7 +7,7 @@ "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", + "category": "Manufacturing/Manufacturing", "author": "GRAP," "Odoo Community Association (OCA)", "website": "https://github.com/grap/grap-odoo-incubator", 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 index 29e4eed82..c9f936cef 100644 --- a/mrp_bom_widget_section_and_note_one2many/models/mrp_bom.py +++ b/mrp_bom_widget_section_and_note_one2many/models/mrp_bom.py @@ -10,7 +10,7 @@ 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 + # Keep 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( 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 index 81d187436..bba6370fe 100644 --- 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 @@ -9,9 +9,8 @@ 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 + # Returns mandatory for classic line thanks to _sql_constraints and view product_id = fields.Many2one(required=False) - product_qty = fields.Float(required=False) # New fields to handle section & note name = fields.Text(string="Description") @@ -21,3 +20,14 @@ class MrpBomLine(models.Model): default=False, help="Technical field for UX purpose.", ) + + _sql_constraints = [ + ('bom_required_fields', + "CHECK(display_type IS NOT NULL OR" + "(product_id IS NOT NULL AND product_qty IS NOT NULL))", + "Missing required fields on bom line."), + ('non_bom_null_fields', + "CHECK(display_type IS NULL OR" + "(product_id IS NULL AND product_qty = 1))", + "Forbidden values on note and section bom line"), + ] diff --git a/mrp_bom_widget_section_and_note_one2many/readme/ROADMAP.rst b/mrp_bom_widget_section_and_note_one2many/readme/ROADMAP.rst new file mode 100644 index 000000000..3fa137b0c --- /dev/null +++ b/mrp_bom_widget_section_and_note_one2many/readme/ROADMAP.rst @@ -0,0 +1,3 @@ +mrp_bom_component_menu module (and maybe more) displays bom lines and it +display lines of sections and note, with product_id empty. It should not display +theses lines 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 index 4260f9cfd..3037942dc 100644 --- a/mrp_bom_widget_section_and_note_one2many/static/description/index.html +++ b/mrp_bom_widget_section_and_note_one2many/static/description/index.html @@ -378,12 +378,13 @@ section_and_note_fields_backend.js in account module.

+
+

Known issues / Roadmap

+

mrp_bom_component_menu module (and maybe more) displays bom lines and it +display lines of sections and note, with product_id empty. It should not display +theses lines

+
-

Bug Tracker

+

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 @@ -409,28 +416,28 @@ If you spotted it first, help us smashing it by providing a detailed and welcome

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

-

Credits

+

Credits

-

Authors

+

Authors

-

Contributors

+

Contributors

-

Other credits

+

Other credits

-

Maintainers

+

Maintainers

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

You are welcome to contribute.