diff --git a/app/models/order.py b/app/models/order.py index 31f5620..255704a 100644 --- a/app/models/order.py +++ b/app/models/order.py @@ -118,13 +118,9 @@ class Order(db.Model): def can_modify_prices(self, user_id: int) -> bool: if not self.is_closed(): return False - if user_id is None: - return False - if self.courier_id == user_id: - return True user = User.query.filter_by(id=user_id).first() - return user and user.is_admin() + return user and (user.is_admin() or user == self.courier) def can_modify_payment(self, user_id: int) -> bool: user = User.query.filter_by(id=user_id).first() - return user and (user.is_admin() or user == self.order.courier) + return user and (user.is_admin() or user == self.courier)