diff --git a/addons/sale_timesheet/models/project.py b/addons/sale_timesheet/models/project.py index f9df7e809c7..42ceb21ff93 100644 --- a/addons/sale_timesheet/models/project.py +++ b/addons/sale_timesheet/models/project.py @@ -47,7 +47,14 @@ class Project(models.Model): default=_default_timesheet_product_id) _sql_constraints = [ - ('timesheet_product_required_if_billable_and_timesheets', "CHECK((allow_billable = 't' AND allow_timesheets = 't' AND timesheet_product_id IS NOT NULL) OR (allow_billable = 'f') OR (allow_timesheets = 'f'))", 'The timesheet product is required when the task can be billed and timesheets are allowed.'), + ('timesheet_product_required_if_billable_and_timesheets', """ + CHECK( + (allow_billable = 't' AND allow_timesheets = 't' AND timesheet_product_id IS NOT NULL) + OR (allow_billable = 'f') + OR (allow_timesheets = 'f') + OR (allow_billable IS NULL) + OR (allow_timesheets IS NULL) + )""", 'The timesheet product is required when the task can be billed and timesheets are allowed.'), ] @api.depends('billable_type', 'allow_billable', 'sale_order_id', 'partner_id')