diff --git a/cotisations/models.py b/cotisations/models.py index dcb62408..00978275 100644 --- a/cotisations/models.py +++ b/cotisations/models.py @@ -138,7 +138,7 @@ class Facture(BaseInvoice): abstract = False permissions = ( # TODO : change facture to invoice - ("change_facture_control", _("Can edit the \"controlled\" state")), + ("change_facture_control", _('Can edit the "controlled" state')), ("view_facture", _("Can view an invoice object")), ("change_all_facture", _("Can edit all the previous invoices")), ) @@ -166,7 +166,7 @@ class Facture(BaseInvoice): return ( False, _("You don't have the right to edit this user's invoices."), - ("cotisations.change_all_facture",) + permissions, + ("cotisations.change_all_facture",) + (permissions or ()), ) elif not user_request.has_perm("cotisations.change_all_facture") and ( self.control or not self.valid @@ -198,7 +198,7 @@ class Facture(BaseInvoice): return ( False, _("You don't have the right to delete this user's invoices."), - ("cotisations.change_all_facture",) + permissions, + ("cotisations.change_all_facture",) + (permissions or ()), ) elif not user_request.has_perm("cotisations.change_all_facture") and ( self.control or not self.valid @@ -243,7 +243,7 @@ class Facture(BaseInvoice): can = user_request.has_perm("cotisations.change_facture_control") return ( can, - _("You don't have the right to edit the \"controlled\" state.") + _('You don\'t have the right to edit the "controlled" state.') if not can else None, ("cotisations.change_facture_control",), @@ -297,21 +297,21 @@ class Facture(BaseInvoice): for purchase in self.vente_set.all(): if hasattr(purchase, "cotisation"): cotisation = purchase.cotisation - if cotisation.type_cotisation == 'Connexion': + if cotisation.type_cotisation == "Connexion": cotisation.date_start = date_con date_con += relativedelta( months=(purchase.duration or 0) * purchase.number, days=(purchase.duration_days or 0) * purchase.number, ) cotisation.date_end = date_con - elif cotisation.type_cotisation == 'Adhesion': + elif cotisation.type_cotisation == "Adhesion": cotisation.date_start = date_adh date_adh += relativedelta( months=(purchase.duration or 0) * purchase.number, days=(purchase.duration_days or 0) * purchase.number, ) cotisation.date_end = date_adh - else: # it is assumed that adhesion is required for a connexion + else: # it is assumed that adhesion is required for a connexion date = min(date_adh, date_con) cotisation.date_start = date date_adh += relativedelta( @@ -566,7 +566,7 @@ class Vente(RevMixin, AclMixin, models.Model): return ( False, _("You don't have the right to edit this user's purchases."), - ("cotisations.change_all_facture",) + permissions, + ("cotisations.change_all_facture",) + (permissions or ()), ) elif not user_request.has_perm("cotisations.change_all_vente") and ( self.facture.control or not self.facture.valid diff --git a/machines/models.py b/machines/models.py index 84e9f157..8c1df4c5 100644 --- a/machines/models.py +++ b/machines/models.py @@ -178,7 +178,7 @@ class Machine(RevMixin, FieldPermissionModelMixin, AclMixin, models.Model): return ( False, _("You don't have the right to edit a machine of another" " user."), - ("machines.change_interface",) + permissions, + ("machines.change_interface",) + (permissions or ()), ) return True, None, None @@ -199,7 +199,7 @@ class Machine(RevMixin, FieldPermissionModelMixin, AclMixin, models.Model): "You don't have the right to delete a machine" " of another user." ), - ("machines.change_interface",) + permissions, + ("machines.change_interface",) + (permissions or ()), ) return True, None, None @@ -1344,7 +1344,7 @@ class Interface(RevMixin, AclMixin, FieldPermissionModelMixin, models.Model): return ( False, _("You don't have the right to edit a machine of another" " user."), - ("machines.change_interface",) + permissions, + ("machines.change_interface",) + (permissions or ()), ) return True, None, None @@ -1362,7 +1362,7 @@ class Interface(RevMixin, AclMixin, FieldPermissionModelMixin, models.Model): return ( False, _("You don't have the right to edit a machine of another" " user."), - ("machines.change_interface",) + permissions, + ("machines.change_interface",) + (permissions or ()), ) return True, None, None @@ -1482,7 +1482,7 @@ class Ipv6List(RevMixin, AclMixin, FieldPermissionModelMixin, models.Model): return ( False, _("You don't have the right to edit a machine of another user."), - ("machines.change_ipv6list",) + permissions, + ("machines.change_ipv6list",) + (permissions or ()), ) return True, None, None