Skip to content

Commit 11fd5fe

Browse files
committed
[FIX] sale_timesheet_rounded : Fix context & constraint depricated.
1 parent eb9bed6 commit 11fd5fe

2 files changed

Lines changed: 5 additions & 10 deletions

File tree

sale_timesheet_rounded/models/account_analytic_line.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class AccountAnalyticLine(models.Model):
2020
@api.depends("timesheet_invoice_id.state")
2121
def _compute_project_id(self):
2222
field_rounded = self._fields["unit_amount_rounded"]
23-
if self._context.get("timesheet_no_recompute", False):
23+
if self.env.context.get("timesheet_no_recompute", False):
2424
self.env.remove_to_compute(field_rounded, self)
2525
return super()._compute_project_id()
2626

sale_timesheet_rounded/models/project_project.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,7 @@ class ProjectProject(models.Model):
3333
string="Timesheet rounding factor in percentage", default=100.0
3434
)
3535

36-
_sql_constraints = [
37-
(
38-
"check_timesheet_rounding_factor",
39-
"CHECK(0 <= timesheet_rounding_factor "
40-
"AND timesheet_rounding_factor <= 500)",
41-
"Timesheet rounding factor should stay between 0 and 500,"
42-
" endpoints included.",
43-
)
44-
]
36+
_check_timesheet_rounding_factor = models.Constraint(
37+
"CHECK(0 <= timesheet_rounding_factor AND timesheet_rounding_factor <= 500)",
38+
"Timesheet rounding factor should stay between 0 and 500, endpoints included.",
39+
)

0 commit comments

Comments
 (0)