From f7697bd481a3d377ddab212265bd040939ceb66b Mon Sep 17 00:00:00 2001 From: Matthias Mair Date: Mon, 2 Dec 2024 00:49:28 +0100 Subject: [PATCH] make logic simpler (#8613) --- src/backend/InvenTree/InvenTree/sso.py | 2 +- src/backend/InvenTree/plugin/base/event/events.py | 2 +- src/backend/InvenTree/stock/models.py | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/backend/InvenTree/InvenTree/sso.py b/src/backend/InvenTree/InvenTree/sso.py index 9279d5819824..b77e9c136ea6 100644 --- a/src/backend/InvenTree/InvenTree/sso.py +++ b/src/backend/InvenTree/InvenTree/sso.py @@ -119,7 +119,7 @@ def ensure_sso_groups(sender, sociallogin: SocialLogin, **kwargs): # remove groups not listed by SSO if not disabled if get_global_setting('SSO_REMOVE_GROUPS'): for group in user.groups.all(): - if not group.name in group_names: + if group.name not in group_names: logger.info(f'Removing group {group.name} from {user}') user.groups.remove(group) diff --git a/src/backend/InvenTree/plugin/base/event/events.py b/src/backend/InvenTree/plugin/base/event/events.py index c99a7547f7f3..ef1bb152b2e7 100644 --- a/src/backend/InvenTree/plugin/base/event/events.py +++ b/src/backend/InvenTree/plugin/base/event/events.py @@ -160,7 +160,7 @@ def allow_table_event(table_name): 'part_partstocktakereport', ] - return not table_name in ignore_tables + return table_name not in ignore_tables @receiver(post_save) diff --git a/src/backend/InvenTree/stock/models.py b/src/backend/InvenTree/stock/models.py index f7598e5a1717..254830602903 100644 --- a/src/backend/InvenTree/stock/models.py +++ b/src/backend/InvenTree/stock/models.py @@ -1359,7 +1359,7 @@ def can_delete(self): if self.installed_item_count() > 0: return False - return not self.sales_order is not None + return self.sales_order is None def get_installed_items(self, cascade: bool = False) -> set[StockItem]: """Return all stock items which are *installed* in this one! @@ -1542,7 +1542,7 @@ def can_adjust_location(self): if self.belongs_to is not None: return False - return not self.sales_order is not None + return self.sales_order is None @property def tracking_info_count(self):