Skip to content
Permalink
Browse files

[FIX] website_slides: fix undeletable question answer

Issue

	- Go on Runbot V13
	- eLearning
	- In a course, try to delete a question

	You can't

Cause

	The linked answer is not deleted
	If you want to delete the answer you should
	add an extra menu

Solution

	Add ondelete='cascade' on answer's question_id
	Prevent course deletion if there are attendees

OPW-2210096

X-original-commit: 799ee72
  • Loading branch information
jvm-odoo committed Mar 16, 2020
1 parent e4ebd3e commit 2e00054d77bf52c6ebea7cede12e3c5dd6543d38
Showing with 12 additions and 0 deletions.
  1. +7 −0 addons/website_slides/i18n/website_slides.pot
  2. +5 −0 addons/website_slides/models/slide_slide.py
@@ -2520,6 +2520,13 @@ msgstr ""
msgid "Partner Has New Content"
msgstr ""

#. module: website_slides
#: code:addons/website_slides/models/slide_slide.py:0
#, python-format
msgid ""
"People already took this quiz. To keep course progression it should not be "
"deleted."

#. module: website_slides
#: model_terms:ir.ui.view,arch_db:website_slides.courses_home
msgid "Pick a course"
@@ -457,6 +457,11 @@ def copy(self, default=None):
rec.sequence = 0
return rec

def unlink(self):
if self.question_ids and self.channel_id.channel_partner_ids:
raise UserError(_("People already took this quiz. To keep course progression it should not be deleted."))
super(Slide, self).unlink()

# ---------------------------------------------------------
# Mail/Rating
# ---------------------------------------------------------

0 comments on commit 2e00054

Please sign in to comment.
You can’t perform that action at this time.