diff --git a/README.rst b/README.rst index a6675d5ca3cbff45cbb185c45935f05469560807..9f0cbd24102d50fd76e3a6b91cbffd22c42cae24 100644 --- a/README.rst +++ b/README.rst @@ -10,23 +10,26 @@ Le Filament - Projets 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) + +* 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 ======= -Contributors ------------ +Contributors +------------ * Benjamin Rivier <benjamin@le-filament.com> * Remi Cazenave <remi@le-filament.com> * Juliana Poudou <juliana@le-filament.com> -Maintainer ---------- +Maintainer +---------- .. image:: https://le-filament.com/img/logo-lefilament.png :alt: Le Filament diff --git a/__manifest__.py b/__manifest__.py index b9be38bd48a5a32ce8f17231934ed0406bbc494f..1c44433a724c23bd9903e3b5ea89c65dcab2e73b 100644 --- a/__manifest__.py +++ b/__manifest__.py @@ -1,26 +1,8 @@ { 'name': 'Le Filament - Projets', - - 'summary': """ - Projets Le Filament""", - - 'version': '10.0.1.0.0', + 'summary': "Projects Le Filament", + 'version': '12.0.1.0.0', 'license': 'AGPL-3', - 'description': """ - - Module Projet Le Filament - - 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', 'category': 'Project', 'depends': ['hr_timesheet', 'hr_expense'], @@ -31,10 +13,11 @@ ], 'website': 'https://le-filament.com', 'data': [ + 'security/ir.model.access.csv', 'views/assets.xml', - 'views/lefilament_projets_view.xml', 'views/account_analytic_view.xml', - 'security/ir.model.access.csv', + 'views/lefilament_projets_view.xml', + 'views/res_config.xml', ], 'qweb': [ ], diff --git a/models/__init__.py b/models/__init__.py index d5e155f8fb9599744d86748f48fa64d937440a83..bf89ba55222ca8d3392b208d8ba6db568c61b65b 100644 --- a/models/__init__.py +++ b/models/__init__.py @@ -1,4 +1,5 @@ # -*- coding: utf-8 -*- from . import project +from . import res_company from . import res_config diff --git a/models/project.py b/models/project.py index 6d1f04c748ba42b02bb1fb062dbef4b9bab1ffba..458bb30cae6f5434b1a27df98ba5d9c7efd87cb4 100644 --- a/models/project.py +++ b/models/project.py @@ -34,8 +34,7 @@ class FilamentProjet(models.Model): @api.one def _taux_horaire(self): - lf_heures_jour = self.env['ir.values'].get_default( - 'project.config.settings', 'lf_heures_jour') + lf_heures_jour = self.env.user.company_id.lf_heures_jour self.lf_taux_horaire = self.lf_tarif_jour / lf_heures_jour @api.one @@ -95,8 +94,7 @@ class FilamentProjet(models.Model): @api.one def _total_heures(self): - lf_heures_jour = self.env['ir.values'].get_default( - 'project.config.settings', 'lf_heures_jour') + lf_heures_jour = self.env.user.company_id.lf_heures_jour if self.lf_tarif_jour != 0.0: self.lf_heures_projet = (self.lf_heures_budget / self.lf_tarif_jour) * lf_heures_jour diff --git a/models/res_company.py b/models/res_company.py new file mode 100644 index 0000000000000000000000000000000000000000..f91e569f94cc8ab87c8eab47df4c3249aea2b060 --- /dev/null +++ b/models/res_company.py @@ -0,0 +1,15 @@ +# -*- coding: utf-8 -*- +# © 2019 Le Filament (<https://www.le-filament.com>) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from odoo import fields, models + + +class ResCompany(models.Model): + _inherit = 'res.company' + + lf_heures_jour = fields.Float( + 'Hours / Day', + help="Time base for calculating the number of hours sold per project \ + (default 7h)", + default=7.0) diff --git a/models/res_config.py b/models/res_config.py index 0840c9900be01fe793fa4dcf1b382f3104b4abcc..bd4becc6d1c2b023ff0cb2f2fd1428e5d6fe1af4 100644 --- a/models/res_config.py +++ b/models/res_config.py @@ -1,28 +1,18 @@ # -*- coding: utf-8 -*- - -# © 2017 Le Filament (<https://www.le-filament.com>) +# © 2019 Le Filament (<https://www.le-filament.com>) # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from odoo import api, fields, models class ProjectLFConfiguration(models.TransientModel): - _name = 'project.config.settings' - _inherit = 'project.config.settings' + _name = 'res.config.settings' + _inherit = 'res.config.settings' 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): - return self.env['ir.values'].sudo().set_default( - 'project.config.settings', 'lf_heures_jour', self.lf_heures_jour) - - @api.multi - def get_default_lf_heures_jour(self, field): - lf_heures_jour = self.env['ir.values'].get_default( - 'project.config.settings', 'lf_heures_jour') - return {'lf_heures_jour': lf_heures_jour if lf_heures_jour else 7.0} + default=7.0, + related="company_id.lf_heures_jour", + readonly=False) diff --git a/views/lefilament_projets_view.xml b/views/lefilament_projets_view.xml index 1dd91a7345c41048901d920db7b0ec7e29092d28..2e4c840bbc10daca00aa6d4f3c3fcbbfc371446e 100644 --- a/views/lefilament_projets_view.xml +++ b/views/lefilament_projets_view.xml @@ -9,7 +9,7 @@ <field name="model">project.project</field> <field name="inherit_id" ref="project.edit_project"/> <field name="arch" type="xml"> - <xpath expr="//field[@name='use_tasks']" position="before"> + <xpath expr="//label[@for='label_tasks']" position="before"> <div> <field name="use_prospection" class="oe_inline"/> <label for="use_prospection" class="oe_inline"/> @@ -88,7 +88,7 @@ </tbody> </table> <div class="project-progress"> - <field name="lf_heures_restantes" widget="progress" options="{'current_value': 'lf_heures_passees', 'max_value': 'lf_heures_projet', 'editable': false, 'edit_max_value': false, }" /> + <field name="lf_heures_restantes" widget="progressbar" options="{'current_value': 'lf_heures_passees', 'max_value': 'lf_heures_projet', 'editable': false, 'edit_max_value': false, }" /> </div> <table class="budget_table"> <tbody> @@ -113,7 +113,7 @@ <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">Tasks</a></td> + <td><a name="%(project.act_project_project_2_project_task_all)d" type="action">Tasks</a></td> <td><a type="open">Project</a></td> </tr> </tbody> @@ -126,15 +126,5 @@ </field> </record> - <record id="view_lf_project_config_settings" model="ir.ui.view"> - <field name="name">project lf settings</field> - <field name="model">project.config.settings</field> - <field name="inherit_id" ref="project.view_config_settings"/> - <field name="arch" type="xml"> - <xpath expr="//field[@name='module_rating_project']" position="after"> - <field name="lf_heures_jour" class="oe_inline oe_text_right" /> - </xpath> - </field> - </record> </data> </odoo> diff --git a/views/res_config.xml b/views/res_config.xml new file mode 100644 index 0000000000000000000000000000000000000000..743852ae2c1441660657f024d689066a8dbe05e4 --- /dev/null +++ b/views/res_config.xml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="utf-8"?> +<odoo> + + <record id="lefilament_projets_config_settings" model="ir.ui.view"> + <field name="name">Le Filament Projets Settings</field> + <field name="model">res.config.settings</field> + <field name="inherit_id" ref="project.res_config_settings_view_form"/> + <field name="arch" type="xml"> + <div id="use_collaborative_pad" position="before"> + <div class="col-12 col-lg-6 o_setting_box" id="lf_projects_setting"> + <div class="o_setting_left_pane"> + </div> + <div class="o_setting_right_pane"> + <div class="text-muted"> + Time base for calculating the number of hours sold per project (default 7h) + </div> + <div class="content-group" > + <div class="row mt16"> + <field name="lf_heures_jour"/> + </div> + </div> + </div> + </div> + </div> + </field> + </record> + +</odoo> \ No newline at end of file