|
|
@ -25,14 +25,30 @@ class SurveySurvey(models.Model): |
|
|
|
if self.is_template: |
|
|
|
raise UserError(_("You should use the \"Copy\" secondary action to duplicate a survey template.")) |
|
|
|
default.update({'is_template': True}) |
|
|
|
return self.copy(default=default) |
|
|
|
new_survey = self.copy(default=default) |
|
|
|
return { |
|
|
|
'type': 'ir.actions.act_window', |
|
|
|
'res_model': 'survey.survey', |
|
|
|
'view_type': 'form', |
|
|
|
'view_mode': 'form', |
|
|
|
'target': 'current', |
|
|
|
'res_id': new_survey.id, |
|
|
|
} |
|
|
|
|
|
|
|
@api.multi |
|
|
|
def create_survey_from_template(self, default={}): |
|
|
|
self.ensure_one() |
|
|
|
if not self.is_template: |
|
|
|
raise UserError(_("You should use the \"Copy\" secondary action to duplicate a non-template survey.")) |
|
|
|
return self.copy(default=default) |
|
|
|
new_survey = self.copy(default=default) |
|
|
|
return { |
|
|
|
'type': 'ir.actions.act_window', |
|
|
|
'res_model': 'survey.survey', |
|
|
|
'view_type': 'form', |
|
|
|
'view_mode': 'form', |
|
|
|
'target': 'current', |
|
|
|
'res_id': new_survey.id, |
|
|
|
} |
|
|
|
|
|
|
|
@api.multi |
|
|
|
def action_send_survey(self): |
|
|
|