Migrate to 6.0

This commit is contained in:
Sergio Morillo 2022-07-27 10:37:17 +02:00
parent 121975d2ca
commit 124a5979ae
5 changed files with 20 additions and 12 deletions

View File

@ -10,6 +10,8 @@ from trytond.pool import Pool
from trytond.pyson import Eval
from trytond.tools import grouped_slice
from trytond.transaction import Transaction
from trytond.exceptions import UserError
from trytond.i18n import gettext
from trytond.wizard import Wizard, StateTransition, StateView, Button
__all__ = ['TemplateEmailStart', 'TemplateEmailResult',
@ -78,14 +80,6 @@ class GenerateTemplateEmail(Wizard):
])
send = StateTransition()
@classmethod
def __setup__(cls):
super(GenerateTemplateEmail, cls).__setup__()
cls._error_messages.update({
'template_deleted': (
'This template has been deactivated or deleted.'),
})
def default_start(self, fields):
default = self.render_fields(self.__name__)
return default
@ -107,8 +101,10 @@ class GenerateTemplateEmail(Wizard):
active_ids = context.get('active_ids')
action_id = context.get('action_id', None)
wizard = Wizard(action_id)
template = (wizard.template[0] if wizard.template
else self.raise_user_error('template_deleted'))
if not wizard.template:
raise UserError(gettext(
'electronic_mail_wizard.msg_template_deleted'))
template = wizard.template[0]
total = len(active_ids)
record = pool.get(template.model.model)(active_ids[0])

View File

@ -2,7 +2,7 @@
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "error:electronic_mail_wizard.templateemail:"
msgctxt "model:ir.message,text:msg_template_deleted"
msgid "This template has been deactivated or deleted."
msgstr "Aquesta plantilla s'ha desactivat o eliminat."

View File

@ -2,7 +2,7 @@
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "error:electronic_mail_wizard.templateemail:"
msgctxt "model:ir.message,text:msg_template_deleted"
msgid "This template has been deactivated or deleted."
msgstr "Esta plantilla se ha desactivado o eliminado."

10
message.xml Normal file
View File

@ -0,0 +1,10 @@
<?xml version="1.0"?>
<!-- The COPYRIGHT file at the top level of this repository contains the full
copyright notices and license terms. -->
<tryton>
<data>
<record model="ir.message" id="msg_template_deleted">
<field name="text">This template has been deactivated or deleted.</field>
</record>
</data>
</tryton>

View File

@ -4,6 +4,8 @@ depends:
ir
res
electronic_mail_template
xml:
electronic_mail_wizard.xml
template.xml
message.xml