eo_redmine: filtrage par CPF sur la page d'accueil (#83270)
gitea/barbacompta/pipeline/head This commit looks good
Details
gitea/barbacompta/pipeline/head This commit looks good
Details
This commit is contained in:
parent
cfcf6c378f
commit
1f365742c7
|
@ -168,13 +168,16 @@ def dict_of_list():
|
|||
|
||||
@register.inclusion_tag('eo_facture/table.html')
|
||||
@cache
|
||||
def income_by_clients(year=None):
|
||||
def income_by_clients(user=None, year=None):
|
||||
if not year:
|
||||
year = date.today().year
|
||||
contracted_by_clients = zero_dict()
|
||||
invoiced_by_clients = zero_dict()
|
||||
total_by_clients = zero_dict()
|
||||
for contrat in Contrat.objects.select_related('client').prefetch_related(
|
||||
contrats = Contrat.objects
|
||||
if user:
|
||||
contrats = contrats.filter(client__project__cpfs=user)
|
||||
for contrat in contrats.select_related('client').prefetch_related(
|
||||
'factures', 'factures__lignes', 'prestations'
|
||||
):
|
||||
|
||||
|
|
|
@ -7,7 +7,18 @@
|
|||
{% block content %}
|
||||
<div id="content-main">
|
||||
{% echeances %}
|
||||
{% income_by_clients %}
|
||||
|
||||
{% if 'cpf' in request.GET %}
|
||||
<a href="?">Afficher tout le monde</a><br />
|
||||
{% if request.GET.cpf == 'True' %}
|
||||
{% income_by_clients user %}
|
||||
{% else %}
|
||||
{% income_by_clients %}
|
||||
{% endif %}
|
||||
{% else %}
|
||||
<a href="?cpf=True">N'afficher que mes clients</a><br />
|
||||
{% income_by_clients %}
|
||||
{% endif %}
|
||||
{% impayees %}
|
||||
{% a_facturer %}
|
||||
{% finances 8 %}
|
||||
|
|
Loading…
Reference in New Issue