diff --git a/README.rst b/README.rst index 1d45d6d2ff6152d494440b14181dc8f0fe74a1d9..a6675d5ca3cbff45cbb185c45935f05469560807 100644 --- a/README.rst +++ b/README.rst @@ -7,12 +7,13 @@ Le Filament - Projets ===================== -Hérite du module project et hr_timesheet Odoo et ajoute : - - le calcul des heures imputées et des coûts sur le projet - - le prévisionnel du projet (basé sur une variable du nombre d'heures par jour) - - la progressbar dépensé/budget - - le graphe du cash flow projet - - les heures de prospection (à activer au niveau projet et basé sur le nombre d'heures imputées sur une tâche nommée Prospection) +This module depends upon *hr_timesheet* and *hr_expense* modules. + +This module provides: + - the calculation of imputed hours and costs on the project + - the project estimate (based on a variable of the number of hours per day) + - a progressbar spent / budget + - prospecting hours (new field to set up at the project level and based on the number of hours charged to a task named Prospection) Credits @@ -22,6 +23,7 @@ Contributors ------------ * Benjamin Rivier <benjamin@le-filament.com> * Remi Cazenave <remi@le-filament.com> +* Juliana Poudou <juliana@le-filament.com> Maintainer ---------- diff --git a/__manifest__.py b/__manifest__.py index bbb82904449751cd766a492233b8622e45f83958..7bb9d9fb2e50c6b0cb883451ac507d1e9051e4e5 100644 --- a/__manifest__.py +++ b/__manifest__.py @@ -10,12 +10,14 @@ Module Projet Le Filament - Hérite du module project Odoo et ajoute : - - le calcul des heures imputées et des coûts sur le projet - - le prévisionnel du projet - - la progressbar dépensé/budget - - le graphe du cash flow projet - - les heures de prospection (non incluses dans la progressbar) + This module depends upon *hr_timesheet* and *hr_expense* modules. + + This module provides: + - the calculation of imputed hours and costs on the project + - the project estimate (based on a variable of the number of hours per day) + - a progressbar spent / budget + - prospecting hours (new field to set up at the project level and based on the number of hours charged to a task named Prospection) + """, 'author': 'LE FILAMENT', @@ -24,6 +26,7 @@ 'contributors': [ 'Benjamin Rivier <benjamin@le-filament.com>', 'Rémi Cazenave <remi@le-filament.com>', + 'Juliana Poudou <juliana@le-filament.com>', ], 'website': 'https://le-filament.com', 'data': [ @@ -31,6 +34,5 @@ 'views/lefilament_projets_view.xml', ], 'qweb': [ - 'static/src/xml/*.xml', ], } diff --git a/i18n/fr.po b/i18n/fr.po new file mode 100644 index 0000000000000000000000000000000000000000..01fd3f97b19b3417e229a12357ef6de6b9d3959f --- /dev/null +++ b/i18n/fr.po @@ -0,0 +1,149 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * lefilament_projets +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-01-17 14:39+0000\n" +"PO-Revision-Date: 2018-01-17 14:39+0000\n" +"Last-Translator: <>\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: lefilament_projets +#: model:ir.model.fields,field_description:lefilament_projets.field_project_project_lf_couts_annexes +msgid "Additional costs" +msgstr "Coûts Annexes" + +#. module: lefilament_projets +#: model:ir.ui.view,arch_db:lefilament_projets.crm_case_kanban_view_leads_inherit +msgid "Additional costs :" +msgstr "Coûts Annexes" + +#. module: lefilament_projets +#: model:ir.model.fields,field_description:lefilament_projets.field_project_project_lf_heures_projet +msgid "Allocated (h)" +msgstr "Allouées (h)" + +#. module: lefilament_projets +#: model:ir.model.fields,help:lefilament_projets.field_project_config_settings_lf_heures_jour +msgid "Time base for calculating the number of hours sold per project (default 7h)" +msgstr "Base de temps pour le calcul du nombre d'heures vendues par projet (7h par défaut)" + +#. module: lefilament_projets +#: model:ir.model.fields,field_description:lefilament_projets.field_project_project_lf_heures_budget +msgid "Budget hours" +msgstr "Budget heures" + +#. module: lefilament_projets +#: model:ir.ui.view,arch_db:lefilament_projets.crm_case_kanban_view_leads_inherit +msgid "Budget hours :" +msgstr "Budget heures :" + +#. module: lefilament_projets +#: model:ir.model.fields,field_description:lefilament_projets.field_project_project_lf_commentaire +#: model:ir.ui.view,arch_db:lefilament_projets.view_form_lefilament_project_form_inherited +msgid "Comments" +msgstr "Commentaires" + +#. module: lefilament_projets +#: model:ir.model.fields,field_description:lefilament_projets.field_project_project_lf_tarif_jour +msgid "Day price" +msgstr "Tarif Jour" + +#. module: lefilament_projets +#: model:ir.model.fields,field_description:lefilament_projets.field_project_project_lf_couts_estimes +msgid "Estimated costs" +msgstr "Coûts estimés" + +#. module: lefilament_projets +#: model:ir.ui.view,arch_db:lefilament_projets.crm_case_kanban_view_leads_inherit +msgid "Estimated costs :" +msgstr "Coûts estimés :" + +#. module: lefilament_projets +#: model:ir.model.fields,field_description:lefilament_projets.field_project_config_settings_lf_heures_jour +msgid "Hours / Day" +msgstr "Heures / Jour" + +#. module: lefilament_projets +#: model:ir.model.fields,field_description:lefilament_projets.field_project_project_lf_taux_horaire +msgid "Hourly rate" +msgstr "Taux horaire" + +#. module: lefilament_projets +#: model:ir.model.fields,field_description:lefilament_projets.field_project_project_lf_heures_passees +msgid "Hours spent" +msgstr "Heures passées" + +#. module: lefilament_projets +#: model:ir.model.fields,field_description:lefilament_projets.field_project_project_use_prospection +msgid "Include prospecting" +msgstr "Inclure Prospection" + +#. module: lefilament_projets +#: model:ir.model.fields,field_description:lefilament_projets.field_project_project_lf_heures_planifiees +msgid "Planned (h)" +msgstr "Planifiées (h)" + +#. module: lefilament_projets +#: model:ir.model,name:lefilament_projets.model_project_project +#: model:ir.ui.view,arch_db:lefilament_projets.crm_case_kanban_view_leads_inherit +msgid "Project" +msgstr "Le projet" + +#. module: lefilament_projets +#: model:ir.model.fields,field_description:lefilament_projets.field_project_project_lf_total_budget +msgid "Project budget" +msgstr "Budget Projet" + +#. module: lefilament_projets +#: model:ir.model.fields,field_description:lefilament_projets.field_project_project_lf_heures_prospection +msgid "Prospecting (h)" +msgstr "" + +#. module: lefilament_projets +#: model:ir.model.fields,field_description:lefilament_projets.field_project_project_lf_heures_restantes +msgid "Remaining (h)" +msgstr "Prospection (h)" + +#. module: lefilament_projets +#: model:ir.ui.view,arch_db:lefilament_projets.crm_case_kanban_view_leads_inherit +msgid "Tasks" +msgstr "Les tâches" + +#. module: lefilament_projets +#: model:ir.ui.view,arch_db:lefilament_projets.crm_case_kanban_view_leads_inherit +msgid "Total budget :" +msgstr "Budget total :" + +#. module: lefilament_projets +#: model:ir.model,name:lefilament_projets.model_project_config_settings +msgid "project.config.settings" +msgstr "" + +#. module: lefilament_projets +#: model:ir.ui.view,arch_db:lefilament_projets.crm_case_kanban_view_leads_inherit +msgid "prospecting" +msgstr "prospection" + +#. module: lefilament_projets +#: model:ir.ui.view,arch_db:lefilament_projets.crm_case_kanban_view_leads_inherit +msgid "remaining" +msgstr "restantes" + +#. module: lefilament_projets +#: model:ir.ui.view,arch_db:lefilament_projets.crm_case_kanban_view_leads_inherit +msgid "sold" +msgstr "vendues" + +#. module: lefilament_projets +#: model:ir.ui.view,arch_db:lefilament_projets.crm_case_kanban_view_leads_inherit +msgid "spent" +msgstr "passées" + diff --git a/i18n/lefilament_projets.pot b/i18n/lefilament_projets.pot new file mode 100644 index 0000000000000000000000000000000000000000..9c8936cd3b1b68b700b74135688a4f3439117174 --- /dev/null +++ b/i18n/lefilament_projets.pot @@ -0,0 +1,149 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * lefilament_projets +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-01-17 14:39+0000\n" +"PO-Revision-Date: 2018-01-17 14:39+0000\n" +"Last-Translator: <>\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: lefilament_projets +#: model:ir.model.fields,field_description:lefilament_projets.field_project_project_lf_couts_annexes +msgid "Additional costs" +msgstr "" + +#. module: lefilament_projets +#: model:ir.ui.view,arch_db:lefilament_projets.crm_case_kanban_view_leads_inherit +msgid "Additional costs :" +msgstr "" + +#. module: lefilament_projets +#: model:ir.model.fields,field_description:lefilament_projets.field_project_project_lf_heures_projet +msgid "Allocated (h)" +msgstr "" + +#. module: lefilament_projets +#: model:ir.model.fields,help:lefilament_projets.field_project_config_settings_lf_heures_jour +msgid "Base de temps pour le calcul du nombre d'heures vendues par projet (7h par défaut)" +msgstr "" + +#. module: lefilament_projets +#: model:ir.model.fields,field_description:lefilament_projets.field_project_project_lf_heures_budget +msgid "Budget hours" +msgstr "" + +#. module: lefilament_projets +#: model:ir.ui.view,arch_db:lefilament_projets.crm_case_kanban_view_leads_inherit +msgid "Budget hours :" +msgstr "" + +#. module: lefilament_projets +#: model:ir.model.fields,field_description:lefilament_projets.field_project_project_lf_commentaire +#: model:ir.ui.view,arch_db:lefilament_projets.view_form_lefilament_project_form_inherited +msgid "Comments" +msgstr "" + +#. module: lefilament_projets +#: model:ir.model.fields,field_description:lefilament_projets.field_project_project_lf_tarif_jour +msgid "Day price" +msgstr "" + +#. module: lefilament_projets +#: model:ir.model.fields,field_description:lefilament_projets.field_project_project_lf_couts_estimes +msgid "Estimated costs" +msgstr "" + +#. module: lefilament_projets +#: model:ir.ui.view,arch_db:lefilament_projets.crm_case_kanban_view_leads_inherit +msgid "Estimated costs :" +msgstr "" + +#. module: lefilament_projets +#: model:ir.model.fields,field_description:lefilament_projets.field_project_config_settings_lf_heures_jour +msgid "Heures / Jour" +msgstr "" + +#. module: lefilament_projets +#: model:ir.model.fields,field_description:lefilament_projets.field_project_project_lf_taux_horaire +msgid "Hourly rate" +msgstr "" + +#. module: lefilament_projets +#: model:ir.model.fields,field_description:lefilament_projets.field_project_project_lf_heures_passees +msgid "Hours spent" +msgstr "" + +#. module: lefilament_projets +#: model:ir.model.fields,field_description:lefilament_projets.field_project_project_use_prospection +msgid "Include prospecting" +msgstr "" + +#. module: lefilament_projets +#: model:ir.model.fields,field_description:lefilament_projets.field_project_project_lf_heures_planifiees +msgid "Planned (h)" +msgstr "" + +#. module: lefilament_projets +#: model:ir.model,name:lefilament_projets.model_project_project +#: model:ir.ui.view,arch_db:lefilament_projets.crm_case_kanban_view_leads_inherit +msgid "Project" +msgstr "" + +#. module: lefilament_projets +#: model:ir.model.fields,field_description:lefilament_projets.field_project_project_lf_total_budget +msgid "Project budget" +msgstr "" + +#. module: lefilament_projets +#: model:ir.model.fields,field_description:lefilament_projets.field_project_project_lf_heures_prospection +msgid "Prospecting (h)" +msgstr "" + +#. module: lefilament_projets +#: model:ir.model.fields,field_description:lefilament_projets.field_project_project_lf_heures_restantes +msgid "Remaining (h)" +msgstr "" + +#. module: lefilament_projets +#: model:ir.ui.view,arch_db:lefilament_projets.crm_case_kanban_view_leads_inherit +msgid "Tasks" +msgstr "" + +#. module: lefilament_projets +#: model:ir.ui.view,arch_db:lefilament_projets.crm_case_kanban_view_leads_inherit +msgid "Total budget :" +msgstr "" + +#. module: lefilament_projets +#: model:ir.model,name:lefilament_projets.model_project_config_settings +msgid "project.config.settings" +msgstr "" + +#. module: lefilament_projets +#: model:ir.ui.view,arch_db:lefilament_projets.crm_case_kanban_view_leads_inherit +msgid "prospecting" +msgstr "" + +#. module: lefilament_projets +#: model:ir.ui.view,arch_db:lefilament_projets.crm_case_kanban_view_leads_inherit +msgid "remaining" +msgstr "" + +#. module: lefilament_projets +#: model:ir.ui.view,arch_db:lefilament_projets.crm_case_kanban_view_leads_inherit +msgid "sold" +msgstr "" + +#. module: lefilament_projets +#: model:ir.ui.view,arch_db:lefilament_projets.crm_case_kanban_view_leads_inherit +msgid "spent" +msgstr "" + diff --git a/models/project.py b/models/project.py index 05aa71bea4caf7cbe857260fd3a475399741a771..fd26fb97f75336e3c699385ea3a80f64563c3c07 100644 --- a/models/project.py +++ b/models/project.py @@ -11,23 +11,19 @@ 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') - lf_heures_planifiees = fields.Float('Planifiées (h)', compute='_total_heures_planifiees') - lf_couts_annexes = fields.Float('Coûts Annexes', compute='_couts_annexes') - lf_couts_estimes = fields.Float('Coûts Estimés') - lf_commentaire = fields.Text('Commentaires') - lf_delay = fields.Integer('Délai facture', compute='_delay') - lf_total_days = fields.Integer('Durée projet', compute='_total_days') - lf_advance = fields.Float('Cash avancé', compute='_advance') - lf_balance = fields.Float('Balance Actuelle', compute='_balance') + use_prospection = fields.Boolean("Include prospecting", default=False) + lf_total_budget = fields.Float('Project budget',) + lf_heures_budget = fields.Float('Budget hours', compute='_budget_heures') + lf_tarif_jour = fields.Float('Day price',) + lf_taux_horaire = fields.Float('Hourly rate', compute='_taux_horaire') + lf_heures_prospection = fields.Float('Prospecting (h)', compute='_total_heures_prospection') + lf_heures_projet = fields.Float('Allocated (h)', compute='_total_heures') + lf_heures_passees = fields.Float('Hours spent', compute='_total_heures_passees') + lf_heures_restantes = fields.Float('Remaining (h)', compute='_total_heures_restantes') + lf_heures_planifiees = fields.Float('Planned (h)', compute='_total_heures_planifiees') + lf_couts_annexes = fields.Float('Additional costs', compute='_couts_annexes') + lf_couts_estimes = fields.Float('Estimated costs') + lf_commentaire = fields.Text('Comments') #################################################### ### Fields Function ### @@ -96,83 +92,6 @@ class FilamentProjet(models.Model): def _total_heures_restantes(self): self.lf_heures_restantes = self.lf_heures_projet - self.lf_heures_passees - ## Time to first invoice - @api.one - def _delay(self): - account_id = self.analytic_account_id.id - self.env.cr.execute(""" - SELECT date - FROM account_analytic_line - where account_id=%s and amount < 0 order by date limit 1 - ;""", (account_id, ) ) - d_cost = self.env.cr.fetchone() - - self.env.cr.execute(""" - SELECT date - FROM account_analytic_line - where account_id=%s and amount < 0 order by date desc limit 1 - ;""", (account_id, ) ) - d_cost_last = self.env.cr.fetchone() - - self.env.cr.execute(""" - SELECT date - FROM account_analytic_line - where account_id=%s and amount > 0 order by date limit 1 - ;""", (account_id, ) ) - d_invoice = self.env.cr.fetchone() - - if d_cost: - if d_invoice: - self.lf_delay = (datetime.strptime(d_invoice[0], "%Y-%m-%d").date() - datetime.strptime(d_cost[0], "%Y-%m-%d").date()).days - else: - self.lf_delay = (datetime.strptime(d_cost_last[0], "%Y-%m-%d").date() - datetime.strptime(d_cost[0], "%Y-%m-%d").date()).days - else: - self.lf_delay = 0 - - ## Total Days - @api.one - def _total_days(self): - account_id = self.analytic_account_id.id - self.env.cr.execute(""" - SELECT - date(d_last) - date(d_first) as datediff - from - (select date FROM account_analytic_line where account_id=%s order by date limit 1) as d_first, - (select date FROM account_analytic_line where account_id=%s order by date desc limit 1) as d_last - ;""", (account_id, account_id, ) ) - lf_total_days = self._cr.fetchone() - - if lf_total_days: - self.lf_total_days = lf_total_days[0] - else: - self.lf_total_days = 0 - - ## Balance - @api.one - def _balance(self): - account_id = self.analytic_account_id.id - self.env.cr.execute(""" - SELECT sum(amount) as Total - FROM account_analytic_line - WHERE account_id=%s - ;""", (account_id, ) ) - self.lf_balance = self._cr.fetchone()[0] - - - ## Advance cash - @api.one - def _advance(self): - account_id = self.analytic_account_id.id - self.env.cr.execute(""" - SELECT sum(amount) as Total - FROM account_analytic_line - WHERE account_id=%s - and date < (case when - (select date FROM account_analytic_line where account_id=%s and amount > 0 order by date limit 1) IS NOT NULL then - (select date FROM account_analytic_line where account_id=%s and amount > 0 order by date limit 1) else current_date end - );""", (account_id, account_id, account_id, ) ) - self.lf_advance = self._cr.fetchone()[0] - #################################################### ### Actions ### @@ -187,61 +106,3 @@ class FilamentProjet(models.Model): 'res_id': self.id, 'views': [(False, 'kanban')], } - - def open_cash_flow(self): - return { - 'type': 'ir.actions.client', - 'name': 'Cash Flow - ' + self.analytic_account_id.name, - 'tag': 'lefilament_projets.cashFlow', - 'target': 'new', - 'params': { - 'account_id': self.analytic_account_id.id, - 'project_id': self.id, - }, - } - - #################################################### - ### Widget Function ### - #################################################### - - @api.model - def cash_flow(self, account_id, project_id): - account = self.env['account.analytic.account'].search([('id', '=', account_id)]) - project = self.env['project.project'].search([('id', '=', project_id)]) - - ## Analytic account name - nom = account.name - - ## Cash Flow Request - self.env.cr.execute(""" - SELECT date, sum(sum(amount)) over (order by date) as Total, - sum(sum(case when product_uom_id = 5 then amount else 0 end)) over (order by date) as Timesheet, - sum(sum(case when (product_uom_id = 1 or product_uom_id is null) and amount < 0 then amount else 0 end)) over (order by date) as Fournisseurs, - sum(sum(case when product_uom_id = 1 and amount > 0 then amount else 0 end)) over (order by date) as Clients - FROM account_analytic_line - WHERE account_id=%s - group by date; - """, (account_id, ) ) - cash_flow = self._cr.dictfetchall() - - ## Time to first invoice - delay = project.lf_delay - - ## Total Days - total_days = project.lf_total_days - - ## Balance - balance = project.lf_balance - - ## Advance cash - advance = project.lf_advance - - return { - 'nom' : nom, - 'cash_flow': cash_flow, - 'delay': delay, - 'balance': balance, - 'advance': advance, - 'total_days': total_days, - } - diff --git a/models/res_config.py b/models/res_config.py index 3df88cf036e98f5b20f3f67f18b1caf6e92b71e1..72f693d8e30b5d2f4269f96ffaf3372ee6c4b7ed 100644 --- a/models/res_config.py +++ b/models/res_config.py @@ -9,7 +9,7 @@ class ProjectLFConfiguration(models.TransientModel): _name = 'project.config.settings' _inherit = 'project.config.settings' - lf_heures_jour = fields.Float('Heures / Jour', help="Base de temps pour le calcul du nombre d'heures vendues par projet (7h par défaut)", default=7.0 ) + lf_heures_jour = fields.Float('Hours / Day', help="Time base for calculating the number of hours sold per project (default 7h)", default=7.0 ) @api.multi def set_default_lf_heures_jour(self): diff --git a/static/src/js/cash_flow.js b/static/src/js/cash_flow.js deleted file mode 100644 index 01860703de71e835b17c14da4903c4faa3401261..0000000000000000000000000000000000000000 --- a/static/src/js/cash_flow.js +++ /dev/null @@ -1,138 +0,0 @@ -// # © 2017 Le Filament (<http://www.le-filament.com>) -// # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). - -odoo.define('lefilament_projets.cashFlow', function(require) { - 'use strict'; - - var core = require('web.core'); - var data = require('web.data'); - var Widget = require('web.Widget'); - var Model = require('web.Model'); - var form_common = require('web.form_common'); - - var _t = core._t; - var QWeb = core.qweb; - - var CashFlow = Widget.extend({ - template: "CashFlow", - - init: function(parent, action) { - this._super(parent, action); - this.account_id = action.params.account_id; - this.project_id = action.params.project_id; - }, - - willStart: function() { - var deferred = new jQuery.Deferred(); - var self = this; - self.cash_datas = {}; - - var dash_model = new Model('project.project'); - dash_model.call('cash_flow', [self.account_id, self.project_id]) - .then(function(results) { - self.cash_datas = results.cash_flow; - self.project = results.nom; - self.delay = results.delay; - self.total_days = results.total_days; - self.balance = results.balance; - self.advance = results.advance; - deferred.resolve(); - }); - - return jQuery.when(this._super.apply(this, arguments),deferred); - }, - - start: function() { - var sup = this._super(); - - this.display_chart(); - return sup; - }, - - display_chart: function() { - var self = this; - - this.ctx = this.$el.find('#cash_flow')[0].getContext('2d'); - - var labels = []; - - var total = []; - var heures = []; - var fournisseurs = []; - var clients = []; - - _.each( self.cash_datas, function(value, key) { - labels.push(moment(value.date)); - total.push(value.total); - heures.push(value.timesheet); - fournisseurs.push(value.fournisseurs); - clients.push(value.clients); - }); - - - var datasets = [ - { label: 'Total', data: total, backgroundColor: 'transparent',borderColor: '#5E8ED5', }, - { label: 'Timesheet', data: heures, backgroundColor: 'transparent',borderColor: '#FFDFA9', borderWidth: 1.5, radius: 0, }, - { label: 'Client', data: clients, backgroundColor: 'transparent',borderColor: '#51d2b7', borderWidth: 1.5, radius: 0, }, - { label: 'Fournisseur', data: fournisseurs, backgroundColor: 'transparent',borderColor: '#FCA7B3', borderWidth: 1.5, radius: 0, }, - ]; - - var options = { - scales: { - yAxes: [{ - ticks: { - beginAtZero:true, - } - }], - xAxes: [{ - type: 'time', - time: { - displayFormats: { - 'millisecond': 'DD MMM', - 'second': 'DD MMM', - 'minute': 'DD MMM', - 'hour': 'DD MMM', - 'day': 'DD MMM', - 'week': 'DD MMM', - 'month': 'DD MMM', - 'quarter': 'DD MMM', - 'year': 'DD MMM', - }, - }, - }], - }, - tooltips: { - backgroundColor: 'rgba(255,255,255,0.8)', - titleFontStyle: 'normal', - titleFontColor: '#999', - bodyFontColor: '#777', - callbacks: { - label: function(tooltipItems, data) { - return ' ' + (tooltipItems.yLabel).toLocaleString('fr', { maximumFractionDigits: 0 }) + ' €'; - }, - title: function(tooltipItems, data) { - return ' ' + (tooltipItems[0].xLabel._d).toLocaleString('fr', {day: 'numeric', month:'short', year:'2-digit'}); - } - } - }, - responsive: true, - } - - this.targetData = { - labels : labels, - datasets : datasets - }; - - var myChart = new Chart(this.ctx, { type: 'line', data: this.targetData, options: options } ); - }, - - render_monetary: function(value) { - value = value.toLocaleString('fr', { maximumFractionDigits: 0 }) + ' €'; - return value; - }, - - }); - - core.action_registry.add('lefilament_projets.cashFlow', CashFlow); - -}); diff --git a/static/src/xml/cash_flow.xml b/static/src/xml/cash_flow.xml deleted file mode 100644 index c07fbe08ed81862d91f81af75da8ca5bbdf4baeb..0000000000000000000000000000000000000000 --- a/static/src/xml/cash_flow.xml +++ /dev/null @@ -1,29 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<templates xml:space="preserve"> - - <t t-name="CashFlow"> - <div class="card"> - <table class="table"> - <thead> - <tr> - <th>Balance actuelle</th> - <th>Durée Projet</th> - <th>Délai 1ère facture</th> - <th>Cash avancé</th> - </tr> - </thead> - <tbody> - <tr> - <td><t t-esc="widget.render_monetary(widget.balance)"></t></td> - <td><t t-esc="widget.total_days"></t> jours</td> - <td><t t-esc="widget.delay"></t> jours</td> - <td><t t-esc="widget.render_monetary(widget.advance)"></t></td> - </tr> - </tbody> - </table> - <canvas id="cash_flow" width="auto" height="100"></canvas> - </div> - </t> - - -</templates> \ No newline at end of file diff --git a/views/assets.xml b/views/assets.xml index 1725223cc6431b05788d99d5aa9022d65a7e0b7b..a9a057e89374f3ff3378b5d6294b6c033dcf018e 100644 --- a/views/assets.xml +++ b/views/assets.xml @@ -4,12 +4,8 @@ <template id="lefilament_tdb_assets_backend" inherit_id="web.assets_backend"> <xpath expr="." position="inside"> - - <link rel="stylesheet" href="/lefilament_projets/static/src/less/style.less"/> - - <script type="text/javascript" src="/lefilament_projets/static/src/js/widget.js"></script> - <script type="text/javascript" src="/lefilament_projets/static/src/js/cash_flow.js"></script> - + <script type="text/javascript" src="/lefilament_cash_flow/static/src/js/widget.js"></script> + <link rel="stylesheet" href="/lefilament_projets/static/src/less/style.less"/> </xpath> </template> diff --git a/views/lefilament_projets_view.xml b/views/lefilament_projets_view.xml index c317713f887f2a81c8d0247e224354ca5422e418..0e41db167affab0810138dcb7c0f41aca5c758ca 100644 --- a/views/lefilament_projets_view.xml +++ b/views/lefilament_projets_view.xml @@ -9,11 +9,6 @@ <field name="model">project.project</field> <field name="inherit_id" ref="project.edit_project"/> <field name="arch" type="xml"> - <xpath expr="//sheet" position="before"> - <header> - <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"/> @@ -32,20 +27,10 @@ <field name="lf_heures_projet" /> </group> </group> - <group> - <group> - <field name="lf_total_days" /> - <field name="lf_balance" widget="monetary" options="{'currency_field': 'company_currency'}" /> - </group> - <group> - <field name="lf_delay" /> - <field name="lf_advance" widget="monetary" options="{'currency_field': 'company_currency'}" /> - </group> - </group> <div class="clearfix"></div> </xpath> <xpath expr="//page" position="before"> - <page string="Commentaires" name="commentaires"> + <page string="Comments" name="commentaires"> <field name="lf_commentaire" /> </page> </xpath> @@ -90,10 +75,10 @@ <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> + <td attrs="{'invisible':[('use_prospection', '=', False)]}">prospecting</td> + <td>sold</td> + <td>spent</td> + <td>remaining</td> </tr> </thead> <tbody> @@ -109,25 +94,25 @@ <field name="lf_heures_restantes" widget="progress" options="{'current_value': 'lf_heures_passees', 'max_value': 'lf_heures_projet', 'editable': false, 'edit_max_value': false, }" /> </div> <table class="budget_table"><tbody><tr> - <td>Budget total : </td> + <td>Total budget : </td> <td><field name="lf_total_budget"> €</field></td> </tr> <tr> - <td>Budget heures : </td> + <td>Budget hours : </td> <td><field name="lf_heures_budget"> €</field></td> </tr> <tr> - <td>Coûts estimés : </td> + <td>Estimated costs : </td> <td><field name="lf_couts_estimes"> €</field></td> </tr> <tr> - <td>Coûts annexes : </td> + <td>Additional costs : </td> <td><field name="lf_couts_annexes"> €</field></td> </tr> </tbody></table> <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">Les tâches</a></td> - <td><a type="open">Le projet</a></td> + <td><a t-if="record.use_tasks.raw_value" name="%(project.act_project_project_2_project_task_all)d" type="action">Tasks</a></td> + <td><a type="open">Project</a></td> </tr></tbody></table> </xpath> <!-- HIDE TASK AND DOCS NUMBER -->