Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
adefpat_project
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Le Filament
Adefpat
adefpat_project
Commits
9eacfb9b
Commit
9eacfb9b
authored
4 years ago
by
Juliana
Browse files
Options
Downloads
Patches
Plain Diff
[ADD] Add field compute for generation doc
parent
20854268
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
models/project.py
+27
-1
27 additions, 1 deletion
models/project.py
with
27 additions
and
1 deletion
models/project.py
+
27
−
1
View file @
9eacfb9b
...
...
@@ -155,6 +155,7 @@ class Project(models.Model):
(
'
date_end_validity
'
,
'
=
'
,
False
)],
string
=
"
Type de convention de financement
"
)
date_ca
=
fields
.
Date
(
"
Date de CA
"
)
date_ca_next
=
fields
.
Date
(
"
Lendemain date de CA
"
,
compute
=
'
_compute_date_ca_next
'
)
date_demarrage
=
fields
.
Date
(
"
Date de démarrage prévisionnel
"
)
# Champs étape "Instruction" => Onglet Dossier
...
...
@@ -241,6 +242,9 @@ class Project(models.Model):
# Info Budget
nb_jours_adefpat
=
fields
.
Float
(
"
Nombre de jours CFD
"
)
cout_jour_adefpat
=
fields
.
Float
(
"
Coût jour CFD
"
)
nb_jour_theorique_tot
=
fields
.
Float
(
"
Nombre de jours théoriques total
"
,
compute
=
'
_compute_nb_jour_theorique_tot
'
)
total_cout_adefpat
=
fields
.
Float
(
"
Total coûts CFD
"
,
compute
=
'
_compute_total_cout_adefpat
'
)
...
...
@@ -299,6 +303,13 @@ class Project(models.Model):
# Champs étape "Prêt pour CA" => Onglet Général
num_dossier
=
fields
.
Char
(
"
Numéro de dossier
"
)
@api.depends
(
'
date_ca
'
)
@api.multi
def
_compute_date_ca_next
(
self
):
for
project
in
self
:
if
project
.
date_ca
:
project
.
date_ca_next
=
project
.
date_ca
+
timedelta
(
days
=
1
)
@api.depends
(
'
financement_ids
'
,
'
financement_ids.montant
'
)
@api.multi
def
_compute_total_financment
(
self
):
...
...
@@ -317,6 +328,15 @@ class Project(models.Model):
total_cout
+=
cout
.
montant
project
.
total_cout
=
total_cout
@api.depends
(
'
cout_ids
'
,
'
cout_ids.nb_jour_theorique
'
)
@api.multi
def
_compute_nb_jour_theorique_tot
(
self
):
for
project
in
self
:
total_jour
=
0.0
for
cout
in
project
.
cout_ids
:
total_jour
+=
cout
.
nb_jour_theorique
project
.
nb_jour_theorique_tot
=
total_jour
@api.depends
(
'
nb_jours_adefpat
'
,
'
cout_jour_adefpat
'
)
@api.multi
def
_compute_total_cout_adefpat
(
self
):
...
...
@@ -540,7 +560,7 @@ class AdefpatPorteursProjets(models.Model):
string
=
"
Prénom
"
,
store
=
False
)
commune
=
fields
.
Char
(
rela
te
d
=
'
porteur_id.city
'
,
compu
te
=
'
_compute_commune
'
,
string
=
"
Commune
"
,
store
=
False
)
mobile
=
fields
.
Char
(
...
...
@@ -570,6 +590,12 @@ class AdefpatPorteursProjets(models.Model):
string
=
'
Projet
'
,
default
=
lambda
self
:
self
.
env
.
context
.
get
(
'
default_project_id
'
))
@api.depends
(
'
porteur_id
'
)
def
_compute_commune
(
self
):
for
r
in
self
:
if
r
.
porteur_id
:
r
.
commune
=
r
.
porteur_id
.
city
.
lower
()
class
AdefpatStatut
(
models
.
Model
):
_name
=
'
adefpat.project.statut
'
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment