Commit 31e13fc7 authored by Hugo LEVY-FALK's avatar Hugo LEVY-FALK

Message d'erreur du can_create de facture plus verbeux

parent 337c8dd8
...@@ -228,13 +228,13 @@ class Facture(RevMixin, AclMixin, FieldPermissionModelMixin, models.Model): ...@@ -228,13 +228,13 @@ class Facture(RevMixin, AclMixin, FieldPermissionModelMixin, models.Model):
:return: a message and a boolean which is True if the user can create :return: a message and a boolean which is True if the user can create
an invoice or if the `options.allow_self_subscription` is set. an invoice or if the `options.allow_self_subscription` is set.
""" """
nb_payments = len(Paiement.find_allowed_payments(user_request)) if user_request.has_perm('cotisations.add_facture'):
nb_articles = len(Article.find_allowed_articles(user_request)) return True, None
return ( if len(Paiement.find_allowed_payments(user_request)) <= 0:
user_request.has_perm('cotisations.add_facture') return False, _("There are no payment types which you can use.")
or (nb_payments*nb_articles), if len(Article.find_allowed_articles(user_request)):
_("You don't have the right to create an invoice.") return False, _("There are no article that you can buy.")
) return True
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
super(Facture, self).__init__(*args, **kwargs) super(Facture, self).__init__(*args, **kwargs)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment