[IMP] constrains, roadmap, flake8

This commit is contained in:
Quentin Dupont
2022-06-22 10:14:36 +02:00
parent fc37ede7d5
commit ca91f068b3
6 changed files with 43 additions and 16 deletions

View File

@@ -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 .. 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 Bug Tracker
=========== ===========

View File

@@ -7,7 +7,7 @@
"name": "MRP Widget Section and Note in BoM", "name": "MRP Widget Section and Note in BoM",
"summary": "Add section and note in Bills of Materials", "summary": "Add section and note in Bills of Materials",
"version": "12.0.1.1.0", "version": "12.0.1.1.0",
"category": "GRAP - Incubator", "category": "Manufacturing/Manufacturing",
"author": "GRAP," "author": "GRAP,"
"Odoo Community Association (OCA)", "Odoo Community Association (OCA)",
"website": "https://github.com/grap/grap-odoo-incubator", "website": "https://github.com/grap/grap-odoo-incubator",

View File

@@ -10,7 +10,7 @@ class MrpBom(models.Model):
_inherit = "mrp.bom" _inherit = "mrp.bom"
# Split bom_line_ids in two fields handled thanks to domain # 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_ids = fields.One2many(domain=[("display_type", "=", False)])
bom_line_with_sectionnote_ids = fields.One2many( bom_line_with_sectionnote_ids = fields.One2many(

View File

@@ -9,9 +9,8 @@ from odoo import fields, models
class MrpBomLine(models.Model): class MrpBomLine(models.Model):
_inherit = "mrp.bom.line" _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_id = fields.Many2one(required=False)
product_qty = fields.Float(required=False)
# New fields to handle section & note # New fields to handle section & note
name = fields.Text(string="Description") name = fields.Text(string="Description")
@@ -21,3 +20,14 @@ class MrpBomLine(models.Model):
default=False, default=False,
help="Technical field for UX purpose.", 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"),
]

View File

@@ -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

View File

@@ -378,12 +378,13 @@ section_and_note_fields_backend.js in account module.</p>
<div class="contents local topic" id="contents"> <div class="contents local topic" id="contents">
<ul class="simple"> <ul class="simple">
<li><a class="reference internal" href="#usage" id="id1">Usage</a></li> <li><a class="reference internal" href="#usage" id="id1">Usage</a></li>
<li><a class="reference internal" href="#bug-tracker" id="id2">Bug Tracker</a></li> <li><a class="reference internal" href="#known-issues-roadmap" id="id2">Known issues / Roadmap</a></li>
<li><a class="reference internal" href="#credits" id="id3">Credits</a><ul> <li><a class="reference internal" href="#bug-tracker" id="id3">Bug Tracker</a></li>
<li><a class="reference internal" href="#authors" id="id4">Authors</a></li> <li><a class="reference internal" href="#credits" id="id4">Credits</a><ul>
<li><a class="reference internal" href="#contributors" id="id5">Contributors</a></li> <li><a class="reference internal" href="#authors" id="id5">Authors</a></li>
<li><a class="reference internal" href="#other-credits" id="id6">Other credits</a></li> <li><a class="reference internal" href="#contributors" id="id6">Contributors</a></li>
<li><a class="reference internal" href="#maintainers" id="id7">Maintainers</a></li> <li><a class="reference internal" href="#other-credits" id="id7">Other credits</a></li>
<li><a class="reference internal" href="#maintainers" id="id8">Maintainers</a></li>
</ul> </ul>
</li> </li>
</ul> </ul>
@@ -400,8 +401,14 @@ section_and_note_fields_backend.js in account module.</p>
<img alt="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" src="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" /> <img alt="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" src="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" />
</div> </div>
</div> </div>
<div class="section" id="known-issues-roadmap">
<h1><a class="toc-backref" href="#id2">Known issues / Roadmap</a></h1>
<p>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</p>
</div>
<div class="section" id="bug-tracker"> <div class="section" id="bug-tracker">
<h1><a class="toc-backref" href="#id2">Bug Tracker</a></h1> <h1><a class="toc-backref" href="#id3">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/quentinDupont/manufacture/issues">GitHub Issues</a>. <p>Bugs are tracked on <a class="reference external" href="https://github.com/quentinDupont/manufacture/issues">GitHub Issues</a>.
In case of trouble, please check there if your issue has already been reported. 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 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
<p>Do not contact contributors directly about support or help with technical issues.</p> <p>Do not contact contributors directly about support or help with technical issues.</p>
</div> </div>
<div class="section" id="credits"> <div class="section" id="credits">
<h1><a class="toc-backref" href="#id3">Credits</a></h1> <h1><a class="toc-backref" href="#id4">Credits</a></h1>
<div class="section" id="authors"> <div class="section" id="authors">
<h2><a class="toc-backref" href="#id4">Authors</a></h2> <h2><a class="toc-backref" href="#id5">Authors</a></h2>
<ul class="simple"> <ul class="simple">
<li>GRAP</li> <li>GRAP</li>
</ul> </ul>
</div> </div>
<div class="section" id="contributors"> <div class="section" id="contributors">
<h2><a class="toc-backref" href="#id5">Contributors</a></h2> <h2><a class="toc-backref" href="#id6">Contributors</a></h2>
<ul class="simple"> <ul class="simple">
<li>BADEP</li> <li>BADEP</li>
<li>Quentin Dupont (<a class="reference external" href="mailto:quentin.dupont&#64;grap.coop">quentin.dupont&#64;grap.coop</a>)</li> <li>Quentin Dupont (<a class="reference external" href="mailto:quentin.dupont&#64;grap.coop">quentin.dupont&#64;grap.coop</a>)</li>
</ul> </ul>
</div> </div>
<div class="section" id="other-credits"> <div class="section" id="other-credits">
<h2><a class="toc-backref" href="#id6">Other credits</a></h2> <h2><a class="toc-backref" href="#id7">Other credits</a></h2>
<ul class="simple"> <ul class="simple">
<li>Code inspired by BADEP repo in v14 <a class="reference external" href="https://github.com/BADEP/addons/blob/14.0/mrp_bom_section">https://github.com/BADEP/addons/blob/14.0/mrp_bom_section</a></li> <li>Code inspired by BADEP repo in v14 <a class="reference external" href="https://github.com/BADEP/addons/blob/14.0/mrp_bom_section">https://github.com/BADEP/addons/blob/14.0/mrp_bom_section</a></li>
</ul> </ul>
</div> </div>
<div class="section" id="maintainers"> <div class="section" id="maintainers">
<h2><a class="toc-backref" href="#id7">Maintainers</a></h2> <h2><a class="toc-backref" href="#id8">Maintainers</a></h2>
<p>This module is part of the <a class="reference external" href="https://github.com/quentinDupont/manufacture/tree/12.0_ADD_MRP_Widget_Sectionnote/mrp_bom_widget_section_and_note_one2many">quentinDupont/manufacture</a> project on GitHub.</p> <p>This module is part of the <a class="reference external" href="https://github.com/quentinDupont/manufacture/tree/12.0_ADD_MRP_Widget_Sectionnote/mrp_bom_widget_section_and_note_one2many">quentinDupont/manufacture</a> project on GitHub.</p>
<p>You are welcome to contribute.</p> <p>You are welcome to contribute.</p>
</div> </div>