Browse Source

[ADD] create template from survey

12.0
Rémi FRANÇOIS 4 years ago
parent
commit
fcdb6c98c0
  1. 39
      survey_template/i18n/fr.po
  2. 40
      survey_template/i18n/survey_template.pot
  3. 10
      survey_template/models/survey_survey.py
  4. 17
      survey_template/views/survey_survey.xml

39
survey_template/i18n/fr.po

@ -6,8 +6,8 @@ msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0+e\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-03-23 10:28+0000\n"
"PO-Revision-Date: 2020-03-23 10:28+0000\n"
"POT-Creation-Date: 2020-09-28 16:48+0000\n"
"PO-Revision-Date: 2020-09-28 16:48+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
@ -18,15 +18,27 @@ msgstr ""
#. module: survey_template
#: code:addons/survey_template/models/survey_survey.py:16
#: code:addons/survey_template/models/survey_survey.py:17
#: code:addons/survey_template/models/survey_survey.py:43
#: code:addons/survey_template/models/survey_survey.py:45
#: code:addons/survey_template/models/survey_survey.py:46
#: code:addons/survey_template/models/survey_survey.py:52
#: code:addons/survey_template/models/survey_survey.py:54
#: code:addons/survey_template/models/survey_survey.py:55
#, python-format
msgid " (Template)"
msgstr " (Modèle)"
#. module: survey_template
#: code:addons/survey_template/models/survey_survey.py:42
#: code:addons/survey_template/models/survey_survey.py:28
#, python-format
msgid " (copy)"
msgstr " (copie)"
#. module: survey_template
#: code:addons/survey_template/models/survey_survey.py:28
#, python-format
msgid " (template)"
msgstr " (modèle)"
#. module: survey_template
#: code:addons/survey_template/models/survey_survey.py:51
#, python-format
msgid "(Template)"
msgstr "(Modèle)"
@ -47,6 +59,11 @@ msgstr "Créez un nouveau modèle de sondage."
msgid "Create a survey from this template"
msgstr "Créer un sondage depuis ce modèle"
#. module: survey_template
#: model:ir.actions.server,name:survey_template.survey_survey_to_template_server
msgid "Create template from survey"
msgstr "Créer un modèle depuis ce sondage"
#. module: survey_template
#: model_terms:ir.ui.view,arch_db:survey_template.survey_survey_template_kanban
msgid "Delete template"
@ -90,13 +107,19 @@ msgid "This survey is a template"
msgstr "Ce sondage est un modèle"
#. module: survey_template
#: code:addons/survey_template/models/survey_survey.py:33
#: code:addons/survey_template/models/survey_survey.py:42
#, python-format
msgid "You cannot send a template survey, create a new survey from this template and you'll be able to share it."
msgstr "Vous ne pouvez pas partager un modèle de sondage, créez un nouveau sondage à partir de ce modèle et vous pourrez le partager."
#. module: survey_template
#: code:addons/survey_template/models/survey_survey.py:26
#: code:addons/survey_template/models/survey_survey.py:35
#, python-format
msgid "You should use the \"Copy\" secondary action to duplicate a non-template survey."
msgstr "Vous devez utiliser l'action secondaire \"Dupliquer\" pour les sondages qui ne sont pas des modèles."
#. module: survey_template
#: code:addons/survey_template/models/survey_survey.py:26
#, python-format
msgid "You should use the \"Copy\" secondary action to duplicate a survey template."
msgstr "Vous devez utiliser l'action secondaire \"Dupliquer\" pour copier les modèles de sondages."

40
survey_template/i18n/survey_template.pot

@ -6,8 +6,8 @@ msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0+e\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-03-23 10:29+0000\n"
"PO-Revision-Date: 2020-03-23 10:29+0000\n"
"POT-Creation-Date: 2020-09-28 16:53+0000\n"
"PO-Revision-Date: 2020-09-28 16:53+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
@ -18,15 +18,27 @@ msgstr ""
#. module: survey_template
#: code:addons/survey_template/models/survey_survey.py:16
#: code:addons/survey_template/models/survey_survey.py:17
#: code:addons/survey_template/models/survey_survey.py:43
#: code:addons/survey_template/models/survey_survey.py:45
#: code:addons/survey_template/models/survey_survey.py:46
#: code:addons/survey_template/models/survey_survey.py:52
#: code:addons/survey_template/models/survey_survey.py:54
#: code:addons/survey_template/models/survey_survey.py:55
#, python-format
msgid " (Template)"
msgstr ""
#. module: survey_template
#: code:addons/survey_template/models/survey_survey.py:42
#: code:addons/survey_template/models/survey_survey.py:28
#, python-format
msgid " (copy)"
msgstr ""
#. module: survey_template
#: code:addons/survey_template/models/survey_survey.py:28
#, python-format
msgid " (template)"
msgstr ""
#. module: survey_template
#: code:addons/survey_template/models/survey_survey.py:51
#, python-format
msgid "(Template)"
msgstr ""
@ -47,6 +59,11 @@ msgstr ""
msgid "Create a survey from this template"
msgstr ""
#. module: survey_template
#: model:ir.actions.server,name:survey_template.survey_survey_to_template_server
msgid "Create template from survey"
msgstr ""
#. module: survey_template
#: model_terms:ir.ui.view,arch_db:survey_template.survey_survey_template_kanban
msgid "Delete template"
@ -90,13 +107,20 @@ msgid "This survey is a template"
msgstr ""
#. module: survey_template
#: code:addons/survey_template/models/survey_survey.py:33
#: code:addons/survey_template/models/survey_survey.py:42
#, python-format
msgid "You cannot send a template survey, create a new survey from this template and you'll be able to share it."
msgstr ""
#. module: survey_template
#: code:addons/survey_template/models/survey_survey.py:26
#: code:addons/survey_template/models/survey_survey.py:35
#, python-format
msgid "You should use the \"Copy\" secondary action to duplicate a non-template survey."
msgstr ""
#. module: survey_template
#: code:addons/survey_template/models/survey_survey.py:26
#, python-format
msgid "You should use the \"Copy\" secondary action to duplicate a survey template."
msgstr ""

10
survey_template/models/survey_survey.py

@ -20,7 +20,15 @@ class SurveySurvey(models.Model):
# ACTIONS
@api.multi
def create_survey_from_template(self, default=None):
def create_template_from_survey(self, default={}):
self.ensure_one()
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)
@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."))

17
survey_template/views/survey_survey.xml

@ -149,6 +149,23 @@
<field name="act_window_id" ref="survey_survey_template_act_window"/>
</record>
<record id="survey_survey_to_template_server" model="ir.actions.server">
<field name="name">Create template from survey</field>
<field name="model_id" ref="survey.model_survey_survey"/>
<field name="binding_model_id" ref="survey.model_survey_survey"/>
<field name="binding_type">action_form_only</field>
<field name="state">code</field>
<field name="code">
new_template = record.create_template_from_survey()
action = {
'type': 'ir.actions.act_window',
'res_model': model._name,
'res_id': new_template.id,
'views': [(False, 'form')],
}
</field>
</record>
<!-- survey config menus rearrange -->
<record id="survey.menu_surveys_configuration" model="ir.ui.menu">

Loading…
Cancel
Save