From 7205b17b0c18ae35adb3eb788f8c0e3ca3e701f0 Mon Sep 17 00:00:00 2001 From: Giovanni Date: Wed, 15 Jan 2020 18:41:48 +0100 Subject: [PATCH] - use filtered.mapped in place of search --- attachment_synchronize/README.rst | 1 + attachment_synchronize/__manifest__.py | 3 ++- attachment_synchronize/models/task.py | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/attachment_synchronize/README.rst b/attachment_synchronize/README.rst index 2e34e9854..cd377e983 100644 --- a/attachment_synchronize/README.rst +++ b/attachment_synchronize/README.rst @@ -52,6 +52,7 @@ Contributors * Valentin CHEMIERE * Mourad EL HADJ MIMOUNE * Florian DA COSTA +* Giovanni SERRA Maintainer ---------- diff --git a/attachment_synchronize/__manifest__.py b/attachment_synchronize/__manifest__.py index 9479bedfb..418efa80f 100644 --- a/attachment_synchronize/__manifest__.py +++ b/attachment_synchronize/__manifest__.py @@ -1,5 +1,6 @@ # @ 2016 florian DA COSTA @ Akretion # © 2016 @author Mourad EL HADJ MIMOUNE +# @ 2020 Giovanni Serra @ GSlab.it # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). { @@ -21,7 +22,7 @@ 'security/ir.model.access.csv', ], 'demo': [ -# 'demo/task_demo.xml', + # 'demo/task_demo.xml', ], 'installable': True, 'application': False, diff --git a/attachment_synchronize/models/task.py b/attachment_synchronize/models/task.py index 54f4d8660..7a30e4b2e 100644 --- a/attachment_synchronize/models/task.py +++ b/attachment_synchronize/models/task.py @@ -172,5 +172,5 @@ class StorageTask(models.Model): new_env.cr.commit() def _file_to_import(self, filenames): - imported = self.attachment_ids.search([('name', 'in', [n for n in filenames])]).mapped('name') + imported = self.attachment_ids.filtered(lambda r: r.name in filenames).mapped('name') return list(set(filenames) - set(imported))