mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-12-23 07:23:46 +00:00
Merge branch 'fix_divers' into 'dev'
Fix display facture + room + machine_name See merge request federez/re2o!341
This commit is contained in:
commit
b024888288
3 changed files with 14 additions and 9 deletions
|
@ -194,14 +194,16 @@ class Facture(BaseInvoice):
|
||||||
return True, None
|
return True, None
|
||||||
|
|
||||||
def can_view(self, user_request, *_args, **_kwargs):
|
def can_view(self, user_request, *_args, **_kwargs):
|
||||||
if not user_request.has_perm('cotisations.view_facture') and \
|
if not user_request.has_perm('cotisations.view_facture'):
|
||||||
self.user != user_request:
|
if self.user != user_request:
|
||||||
return False, _("You don't have the right to view someone else's "
|
return False, _("You don't have the right to view someone else's "
|
||||||
"invoices history.")
|
"invoices history.")
|
||||||
elif not self.valid:
|
elif not self.valid:
|
||||||
return False, _("The invoice has been invalidated.")
|
return False, _("The invoice has been invalidated.")
|
||||||
else:
|
else:
|
||||||
return True, None
|
return True, None
|
||||||
|
else:
|
||||||
|
return True, None
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def can_change_control(user_request, *_args, **_kwargs):
|
def can_change_control(user_request, *_args, **_kwargs):
|
||||||
|
|
|
@ -197,7 +197,11 @@ class Machine(RevMixin, FieldPermissionModelMixin, models.Model):
|
||||||
def short_name(self):
|
def short_name(self):
|
||||||
"""Par defaut, renvoie le nom de la première interface
|
"""Par defaut, renvoie le nom de la première interface
|
||||||
de cette machine"""
|
de cette machine"""
|
||||||
return str(self.interface_set.first().domain.name)
|
interfaces_set = self.interface_set.first()
|
||||||
|
if interfaces_set:
|
||||||
|
return str(interfaces_set.domain.name)
|
||||||
|
else:
|
||||||
|
return "None"
|
||||||
|
|
||||||
@cached_property
|
@cached_property
|
||||||
def complete_name(self):
|
def complete_name(self):
|
||||||
|
|
|
@ -845,8 +845,7 @@ class User(RevMixin, FieldPermissionModelMixin, AbstractBaseUser,
|
||||||
"""
|
"""
|
||||||
return user_request == self, None
|
return user_request == self, None
|
||||||
|
|
||||||
@staticmethod
|
def can_change_room(self, user_request, *_args, **_kwargs):
|
||||||
def can_change_room(user_request, *_args, **_kwargs):
|
|
||||||
""" Check if a user can change a room
|
""" Check if a user can change a room
|
||||||
|
|
||||||
:param user_request: The user who request
|
:param user_request: The user who request
|
||||||
|
|
Loading…
Reference in a new issue