Skip to content

Commit 4e5a21e

Browse files
committed
project_task_scheduling: Fix flake8 errors and fix unit test error
1 parent 5578e2d commit 4e5a21e

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
lines changed

project_task_assignment/models/project.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,9 @@ def _compute_employee_ids(self):
5454
@api.depends('employee_id', 'date_start_assignation',
5555
'date_stop_assignation')
5656
def _compute_scheduled(self):
57-
for record in self:
58-
record.scheduled = record.employee_id \
59-
and record.date_start_assignation \
60-
and record.date_stop_assignation
57+
for rec in self:
58+
start, stop = rec.date_start_assignation, rec.date_stop_assignation
59+
rec.scheduled = rec.employee_id and start and stop
6160

6261
@api.onchange('project_id')
6362
def _onchange_project_id_employee_id(self):

project_task_scheduling/models/project.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
2-
from odoo import api, fields, models
2+
from odoo import fields, models
33

44

55
class Task(models.Model):

project_task_scheduling/models/project_task_scheduling_proposal.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ class ProjectTaskScheduling(models.TransientModel):
2121
delayed_tasks = fields.Float(
2222
compute='_compute_delayed_tasks'
2323
)
24-
evaluation = fields.Float()
24+
evaluation = fields.Float(
25+
digits=(16,4)
26+
)
2527
task_scheduling_ids = fields.One2many(
2628
comodel_name='project.task.scheduling',
2729
inverse_name='proposal_id',
@@ -98,4 +100,5 @@ def action_recompute(self):
98100
'or Date start is far from the deadline of some tasks'))
99101

100102
hours_dy += max_hours_delayed
101-
self.evaluation = task_dy_count * max_hours_delayed * 2 + hours_dy
103+
evaluation = task_dy_count * max_hours_delayed * 2 + hours_dy
104+
self.evaluation = round(evaluation, 10)

project_task_scheduling/tests/test_scheduling_proposal.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
2-
from datetime import timedelta
3-
42
from odoo.addons.project_task_scheduling.tests.common import \
53
TestSchedulingCommon
64

@@ -9,8 +7,8 @@ class TestSchedulingProposal(TestSchedulingCommon):
97

108
def test_action_recompute(self):
119
self.wizard.action_accept()
12-
proposals = self.env['project.task.scheduling.proposal'].search([])
13-
best_proposal = proposals[-1]
10+
proposal_obj = self.env['project.task.scheduling.proposal']
11+
best_proposal = proposal_obj.search([])[-1]
1412
evaluation = best_proposal.evaluation
1513
new_proposal = best_proposal.copy()
1614
new_proposal.action_recompute()

0 commit comments

Comments
 (0)