diff --git a/lefilament_projets.py b/lefilament_projets.py index 06793c45b02bdff0826bc5dc402969f57727c439..cbdc39d77add31c3d41469f16e7ab05f8d02b9e1 100644 --- a/lefilament_projets.py +++ b/lefilament_projets.py @@ -10,6 +10,7 @@ class SapovalPartners(models.Model): _inherit = 'project.project' 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_projet = fields.Float('Allouées (h)', compute='_total_heures') @@ -20,14 +21,7 @@ class SapovalPartners(models.Model): @api.one def _taux_horaire(self): - self.lf_taux_horaire = self.lf_tarif_jour / 7.5 - - @api.one - def _total_heures(self): - if (self.lf_tarif_jour != 0.0): - self.lf_heures_projet = (self.lf_total_budget / self.lf_tarif_jour) * 7.5 - else: - self.lf_heures_projet = 0.0 + self.lf_taux_horaire = self.lf_tarif_jour / 8 @api.one def _total_heures_passees(self): @@ -36,10 +30,6 @@ class SapovalPartners(models.Model): res = res + record.effective_hours self.lf_heures_passees = res - @api.one - def _total_heures_restantes(self): - self.lf_heures_restantes = self.lf_heures_projet - self.lf_heures_passees - @api.one def _total_heures_planifiees(self): res = 0.0 @@ -58,3 +48,28 @@ class SapovalPartners(models.Model): else: self.lf_couts_annexes = 0.0 + @api.one + @api.depends('lf_total_budget','lf_couts_annexes') + def _budget_heures(self): + self.lf_heures_budget = self.lf_total_budget - self.lf_couts_annexes + + @api.one + def _total_heures(self): + if (self.lf_tarif_jour != 0.0): + self.lf_heures_projet = (self.lf_heures_budget / self.lf_tarif_jour) * 7.5 + else: + self.lf_heures_projet = 0.0 + + @api.one + def _total_heures_restantes(self): + self.lf_heures_restantes = self.lf_heures_projet - self.lf_heures_passees + + def open_project(self): + return { + 'type': 'ir.actions.act_window', + 'name': 'Projet' + self.name, + 'view_mode': 'kanban', + 'res_model': 'project.project', + 'res_id': self.id, + 'views': [(False, 'kanban')], + } diff --git a/lefilament_projets.pyc b/lefilament_projets.pyc deleted file mode 100644 index 686cbae0e815eb879d5d46c6c85e67a90a2c36cb..0000000000000000000000000000000000000000 Binary files a/lefilament_projets.pyc and /dev/null differ diff --git a/static/src/less/style.less b/static/src/less/style.less index 0d88dd67f8a274a70262e6ce58bf359a83a4fa30..a91c85affc7b922bcb07fe35ac7d7fbfeaf5a0b1 100644 --- a/static/src/less/style.less +++ b/static/src/less/style.less @@ -1,6 +1,5 @@ .o_project_kanban_main { width: 100%!important; } -.o_project_kanban_main a { color: inherit!important; } .lf_cell { padding: 5px 0; border-top: 1px solid #999!important; } .budget_table { margin-top: 10px; margin-bottom: 20px; } diff --git a/views/lefilament_projets_view.xml b/views/lefilament_projets_view.xml index e4c25dd77f197292188bb9de7a5f1989f20ee4a6..cf6c3cb3942d3629e9e7e221595261a1c3a64a58 100644 --- a/views/lefilament_projets_view.xml +++ b/views/lefilament_projets_view.xml @@ -42,6 +42,7 @@ <field name="arch" type="xml"> <xpath expr="//field[@name='state']" position="after"> <field name="lf_total_budget" /> + <field name="lf_heures_budget" /> <field name="lf_heures_projet" /> <field name="lf_heures_planifiees" /> <field name="lf_heures_restantes" /> @@ -57,7 +58,6 @@ <field name="inherit_id" ref="project.view_project_kanban"/> <field name="arch" type="xml"> <xpath expr="//div[@class='o_kanban_primary_left']" position="after"> - <a t-if="record.use_tasks.raw_value" name="%(project.act_project_project_2_project_task_all)d" type="action"> <table class="table table-condensed" style="margin-bottom: 0;"> <thead style="background: transparent; border-bottom: 1px solid #555;"> <tr> @@ -75,14 +75,21 @@ </tbody> </table> <table class="budget_table"><tbody><tr> - <td><strong>Budget : </strong></td> + <td><strong>Budget total : </strong></td> <td><field name="lf_total_budget"> €</field></td> </tr> <tr> <td><strong>Coûts Annexes : </strong></td> <td><field name="lf_couts_annexes"> €</field></td> + </tr> + <tr> + <td><strong>Budget heures : </strong></td> + <td><field name="lf_heures_budget"> €</field></td> </tr></tbody></table> - </a> + <table class="budget_table"><tbody><tr> + <td><a t-if="record.use_tasks.raw_value" name="%(project.act_project_project_2_project_task_all)d" type="action">Voir les tâches</a></td> + <!-- <td><a name="%(act_detail_project)d" type="action">Voir détail projet</a></td> --> + </tr></tbody></table> </xpath> <!-- HIDE TASK AND DOCS NUMBER --> <xpath expr="//div[@class='o_project_kanban_boxes']" position="attributes"> @@ -91,7 +98,5 @@ </field> </record> - - </data> </openerp> \ No newline at end of file