diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..75bb2042901930f807a588241612a29dd75e34d5 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +.* +*.pyc +!.gitignore diff --git a/lefilament_projets.py b/lefilament_projets.py index 654182ca27ac77d312d5699b2d0875d95ff940da..06793c45b02bdff0826bc5dc402969f57727c439 100644 --- a/lefilament_projets.py +++ b/lefilament_projets.py @@ -16,6 +16,7 @@ class SapovalPartners(models.Model): lf_heures_passees = fields.Float('Heures passées', compute='_total_heures_passees') lf_heures_restantes = fields.Float('Restant (h)', compute='_total_heures_restantes') lf_heures_planifiees = fields.Float('Planifiées (h)', compute='_total_heures_planifiees') + lf_couts_annexes = fields.Float('Coûts Annexes', compute='_couts_annexes') @api.one def _taux_horaire(self): @@ -44,4 +45,16 @@ class SapovalPartners(models.Model): res = 0.0 for record in self.task_ids: res = res + record.planned_hours - self.lf_heures_planifiees = res \ No newline at end of file + self.lf_heures_planifiees = res + + @api.one + def _couts_annexes(self): + account = self.analytic_account_id.id + ############## Calcul couts annexes ################ + self.env.cr.execute("select sum(amount) from account_analytic_line where amount<0 and is_timesheet=FALSE and account_id=%s;", (account, ) ) + couts_annexes = self.env.cr.fetchone()[0] + if couts_annexes: + self.lf_couts_annexes = couts_annexes * (-1.0) + else: + self.lf_couts_annexes = 0.0 + diff --git a/lefilament_projets.pyc b/lefilament_projets.pyc index ec7b34830ecf4f7e24cfe6c07f3b8b25422266c2..686cbae0e815eb879d5d46c6c85e67a90a2c36cb 100644 Binary files a/lefilament_projets.pyc and b/lefilament_projets.pyc differ diff --git a/static/src/css/style.css b/static/src/css/style.css new file mode 100644 index 0000000000000000000000000000000000000000..0c70eb75422a4b07db5047e74b9a85e4e930db1a --- /dev/null +++ b/static/src/css/style.css @@ -0,0 +1,6 @@ + +.o_project_kanban_main { width: 100%!important; } + +.lf_cell { padding: 5px 0;border-top: 1px solid #555; } +.budget_table { margin-top: 10px; } +.budget_table td { padding: 0 5px; } \ No newline at end of file diff --git a/views/lefilament_projets_view.xml b/views/lefilament_projets_view.xml index f7fa703157fe07e54d059ba2e7bd359b40f3756b..f4b15e38b014607b5637c7d266e2cafe211854e1 100644 --- a/views/lefilament_projets_view.xml +++ b/views/lefilament_projets_view.xml @@ -2,7 +2,14 @@ <openerp> <data> - + + <!-- Assets --> + <template id="assets_backend" name="project assets le filament" inherit_id="web.assets_backend"> + <xpath expr="." position="inside"> + <link rel="stylesheet" href="/lefilament_projets/static/src/css/style.css"/> + </xpath> + </template> + <!-- Project Form --> <record id="view_form_lefilament_project_form_inherited" model="ir.ui.view"> <field name="name">Le Filament Projets</field> @@ -38,6 +45,7 @@ <field name="lf_heures_projet" /> <field name="lf_heures_planifiees" /> <field name="lf_heures_restantes" /> + <field name="lf_couts_annexes" /> </xpath> </field> </record> @@ -49,35 +57,35 @@ <field name="inherit_id" ref="project.view_project_kanban"/> <field name="arch" type="xml"> <xpath expr="//div[@class='o_kanban_primary_left']" position="after"> - <field name="lf_total_budget"> euros</field> <table class="table table-condensed" style="margin-bottom: 0;"> <thead style="background: transparent; border-bottom: 1px solid #555;"> <tr> - <td style="padding: 5px 0;">potentiel</td> - <td style="padding: 5px 0;">planifié</td> + <td>vendues</td> + <td>passées</td> + <td>restantes</td> </tr> </thead> <tbody> <tr> - <td style="padding: 5px 0;border-top: 1px solid #555;"><field name="lf_heures_projet" >h</field></td> - <td style="padding: 5px 0;border-top: 1px solid #555;"><field name="lf_heures_planifiees" >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> </tr> </tbody> </table> - <table class="table table-condensed"> - <thead style="background: transparent; border-bottom: 1px solid #555;"> - <tr> - <td style="padding: 5px 0;">en cours</td> - <td style="padding: 5px 0;">reste</td> - </tr> - </thead> - <tbody> - <tr> - <td style="padding: 5px 0;border-top: 1px solid #555;"><field name="lf_heures_passees" >h</field></td> - <td style="padding: 5px 0;border-top: 1px solid #555;"><field name="lf_heures_restantes" >h</field></td> - </tr> - </tbody> - </table> + <table class="budget_table"><tbody><tr> + <td><strong>Budget : </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></tbody></table> + + </xpath> + <!-- HIDE TASK AND DOCS NUMBER --> + <xpath expr="//div[@class='o_project_kanban_boxes']" position="attributes"> + <attribute name="invisible">1</attribute> </xpath> </field> </record>