[FIX] website_event: make non-sensical error make sense

Whether a question can belong to itself is too philosophical of a
question for an error pop-up.

opw-3572599

X-original-commit: c798bbbde6fc6e8e42e144f90c163a2ae40a49b8
Part-of: odoo/odoo#144451
This commit is contained in:
Levi Siuzdak (sile)
2023-12-01 14:23:45 +00:00
parent 7023540059
commit 93bd62e445
2 changed files with 8 additions and 1 deletions
@@ -1034,6 +1034,13 @@ msgstr ""
msgid "Question Type"
msgstr ""
#. module: website_event
#. odoo-python
#: code:addons/website_event/models/event_question.py:0
#, python-format
msgid "Question cannot be linked to both an Event and an Event Type."
msgstr ""
#. module: website_event
#. odoo-python
#: code:addons/website_event/models/event_question.py:0
@@ -32,7 +32,7 @@ class EventQuestion(models.Model):
@api.constrains('event_type_id', 'event_id')
def _constrains_event(self):
if any(question.event_type_id and question.event_id for question in self):
raise UserError(_('Question cannot belong to both the event category and itself.'))
raise UserError(_("Question cannot be linked to both an Event and an Event Type."))
def write(self, vals):
""" We add a check to prevent changing the question_type of a question that already has answers.