Skip to content
Snippets Groups Projects
Commit 39c8c0d3 authored by Juliana's avatar Juliana
Browse files

Add compute field to generate

parent 39316e2a
No related branches found
No related tags found
No related merge requests found
......@@ -247,6 +247,12 @@ class Project(models.Model):
nb_jour_theorique_tot = fields.Float(
"Nombre de jours théoriques total",
compute='_compute_nb_jour_theorique_tot')
nb_jour_tot = fields.Float(
"Nombre de jours total",
compute='_compute_nb_jour_tot')
nb_heure_tot = fields.Float(
"Nombre d'heures' total",
compute='_compute_nb_jour_tot')
total_cout_adefpat = fields.Float(
"Total coûts CFD",
compute='_compute_total_cout_adefpat')
......@@ -337,7 +343,19 @@ class Project(models.Model):
total_jour = 0.0
for cout in project.cout_ids:
total_jour += cout.nb_jour_theorique
project.nb_jour_theorique_tot = total_jour
project.nb_jour_theorique_tot = total_jour\
@api.depends('cout_ids', 'cout_ids.nb_jour_theorique', 'cout_ids.nb_jour_pratiques')
@api.multi
def _compute_nb_jour_tot(self):
for project in self:
total_jour = 0.0
total_heure = 0.0
for cout in project.cout_ids:
total_jour += cout.nb_jour_tot
total_heure += cout.nb_heure_tot
project.nb_jour_tot = total_jour
project.nb_heure_tot = total_heure * 7
@api.depends('nb_jours_adefpat', 'cout_jour_adefpat')
@api.multi
......@@ -629,7 +647,7 @@ class AdefpatCout(models.Model):
_name = 'adefpat.project.cout'
_description = 'Coûts'
module = fields.Char("Nom du module", required=True,)
module = fields.Char("Nom du module")
partner_id = fields.Many2one(
'res.partner',
string='Consultant',
......@@ -637,7 +655,7 @@ class AdefpatCout(models.Model):
('active', '=', True),
('is_company', '=', False),
('is_consultant_form', '=', True)],
on_delete='restrict')
on_delete='restrict',)
nb_jour_theorique = fields.Float("Nombre de jours théoriques")
nb_jour_pratiques = fields.Float("Nombre de jours pratiques")
nb_jour_tot = fields.Float("Nombre de jours total", compute='_compute_nb_jour_tot', store=True)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment