From f4779930d55016451bdb8cd46eadac6d24146646 Mon Sep 17 00:00:00 2001 From: "Xavier BOL (xbo)" Date: Mon, 11 Jan 2021 15:59:51 +0100 Subject: [PATCH] [IMP] sale_timesheet: move sql contraint for timesheet_product_id Before this commit, we want the timesheet_product_id field be set if the project is billable and allow timesheets. But, now the timesheet_product_timesheet field is only required for fsm project which is billable and allows timesheets. This commit moves the sql constraint in industry_fsm_sale. task-2424382 --- addons/sale_timesheet/models/project.py | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/addons/sale_timesheet/models/project.py b/addons/sale_timesheet/models/project.py index a6be8bd127c..a0a151ba62a 100644 --- a/addons/sale_timesheet/models/project.py +++ b/addons/sale_timesheet/models/project.py @@ -47,18 +47,6 @@ class Project(models.Model): default=_default_timesheet_product_id) warning_employee_rate = fields.Boolean(compute='_compute_warning_employee_rate') - _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 IS NOT TRUE) - OR (allow_timesheets IS NOT TRUE) - 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('allow_billable', 'sale_order_id', 'partner_id', 'pricing_type') def _compute_display_create_order(self): for project in self: