[IMP] project_working_time_task_portal: add total_billable_effective_hours field in task model

This commit is contained in:
Stéphan Sainléger
2025-07-08 15:33:13 +02:00
parent ff07b3aa17
commit ee339a01e8
3 changed files with 88 additions and 27 deletions

View File

@@ -4,10 +4,10 @@
# #
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Odoo Server 14.0\n" "Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-12-04 09:37+0000\n" "POT-Creation-Date: 2025-07-08 13:43+0000\n"
"PO-Revision-Date: 2023-12-04 09:37+0000\n" "PO-Revision-Date: 2025-07-08 15:45+0200\n"
"Last-Translator: \n" "Last-Translator: \n"
"Language-Team: \n" "Language-Team: \n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
@@ -31,24 +31,9 @@ msgid "<strong>Subtask Planned Hours: </strong>"
msgstr "<strong>Heures Planifiées Sous-tâches: </strong>" msgstr "<strong>Heures Planifiées Sous-tâches: </strong>"
#. module: project_working_time_task_portal #. module: project_working_time_task_portal
#: model_terms:ir.ui.view,arch_db:project_working_time_task_portal.portal_my_task_remaining_hours #: model:ir.model,name:project_working_time_task_portal.model_account_analytic_line
msgid "Remaining Hours:" msgid "Analytic Line"
msgstr "Heures restantes:" msgstr "Ligne analytique"
#. module: project_working_time_task_portal
#: model:ir.model.fields,field_description:project_working_time_task_portal.field_project_task__billable_remaining_hours
#: model_terms:ir.ui.view,arch_db:project_working_time_task_portal.project_working_time_view_task_form
msgid "Billable Remaining Hours"
msgstr "Heures restantes facturables"
#. module: project_working_time_task_portal
#: model_terms:ir.ui.view,arch_db:project_working_time_task_portal.portal_tasks_list_inherit
msgid "Billable Hours"
msgstr "Heures facturables"
#. module: project_working_time_task_portal
#: model_terms:ir.ui.view,arch_db:project_working_time_task_portal.project_working_time_view_task_form
msgid "Billable Remaining Days"
msgstr "Jours restants facturables"
#. module: project_working_time_task_portal #. module: project_working_time_task_portal
#: model_terms:ir.ui.view,arch_db:project_working_time_task_portal.project_working_time_view_task_form #: model_terms:ir.ui.view,arch_db:project_working_time_task_portal.project_working_time_view_task_form
@@ -62,9 +47,25 @@ msgid "Billable Effective Hours"
msgstr "Heures passées facturables" msgstr "Heures passées facturables"
#. module: project_working_time_task_portal #. module: project_working_time_task_portal
#: model:ir.model.fields,field_description:project_working_time_task_portal.field_project_task__subtask_billable_effective_hours #: model_terms:ir.ui.view,arch_db:project_working_time_task_portal.portal_tasks_list_inherit
msgid "Subtask Billable Effective Hours" msgid "Billable Hours"
msgstr "Heures passées facturables Sous-tâches" msgstr "Heures facturables"
#. module: project_working_time_task_portal
#: model:ir.model.fields,field_description:project_working_time_task_portal.field_project_task__billable_progress
msgid "Billable Progress"
msgstr ""
#. module: project_working_time_task_portal
#: model_terms:ir.ui.view,arch_db:project_working_time_task_portal.project_working_time_view_task_form
msgid "Billable Remaining Days"
msgstr "Jours restants facturables"
#. module: project_working_time_task_portal
#: model:ir.model.fields,field_description:project_working_time_task_portal.field_project_task__billable_remaining_hours
#: model_terms:ir.ui.view,arch_db:project_working_time_task_portal.project_working_time_view_task_form
msgid "Billable Remaining Hours"
msgstr "Heures restantes facturables"
#. module: project_working_time_task_portal #. module: project_working_time_task_portal
#: model_terms:ir.ui.view,arch_db:project_working_time_task_portal.project_working_time_view_task_form #: model_terms:ir.ui.view,arch_db:project_working_time_task_portal.project_working_time_view_task_form
@@ -75,4 +76,43 @@ msgstr "Jours passés non facturables"
#: model:ir.model.fields,field_description:project_working_time_task_portal.field_project_task__non_billable_effective_hours #: model:ir.model.fields,field_description:project_working_time_task_portal.field_project_task__non_billable_effective_hours
#: model_terms:ir.ui.view,arch_db:project_working_time_task_portal.project_working_time_view_task_form #: model_terms:ir.ui.view,arch_db:project_working_time_task_portal.project_working_time_view_task_form
msgid "Non Billable Effective Hours" msgid "Non Billable Effective Hours"
msgstr "Heures passées non facturables" msgstr "Heures passées non facturables"
#. module: project_working_time_task_portal
#: model_terms:ir.ui.view,arch_db:project_working_time_task_portal.portal_my_task_remaining_hours
msgid "Remaining Hours:"
msgstr "Heures restantes:"
#. module: project_working_time_task_portal
#: model:ir.model.fields,field_description:project_working_time_task_portal.field_account_analytic_line__smart_search
#: model:ir.model.fields,field_description:project_working_time_task_portal.field_project_task__smart_search
msgid "Smart Search"
msgstr ""
#. module: project_working_time_task_portal
#: model:ir.model.fields,field_description:project_working_time_task_portal.field_project_task__subtask_billable_effective_hours
msgid "Subtask Billable Effective Hours"
msgstr "Heures passées facturables Sous-tâches"
#. module: project_working_time_task_portal
#: model:ir.model,name:project_working_time_task_portal.model_project_task
msgid "Task"
msgstr "Tâche"
#. module: project_working_time_task_portal
#: model_terms:ir.ui.view,arch_db:project_working_time_task_portal.project_working_time_view_task_form
msgid "Total Billable Effective Days"
msgstr "Total des jours facturables"
#. module: project_working_time_task_portal
#: model:ir.model.fields,field_description:project_working_time_task_portal.field_project_task__total_billable_effective_hours
#: model_terms:ir.ui.view,arch_db:project_working_time_task_portal.project_working_time_view_task_form
msgid "Total Billable Effective Hours"
msgstr "Total des heures facturables"
#. module: project_working_time_task_portal
#: model:ir.model.fields,help:project_working_time_task_portal.field_project_task__billable_remaining_hours
msgid ""
"Total Billable remaining time (without exclude_from_sale_order timesheet "
"lines), can be re-estimated periodically by the assignee of the task."
msgstr ""

