diff --git a/models/project.py b/models/project.py index 954af7fd5ceae486e427d74a8e36a9c83aece6c5..d3850c72a8319fee6d6e2a634f6bb141d2ba65dc 100644 --- a/models/project.py +++ b/models/project.py @@ -1,7 +1,7 @@ # © 2019 Le Filament (<http://www.le-filament.com>) # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). -from odoo import models, fields +from odoo import models, fields, api class ScopProjectTimesheet(models.Model): @@ -20,3 +20,11 @@ class ScopProjectTimesheet(models.Model): index=True, on_delete='restrict', default=_default_ur) + + @api.onchange('name') + def onchange_name(self): + analytic = self.analytic_account_id + if analytic and analytic.ensure_one(): + self.analytic_account_id.sudo().write({ + 'name': self.name, + }) diff --git a/views/hr_timesheet_cgscop.xml b/views/hr_timesheet_cgscop.xml index 67404a8d2120cbeb121c12ba2149fa7fcf8ea569..1af92c4b3672d811c606d5b02b00b1d97043cebd 100644 --- a/views/hr_timesheet_cgscop.xml +++ b/views/hr_timesheet_cgscop.xml @@ -34,6 +34,7 @@ </group> <group> <field name="cgscop_timesheet_code_id" required="1" placeholder="Code activité National" options="{'no_open': True, 'no_create': True}"/> + <field name="analytic_account_id" invisible="1"/> <field name="privacy_visibility" invisible="1"/> <field name="allow_timesheets" invisible="1"/> </group>