Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# Copyright 2022 Le Filament (https://le-filament.com)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html)
from odoo import models
class ProjectTask(models.Model):
_inherit = "project.task"
# ------------------------------------------------------
# Fields declaration
# ------------------------------------------------------
# ------------------------------------------------------
# SQL Constraints
# ------------------------------------------------------
# ------------------------------------------------------
# Default methods
# ------------------------------------------------------
# ------------------------------------------------------
# Computed fields / Search Fields
# ------------------------------------------------------
def _compute_progress_hours(self):
"""
Inherit parent function to allow progress > 100
"""
super()._compute_progress_hours
for task in self:
if task.planned_hours > 0.0:
task_total_hours = task.effective_hours + task.subtask_effective_hours
if task_total_hours > task.planned_hours:
task.progress = round(
100.0 * task_total_hours / task.planned_hours, 2
)
# ------------------------------------------------------
# Onchange / Constraints
# ------------------------------------------------------
# ------------------------------------------------------
# CRUD methods (ORM overrides)
# ------------------------------------------------------
# ------------------------------------------------------
# Actions
# ------------------------------------------------------
# ------------------------------------------------------
# Business methods
# ------------------------------------------------------