Browse Source

[FIX] return

12.0
Rémi FRANÇOIS 4 years ago
parent
commit
d93d135035
  1. 20
      survey_template/models/survey_survey.py

20
survey_template/models/survey_survey.py

@ -25,14 +25,30 @@ class SurveySurvey(models.Model):
if self.is_template: if self.is_template:
raise UserError(_("You should use the \"Copy\" secondary action to duplicate a survey template.")) raise UserError(_("You should use the \"Copy\" secondary action to duplicate a survey template."))
default.update({'is_template': True}) 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 @api.multi
def create_survey_from_template(self, default={}): def create_survey_from_template(self, default={}):
self.ensure_one() self.ensure_one()
if not self.is_template: if not self.is_template:
raise UserError(_("You should use the \"Copy\" secondary action to duplicate a non-template survey.")) 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 @api.multi
def action_send_survey(self): def action_send_survey(self):

Loading…
Cancel
Save