View File

@@ -1,4 +1,4 @@
from odoo import models, fields, api, _ from odoo import api, fields, models
from odoo.tools.float_utils import float_compare from odoo.tools.float_utils import float_compare
@@ -40,6 +40,13 @@ class Task(models.Model):
recursive=True, recursive=True,
) )
total_billable_effective_hours = fields.Float(
compute="_compute_total_billable_effective_hours",
string="Total Billable Effective Hours",
store=True,
compute_sudo=True,
)
@api.depends("timesheet_ids.unit_amount") @api.depends("timesheet_ids.unit_amount")
def _compute_billable_effective_hours(self): def _compute_billable_effective_hours(self):
if not any(self._ids): if not any(self._ids):
@@ -120,3 +127,10 @@ class Task(models.Model):
) )
else: else:
task.billable_progress = 0.0 task.billable_progress = 0.0
@api.depends("billable_effective_hours", "subtask_billable_effective_hours")
def _compute_total_billable_effective_hours(self):
for task in self:
task.total_billable_effective_hours = (
task.billable_effective_hours + task.subtask_billable_effective_hours
)

View File

@@ -19,6 +19,13 @@
</span> </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' : [('planned_hours', '=', 0.0)]}" nolabel="1"/>
</xpath> </xpath>
<xpath expr="//field[@name='total_hours_spent']" position="after">
<span>
<label class="font-weight-bold" for="total_billable_effective_hours" string="Total Billable Effective Hours" attrs="{'invisible': ['|', ('planned_hours', '=', 0.0), ('encode_uom_in_days', '=', True)]}"/>
<label class="font-weight-bold" for="total_billable_effective_hours" string="Total Billable Effective Days" attrs="{'invisible': ['|', ('planned_hours', '=', 0.0), ('encode_uom_in_days', '=', False)]}"/>
</span>
<field name="total_billable_effective_hours" widget="timesheet_uom" class="oe_subtotal_footer_separator" attrs="{'invisible' : [('planned_hours', '=', 0.0)]}" nolabel="1"/>
</xpath>
<xpath expr="//field[@name='remaining_hours']" position="after"> <xpath expr="//field[@name='remaining_hours']" position="after">
<span> <span>
<label class="font-weight-bold" for="billable_remaining_hours" string="Billable Remaining Hours" attrs="{'invisible': ['|', ('planned_hours', '=', 0.0), ('encode_uom_in_days', '=', True)]}"/> <label class="font-weight-bold" for="billable_remaining_hours" string="Billable Remaining Hours" attrs="{'invisible': ['|', ('planned_hours', '=', 0.0), ('encode_uom_in_days', '=', True)]}"/>
@@ -29,4 +36,4 @@
</field> </field>
</record> </record>
</odoo> </odoo>