diff --git a/survey_template/i18n/fr.po b/survey_template/i18n/fr.po index cf310ee..bb99ebd 100644 --- a/survey_template/i18n/fr.po +++ b/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." diff --git a/survey_template/i18n/survey_template.pot b/survey_template/i18n/survey_template.pot index 6740ea0..138cb4b 100644 --- a/survey_template/i18n/survey_template.pot +++ b/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 "" + diff --git a/survey_template/models/survey_survey.py b/survey_template/models/survey_survey.py index ac074b1..a30cca4 100644 --- a/survey_template/models/survey_survey.py +++ b/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.")) diff --git a/survey_template/views/survey_survey.xml b/survey_template/views/survey_survey.xml index 3671eda..1f7626f 100644 --- a/survey_template/views/survey_survey.xml +++ b/survey_template/views/survey_survey.xml @@ -149,6 +149,23 @@ + + Create template from survey + + + action_form_only + 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')], +} + + +