[FIX] sale_timesheet: Consider NULL as a False value
A NULL value in the database column is considered as a False value for boolean fields in Odoo. Hence the sql constraint should reflect this semantic. Otherwise, the constraint might not be applicable when installing the sale_timesheet module. Task 2192763
This commit is contained in:
committed by
Yannick Tivisse
parent
a96e167169
commit
be7773353e
@@ -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')
|
||||
|
||||
Reference in New Issue
Block a user