diff --git a/attachment_synchronize/models/attachment_synchronize_task.py b/attachment_synchronize/models/attachment_synchronize_task.py index 25688717e..a7f03edc3 100644 --- a/attachment_synchronize/models/attachment_synchronize_task.py +++ b/attachment_synchronize/models/attachment_synchronize_task.py @@ -101,6 +101,16 @@ class AttachmentSynchronizeTask(models.Model): "related to this task.\nAn alert will be sent to these emails if any operation " "on these Attachment Queue's file type fails.", ) + count_attachment_failed = fields.Integer(compute="_compute_count_state") + count_attachment_pending = fields.Integer(compute="_compute_count_state") + count_attachment_done = fields.Integer(compute="_compute_count_state") + + def _compute_count_state(self): + for record in self: + for state in ["failed", "pending", "done"]: + record["count_attachment_{}".format(state)] = \ + len(record.attachment_ids.filtered(lambda r: r.state == state)) + def _prepare_attachment_vals(self, data, filename): self.ensure_one() diff --git a/attachment_synchronize/views/attachment_queue_views.xml b/attachment_synchronize/views/attachment_queue_views.xml index b62863594..16f993585 100644 --- a/attachment_synchronize/views/attachment_queue_views.xml +++ b/attachment_synchronize/views/attachment_queue_views.xml @@ -32,4 +32,25 @@ + + attachment.queue + + + + + + + + + + Attachments Queue + ir.actions.act_window + attachment.queue + form + tree,form + + [('task_id', '=', active_id)] + + + diff --git a/attachment_synchronize/views/attachment_synchronize_task_views.xml b/attachment_synchronize/views/attachment_synchronize_task_views.xml index 18f4a2dbc..e25082bdd 100644 --- a/attachment_synchronize/views/attachment_synchronize_task_views.xml +++ b/attachment_synchronize/views/attachment_synchronize_task_views.xml @@ -9,6 +9,30 @@
+ + +