Skip to content
GitLab
Explorer
Connexion
Navigation principale
Rechercher ou aller à…
Projet
L
lefilament_projets
Gestion
Activité
Membres
Labels
Programmation
Tickets
Tableaux des tickets
Jalons
Code
Requêtes de fusion
Dépôt
Branches
Validations
Étiquettes
Graphe du dépôt
Comparer les révisions
Analyse
Données d'analyse des chaînes de valeur
Analyse des contributeurs
Données d'analyse du dépôt
Aide
Aide
Support
Documentation de GitLab
Comparer les forfaits GitLab
Forum de la communauté GitLab
Contribuer à GitLab
Donner votre avis
Raccourcis clavier
?
Extraits de code
Groupes
Projets
Afficher davantage de fils d'Ariane
Le Filament
lefilament_projets
Validations
f910bd7b
Valider
f910bd7b
rédigé
Il y a 7 ans
par
Benjamin
Parcourir les fichiers
Options
Téléchargements
Correctifs
Plain Diff
fix erreurs requetes _delay et _total_days
parent
18a9bf5a
Branches
Branches contenant la validation
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
Modifications
1
Afficher les modifications d'espaces
En ligne
Côte à côte
Affichage de
1 fichier modifié
models/lefilament_projets.py
+30
-12
30 ajouts, 12 suppressions
models/lefilament_projets.py
avec
30 ajouts
et
12 suppressions
models/lefilament_projets.py
+
30
−
12
Voir le fichier @
f910bd7b
...
...
@@ -86,14 +86,27 @@ class FilamentProjet(models.Model):
@api.one
def
_delay
(
self
):
account_id
=
self
.
analytic_account_id
.
id
self
.
_cr
.
execute
(
"""
SELECT
date(d_invoice) - date(d_cost) as datediff
from
(select date FROM account_analytic_line where account_id=%s and amount < 0 order by date limit 1) as d_cost,
(select date FROM account_analytic_line where account_id=%s and amount > 0 order by date limit 1) as d_invoice
;
"""
,
(
account_id
,
account_id
)
)
self
.
lf_delay
=
self
.
_cr
.
fetchone
()[
0
]
self
.
env
.
cr
.
execute
(
"""
SELECT date
FROM account_analytic_line
where account_id=%s and amount < 0 order by date limit 1
;
"""
,
(
account_id
,
)
)
d_cost
=
self
.
env
.
cr
.
fetchone
()
self
.
env
.
cr
.
execute
(
"""
SELECT date
FROM account_analytic_line
where account_id=%s and amount > 0 order by date limit 1
;
"""
,
(
account_id
,
)
)
d_invoice
=
self
.
env
.
cr
.
fetchone
()
if
d_cost
:
if
d_invoice
:
self
.
lf_delay
=
(
datetime
.
strptime
(
d_invoice
[
0
],
"
%Y-%m-%d
"
).
date
()
-
datetime
.
strptime
(
d_cost
[
0
],
"
%Y-%m-%d
"
).
date
()).
days
else
:
self
.
lf_delay
=
(
datetime
.
now
().
date
()
-
datetime
.
strptime
(
d_cost
[
0
],
"
%Y-%m-%d
"
).
date
()).
days
else
:
self
.
lf_delay
=
0
## Total Days
@api.one
...
...
@@ -106,7 +119,12 @@ class FilamentProjet(models.Model):
(select date FROM account_analytic_line where account_id=%s order by date limit 1) as d_first,
(select date FROM account_analytic_line where account_id=%s order by date desc limit 1) as d_last
;
"""
,
(
account_id
,
account_id
,
)
)
self
.
lf_total_days
=
self
.
_cr
.
fetchone
()[
0
]
lf_total_days
=
self
.
_cr
.
fetchone
()
if
lf_total_days
:
self
.
lf_total_days
=
lf_total_days
[
0
]
else
:
self
.
lf_total_days
=
0
## Balance
@api.one
...
...
@@ -127,10 +145,10 @@ class FilamentProjet(models.Model):
self
.
env
.
cr
.
execute
(
"""
SELECT sum(amount) as Total
FROM account_analytic_line
WHERE account_id=
31
WHERE account_id=
%s
and date < (case when
(select date FROM account_analytic_line where account_id=
31
and amount > 0 order by date limit 1) IS NOT NULL then
(select date FROM account_analytic_line where account_id=
31
and amount > 0 order by date limit 1) else current_date end
(select date FROM account_analytic_line where account_id=
%s
and amount > 0 order by date limit 1) IS NOT NULL then
(select date FROM account_analytic_line where account_id=
%s
and amount > 0 order by date limit 1) else current_date end
);
"""
,
(
account_id
,
account_id
,
account_id
,
)
)
self
.
lf_advance
=
self
.
_cr
.
fetchone
()[
0
]
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
Aperçu
0%
Chargement en cours
Veuillez réessayer
ou
joindre un nouveau fichier
.
Annuler
You are about to add
0
people
to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Enregistrer le commentaire
Annuler
Veuillez vous
inscrire
ou vous
se connecter
pour commenter