[IMP] project_working_time_task_portal : add non billable hours for subtasks
Some checks failed
pre-commit / pre-commit (pull_request) Failing after 1m28s

This commit is contained in:
2025-11-18 15:28:47 +01:00
parent 6af5442cec
commit 0ca324a6af
3 changed files with 105 additions and 33 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-11-18 14:17+0000\n"
"PO-Revision-Date: 2023-12-04 09:37+0000\n" "PO-Revision-Date: 2025-11-18 14:17+0000\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
@@ -76,3 +77,48 @@ msgstr "Jours passés non facturables"
#: 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_terms:ir.ui.view,arch_db:project_working_time_task_portal.project_working_time_view_task_form
msgid "Subtask Billable Effective Days"
msgstr "Sous-tâches jours passés facturables"
#. 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.project_working_time_view_task_form
msgid "Subtask Billable Effective Hours"
msgstr "Sous-tâches heures passées 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 "Subtask Non Billable Effective Days"
msgstr "Sous-tâches jours passés non facturables"
#. module: project_working_time_task_portal
#: model:ir.model.fields,field_description:project_working_time_task_portal.field_project_task__subtask_non_billable_effective_hours
#: model_terms:ir.ui.view,arch_db:project_working_time_task_portal.project_working_time_view_task_form
msgid "Subtask Non Billable Effective Hours"
msgstr "Sous-tâches heures passées non facturables"
#. 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: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

@@ -40,6 +40,14 @@ class Task(models.Model):
recursive=True, recursive=True,
) )
subtask_non_billable_effective_hours = fields.Float(
compute="_compute_subtask_non_billable_effective_hours",
string="Subtask Non Billable Effective Hours",
store=True,
compute_sudo=True,
recursive=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):
@@ -68,12 +76,16 @@ class Task(models.Model):
for task in self: for task in self:
task.billable_remaining_hours = task.planned_hours - task.billable_effective_hours - task.subtask_billable_effective_hours task.billable_remaining_hours = task.planned_hours - task.billable_effective_hours - task.subtask_billable_effective_hours
@api.depends('child_ids.billable_effective_hours', 'child_ids.subtask_billable_effective_hours') @api.depends('child_ids.billable_effective_hours', 'child_ids.subtask_billable_effective_hours')
def _compute_subtask_billable_effective_hours(self): def _compute_subtask_billable_effective_hours(self):
for task in self: for task in self:
task.subtask_billable_effective_hours = sum(child_task.billable_effective_hours + child_task.subtask_billable_effective_hours for child_task in task.child_ids) task.subtask_billable_effective_hours = sum(child_task.billable_effective_hours + child_task.subtask_billable_effective_hours for child_task in task.child_ids)
@api.depends('child_ids.billable_effective_hours', 'child_ids.subtask_billable_effective_hours')
def _compute_subtask_non_billable_effective_hours(self):
for task in self:
task.subtask_non_billable_effective_hours = sum(child_task.non_billable_effective_hours + child_task.subtask_non_billable_effective_hours for child_task in task.child_ids)
@api.depends('billable_effective_hours', 'subtask_billable_effective_hours', 'planned_hours') @api.depends('billable_effective_hours', 'subtask_billable_effective_hours', 'planned_hours')
def _compute_billable_progress_hours(self): def _compute_billable_progress_hours(self):
for task in self: for task in self:

View File

@@ -19,12 +19,26 @@
</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='subtask_effective_hours']" position="after">
<span>
<label class="font-weight-bold" for="subtask_billable_effective_hours" string="Subtask Billable Effective Hours" attrs="{'invisible': ['|', '|', ('allow_subtasks', '=', False), ('subtask_effective_hours', '=', 0.0), ('encode_uom_in_days', '=', True)]}"/>
<label class="font-weight-bold" for="subtask_billable_effective_hours" string="Subtask Billable Effective Days" attrs="{'invisible': ['|', '|', ('allow_subtasks', '=', False), ('subtask_effective_hours', '=', 0.0), ('encode_uom_in_days', '=', False)]}"/>
</span>
<field name="subtask_billable_effective_hours" widget="timesheet_uom" class="mt-2" attrs="{'invisible' : ['|', ('allow_subtasks', '=', False), ('subtask_effective_hours', '=', 0.0)]}" nolabel="1"/>
<span>
<label class="font-weight-bold" for="subtask_non_billable_effective_hours" string="Subtask Non Billable Effective Hours" attrs="{'invisible': ['|', '|', ('allow_subtasks', '=', False), ('subtask_effective_hours', '=', 0.0), ('encode_uom_in_days', '=', True)]}"/>
<label class="font-weight-bold" for="subtask_non_billable_effective_hours" string="Subtask Non Billable Effective Days" attrs="{'invisible': ['|', '|', ('allow_subtasks', '=', False), ('subtask_effective_hours', '=', 0.0), ('encode_uom_in_days', '=', False)]}"/>
</span>
<field name="subtask_non_billable_effective_hours" widget="timesheet_uom" class="mt-2" attrs="{'invisible' : ['|', ('allow_subtasks', '=', False), ('subtask_effective_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 text-danger" for="billable_remaining_hours" string="Billable Remaining Hours" attrs="{'invisible': ['|', '|', ('planned_hours', '=', 0.0), ('encode_uom_in_days', '=', True), ('billable_remaining_hours', '&gt;=', 0)]}"/>
<label class="font-weight-bold" for="billable_remaining_hours" string="Billable Remaining Days" attrs="{'invisible': ['|', ('planned_hours', '=', 0.0), ('encode_uom_in_days', '=', False)]}"/> <label class="font-weight-bold" for="billable_remaining_hours" string="Billable Remaining Hours" attrs="{'invisible': ['|', '|', ('planned_hours', '=', 0.0), ('encode_uom_in_days', '=', True), ('billable_remaining_hours', '&lt;', 0)]}"/>
<label class="font-weight-bold text-danger" for="billable_remaining_hours" string="Billable Remaining Days" attrs="{'invisible': ['|', '|', ('planned_hours', '=', 0.0), ('encode_uom_in_days', '=', False), ('billable_remaining_hours', '&gt;=', 0)]}"/>
<label class="font-weight-bold" for="billable_remaining_hours" string="Billable Remaining Days" attrs="{'invisible': ['|', '|', ('planned_hours', '=', 0.0), ('encode_uom_in_days', '=', False), ('billable_remaining_hours', '&lt;', 0)]}"/>
</span> </span>
<field name="billable_remaining_hours" widget="timesheet_uom" class="oe_subtotal_footer_separator" attrs="{'invisible' : [('planned_hours', '=', 0.0)]}" nolabel="1"/> <field name="billable_remaining_hours" widget="timesheet_uom" class="oe_subtotal_footer_separator" attrs="{'invisible' : [('planned_hours', '=', 0.0)]}" decoration-danger="billable_remaining_hours &lt; 0" nolabel="1"/>
</xpath> </xpath>
</field> </field>
</record> </record>