2 Commits

Author SHA1 Message Date
763fca0d30 [IMP] project_working_time_task_portal : recompute billable and non billable effective hours when timesheets exclude_from_sale_order is modified
Some checks failed
pre-commit / pre-commit (pull_request) Failing after 1m27s
2025-11-19 19:06:30 +01:00
b1cfdeba30 [IMP] project_working_time_task_portal : change display condition for (non) billable hours
Some checks failed
pre-commit / pre-commit (pull_request) Failing after 1m27s
2025-11-19 11:49:30 +01:00
4 changed files with 15 additions and 8 deletions

View File

@@ -3,7 +3,7 @@
{
"name": "project_working_time_task_portal",
"version": "16.0.1.0.4",
"version": "16.0.1.0.5",
"author": "Elabore",
"website": "https://elabore.coop",
"maintainer": "Boris Gallet",

View File

@@ -0,0 +1,7 @@
from odoo import SUPERUSER_ID, api
def migrate(cr, version):
env = api.Environment(cr, SUPERUSER_ID, {})
tasks = env["project.task"].search([("stage_id.fold", "=", False)])
tasks._compute_billable_effective_hours()

View File

@@ -59,7 +59,7 @@ class Task(models.Model):
help="Non billable time spent on this task and its sub-tasks (and their own sub-tasks).",
)
@api.depends('timesheet_ids.unit_amount')
@api.depends('timesheet_ids.unit_amount', 'timesheet_ids.exclude_from_sale_order')
def _compute_billable_effective_hours(self):
if not any(self._ids):
for task in self:

View File

@@ -9,15 +9,15 @@
<field name="arch" type="xml">
<xpath expr="//field[@name='effective_hours']" position="after">
<span>
<label class="font-weight-bold" for="billable_effective_hours" string="Billable Effective Hours" attrs="{'invisible': ['|', ('planned_hours', '=', 0.0), ('encode_uom_in_days', '=', True)]}"/>
<label class="font-weight-bold" for="billable_effective_hours" string="Billable Effective Days" attrs="{'invisible': ['|', ('planned_hours', '=', 0.0), ('encode_uom_in_days', '=', False)]}"/>
<label class="font-weight-bold" for="billable_effective_hours" string="Billable Effective Hours" attrs="{'invisible': ['|', ('non_billable_effective_hours', '=', 0.0), ('encode_uom_in_days', '=', True)]}"/>
<label class="font-weight-bold" for="billable_effective_hours" string="Billable Effective Days" attrs="{'invisible': ['|', ('non_billable_effective_hours', '=', 0.0), ('encode_uom_in_days', '=', False)]}"/>
</span>
<field name="billable_effective_hours" widget="timesheet_uom" class="mt-2" attrs="{'invisible' : [('planned_hours', '=', 0.0)]}" nolabel="1"/>
<field name="billable_effective_hours" widget="timesheet_uom" class="mt-2" attrs="{'invisible' : [('non_billable_effective_hours', '=', 0.0)]}" nolabel="1"/>
<span>
<label class="font-weight-bold" for="non_billable_effective_hours" string="Non Billable Effective Hours" attrs="{'invisible': ['|', ('planned_hours', '=', 0.0), ('encode_uom_in_days', '=', True)]}"/>
<label class="font-weight-bold" for="non_billable_effective_hours" string="Non Billable Effective Days" attrs="{'invisible': ['|', ('planned_hours', '=', 0.0), ('encode_uom_in_days', '=', False)]}"/>
<label class="font-weight-bold" for="non_billable_effective_hours" string="Non Billable Effective Hours" attrs="{'invisible': ['|', ('non_billable_effective_hours', '=', 0.0), ('encode_uom_in_days', '=', True)]}"/>
<label class="font-weight-bold" for="non_billable_effective_hours" string="Non Billable Effective Days" attrs="{'invisible': ['|', ('non_billable_effective_hours', '=', 0.0), ('encode_uom_in_days', '=', False)]}"/>
</span>
<field name="non_billable_effective_hours" widget="timesheet_uom" class="mt-2" attrs="{'invisible' : [('planned_hours', '=', 0.0)]}" nolabel="1"/>
<field name="non_billable_effective_hours" widget="timesheet_uom" class="mt-2" attrs="{'invisible' : [('non_billable_effective_hours', '=', 0.0)]}" nolabel="1"/>
</xpath>
<xpath expr="//field[@name='subtask_effective_hours']" position="after">
<span>