Skip to content
Extraits de code Groupes Projets
Valider 5e2d02d2 rédigé par Rémi - Le Filament's avatar Rémi - Le Filament
Parcourir les fichiers

Add monitoring of prospection hours

parent ab4b2d4f
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -11,10 +11,12 @@ from odoo import models, fields, api, osv
class FilamentProjet(models.Model):
_inherit = 'project.project'
use_prospection = fields.Boolean("Inclure Prospection", default=False)
lf_total_budget = fields.Float('Budget Projet',)
lf_heures_budget = fields.Float('Budget Heures', compute='_budget_heures')
lf_tarif_jour = fields.Float('Tarif Jour',)
lf_taux_horaire = fields.Float('Taux Horaire', compute='_taux_horaire')
lf_heures_prospection = fields.Float('Prospection (h)', compute='_total_heures_prospection')
lf_heures_projet = fields.Float('Allouées (h)', compute='_total_heures')
lf_heures_passees = fields.Float('Heures passées', compute='_total_heures_passees')
lf_heures_restantes = fields.Float('Restant (h)', compute='_total_heures_restantes')
......@@ -36,6 +38,18 @@ class FilamentProjet(models.Model):
lf_heures_jour = self.env['ir.values'].get_default('project.config.settings', 'lf_heures_jour')
self.lf_taux_horaire = self.lf_tarif_jour / lf_heures_jour
@api.one
def _total_heures_prospection(self):
res = 0.0
project = self.id
## Calcul heures
self.env.cr.execute("select sum(aal.unit_amount) from account_analytic_line aal, project_task pt where aal.project_id=%s and pt.name='Prospection' and pt.id=aal.task_id;", (project, ) )
heures_prospection = self.env.cr.fetchone()[0]
if heures_prospection:
self.lf_heures_prospection = heures_prospection
else:
self.lf_heures_prospection = 0.0
@api.one
def _total_heures_passees(self):
res = 0.0
......
......@@ -14,6 +14,12 @@
<button string="Voir le Cash Flow" type="object" name="open_cash_flow" class="oe_highlight"/>
</header>
</xpath>
<xpath expr="//field[@name='use_tasks']" position="before">
<div>
<field name="use_prospection" class="oe_inline"/>
<label for="use_prospection" class="oe_inline"/>
</div>
</xpath>
<xpath expr="//notebook" position="before">
<group>
<group>
......@@ -60,6 +66,7 @@
<field name="arch" type="xml">
<xpath expr="//field[@name='partner_id']" position="after">
<field name="lf_total_budget" />
<field name="lf_heures_prospection"/>
<field name="lf_heures_budget" />
<field name="lf_heures_projet" />
<field name="lf_heures_planifiees" />
......@@ -76,10 +83,14 @@
<field name="model">project.project</field>
<field name="inherit_id" ref="project.view_project_kanban"/>
<field name="arch" type="xml">
<xpath expr="//templates" position="before">
<field name="use_prospection"/>
</xpath>
<xpath expr="//div[@class='o_kanban_primary_left']" position="after">
<table class="table table-condensed" style="margin-bottom: 0;">
<thead style="background: transparent; border-bottom: 1px solid #555;">
<tr>
<td attrs="{'invisible':[('use_prospection', '=', False)]}">prospection</td>
<td>vendues</td>
<td>passées</td>
<td>restantes</td>
......@@ -87,6 +98,7 @@
</thead>
<tbody>
<tr>
<td class="lf_cell" attrs="{'invisible': [('use_prospection', '=', False)]}"><field name="lf_heures_prospection" >h</field></td>
<td class="lf_cell"><field name="lf_heures_projet" >h</field></td>
<td class="lf_cell"><field name="lf_heures_passees" >h</field></td>
<td class="lf_cell"><field name="lf_heures_restantes" >h</field></td>
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter