[FIX] no need uom right anymore

This commit is contained in:
Quentin Dupont
2024-02-29 15:10:09 +01:00
parent c9323abdd4
commit 812c7f2aca
2 changed files with 9 additions and 2 deletions

View File

@@ -11,6 +11,7 @@ class MrpBomLine(models.Model):
# Returns mandatory for classic line thanks to _sql_constraints and view
product_id = fields.Many2one(required=False)
product_uom_id = fields.Many2one(required=False)
# New fields to handle section & note
name = fields.Text(string="Description")
@@ -23,10 +24,15 @@ class MrpBomLine(models.Model):
_sql_constraints = [
(
"bom_required_fields",
"bom_required_fields_product_qty",
"CHECK(display_type IS NOT NULL OR"
"(product_id IS NOT NULL AND product_qty IS NOT NULL))",
"Missing required fields on bom line.",
"Missing required fields on bom line : product and quantity.",
),
(
"bom_required_field_uom",
"CHECK(display_type IS NOT NULL OR" "(product_uom_id IS NOT NULL))",
"Missing required field on bom line : uom.",
),
(
"non_bom_null_fields",

View File

@@ -79,6 +79,7 @@ License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
options="{'no_open':True,'no_create':True}"
groups="uom.group_uom"
attrs="{
'required': [('display_type', '=', False)],
'invisible': [('display_type', '=', True)],
}"
/>