From 3bbf135d52be3eba0938cfe2650d6695831510ee Mon Sep 17 00:00:00 2001 From: clementmbr Date: Thu, 9 Jul 2020 11:20:05 -0300 Subject: [PATCH] [IMP] rename task emails into failure_emails and improve tasks views --- .../models/attachment_queue.py | 4 +-- .../models/attachment_synchronize_task.py | 27 ++++++++++------- .../attachment_synchronize_task_views.xml | 29 ++++++++++--------- 3 files changed, 34 insertions(+), 26 deletions(-) diff --git a/attachment_synchronize/models/attachment_queue.py b/attachment_synchronize/models/attachment_queue.py index 19c173761..48327c76c 100644 --- a/attachment_synchronize/models/attachment_queue.py +++ b/attachment_synchronize/models/attachment_queue.py @@ -28,8 +28,8 @@ class AttachmentQueue(models.Model): def _get_failure_emails(self): res = super()._get_failure_emails() - if self.task_id.emails: - res = self.task_id.emails + if self.task_id.failure_emails: + res = self.task_id.failure_emails return res @api.onchange("task_id") diff --git a/attachment_synchronize/models/attachment_synchronize_task.py b/attachment_synchronize/models/attachment_synchronize_task.py index 649cd03ba..b682a6d4c 100644 --- a/attachment_synchronize/models/attachment_synchronize_task.py +++ b/attachment_synchronize/models/attachment_synchronize_task.py @@ -51,10 +51,11 @@ class AttachmentSynchronizeTask(models.Model): name = fields.Char(required=True) method_type = fields.Selection( - [("import", "Import"), ("export", "Export")], required=True + [("import", "Import Task"), ("export", "Export Task")], required=True ) pattern = fields.Char( - help="Used to select the files to be imported. Import all the files if empty." + string="Selection Pattern", + help="Used to select the files to be imported. If empty, import all the files.", ) filepath = fields.Char( string="File Path", help="Path to imported/exported files in the Backend" @@ -83,16 +84,20 @@ class AttachmentSynchronizeTask(models.Model): file_type = fields.Selection( selection=[], string="File Type", - help="The file type indicates what Odoo will do with the files once imported", + help="The file type allows Odoo to recognize what to do with the files " + "once imported.", ) enabled = fields.Boolean("Enabled", default=True) avoid_duplicated_files = fields.Boolean( - string="Avoid duplicated files importation", - help="If checked, will avoid duplication file import", + string="Avoid importing duplicated files", + help="If checked, a file will not be imported if there is already an " + "Attachment Queue with the same name.", ) - emails = fields.Char( - string="Notification Emails", - help="These emails will receive a notification in case of the task failure", + failure_emails = fields.Char( + string="Failure Emails", + help="Used to fill the field 'Failure Emails' in the task related " + "Attachments Queues.\nThese emails will be notified if any operation on these " + "Attachment Queue's file type fails.", ) def _prepare_attachment_vals(self, data, filename): @@ -111,14 +116,16 @@ class AttachmentSynchronizeTask(models.Model): try: template = mako_template_env.from_string(tools.ustr(template)) except Exception: - _logger.exception("Failed to load template %r", template) + _logger.exception("Failed to load template '{}'".format(template)) variables = {"obj": record} try: render_result = template.render(variables) except Exception: _logger.exception( - "Failed to render template %r using values %r" % (template, variables) + "Failed to render template '{}'' using values '{}'".format( + template, variables + ) ) render_result = u"" if render_result == u"False": diff --git a/attachment_synchronize/views/attachment_synchronize_task_views.xml b/attachment_synchronize/views/attachment_synchronize_task_views.xml index 171027155..5d2da5bd1 100644 --- a/attachment_synchronize/views/attachment_synchronize_task_views.xml +++ b/attachment_synchronize/views/attachment_synchronize_task_views.xml @@ -12,7 +12,7 @@
-
-
+
- - + - + @@ -47,7 +48,7 @@ - + @@ -61,14 +62,14 @@ - + - + - + -