summaryrefslogtreecommitdiff
path: root/addons/microsoft_calendar/utils
diff options
context:
space:
mode:
authorVictor Feyens <vfe@odoo.com>2020-08-18 12:26:51 +0000
committerThibault Delavallée <tde@odoo.com>2020-08-31 11:45:43 +0000
commit1cc6bb1231401ea7f501d2f5b5e9641ec8734850 (patch)
tree9c6da86e0a5a13368365c895e77ede2b1ebac3d9 /addons/microsoft_calendar/utils
parentdf06d7f9c488ab3e463baed10b55bea8bbfb5908 (diff)
[IMP] various: improve code style and performance by improve ``all()`` usage
PURPOSE Clean code. Be more performance oriented. SPECIFICATIONS Improvements applied in this commit * not all() --> any(not) for earlier returns; * all([generator]) --> all(generator) to avoid unnecessary list casting. This code construct is better managed by all; This commit will probably not have a big performance effect on standard production databases. However each performance and cleaning improvement is welcomed. LINKS Task ID-2328619 closes odoo/odoo#56060 Related: odoo/enterprise#12486 Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Diffstat (limited to 'addons/microsoft_calendar/utils')
-rw-r--r--addons/microsoft_calendar/utils/microsoft_event.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/addons/microsoft_calendar/utils/microsoft_event.py b/addons/microsoft_calendar/utils/microsoft_event.py
index cd7ee255daa..2234b1ad6a9 100644
--- a/addons/microsoft_calendar/utils/microsoft_event.py
+++ b/addons/microsoft_calendar/utils/microsoft_event.py
@@ -216,8 +216,8 @@ class MicrosoftEvent(abc.Set):
return self.filter(lambda e: e._odoo_id)
def _get_model(self, env):
- if all([e.is_recurrence() for e in self]):
+ if all(e.is_recurrence() for e in self):
return env['calendar.recurrence']
- if all([not e.is_recurrence() for e in self]):
+ if all(not e.is_recurrence() for e in self):
return env['calendar.event']
raise TypeError("Mixing Microsoft events and Microsoft recurrences")