Raimon Esteve (Zikzakmedia) avatar Raimon Esteve (Zikzakmedia) committed 8240f01

Check if template available a wizard

Comments (0)

Files changed (3)

electronic_mail_wizard.py

             ])
     send = StateTransition()
 
+    def __init__(self):
+        super(GenerateTemplateEmail, self).__init__()
+        self._error_messages.update({
+            'template_missing': 'You can select a template in this wizard.',
+            })
+
     def render(self, template, record, values):
         '''Renders the template and returns as email object
         :param template: Browse Record of the template
         if not len(wizards) > 0:
             return default
         wizard = wizard_obj.browse(wizards[0])
+        if not wizard.template:
+            self.raise_user_error('template_missing')
         template = wizard.template[0]
         total = len(active_ids)
 
 msgid ""
 msgstr "Content-Type: text/plain; charset=utf-8\n"
 
+msgctxt "error:electronic_mail_wizard.example:"
+msgid "You can select a template in this wizard."
+msgstr "Selecciona una plantilla per aquesta acció."
+
+msgctxt "error:electronic_mail_wizard.templateemail:"
+msgid "You can select a template in this wizard."
+msgstr "Selecciona una plantilla per aquesta acció."
+
 msgctxt "field:electronic.mail.template,wizard:"
 msgid "Wizard"
 msgstr "Assistent"
 msgid "Send Email"
 msgstr "Envia correu"
 
+msgctxt "wizard_button:electronic_mail_wizard.example,start,end:"
+msgid "Cancel"
+msgstr "Cancel·lar"
+
+msgctxt "wizard_button:electronic_mail_wizard.example,start,send:"
+msgid "Send"
+msgstr "Enviar"
+
 msgctxt "wizard_button:electronic_mail_wizard.templateemail,start,end:"
 msgid "Cancel"
 msgstr "Cancel·lar"
 msgid ""
 msgstr "Content-Type: text/plain; charset=utf-8\n"
 
+msgctxt "error:electronic_mail_wizard.example:"
+msgid "You can select a template in this wizard."
+msgstr "Seleccione una plantilla para esta acción."
+
+msgctxt "error:electronic_mail_wizard.templateemail:"
+msgid "You can select a template in this wizard."
+msgstr "Seleccione una plantilla para esta acción."
+
 msgctxt "field:electronic.mail.template,wizard:"
 msgid "Wizard"
 msgstr "Asistente"
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.