Skip to content

Commit

Permalink
[UDP] mis_builder: enforce unique style name
Browse files Browse the repository at this point in the history
  • Loading branch information
chaule97 committed Dec 10, 2024
1 parent 21bccb7 commit 019288f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion mis_builder/models/mis_report_style.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ def check_positive_val(self):
}

# style name
# TODO enforce uniqueness
name = fields.Char(string="Style name", required=True)

# color
Expand Down Expand Up @@ -133,6 +132,10 @@ def check_positive_val(self):
hide_always_inherit = fields.Boolean(default=True)
hide_always = fields.Boolean(default=False)

_sql_constraints = [
("style_name_event_uniq", "unique(name)", "Style name should be unique")
]

@api.model
def merge(self, styles):
"""Merge several styles, giving priority to the last.
Expand Down

0 comments on commit 019288f

Please sign in to comment.