From 4909a3e26bfc6a71be47bf2ee256e142746d3af9 Mon Sep 17 00:00:00 2001 From: "Xavier BOL (xbo)" Date: Tue, 23 Feb 2021 11:59:37 +0100 Subject: [PATCH] [IMP] sale_timesheet: update visibility condition of create sale order button Before this commit, the "create sale order" button on project form view is visible when the project is billable, the partner is set and the pricing_type is different than 'task_rate'. But since the pricing_type changes we need to update this condition to display this button when the pricing_type is equal to 'task_rate'. Because the others pricing types mean the project has already had a SO. This commit changes the visibility condition of this button to display it when the project is billable, the partner is set and the pricing type is equal to 'task_rate'. task-2442683 --- addons/sale_timesheet/models/project.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/addons/sale_timesheet/models/project.py b/addons/sale_timesheet/models/project.py index 848fc71d352..2ce0eddc3c4 100644 --- a/addons/sale_timesheet/models/project.py +++ b/addons/sale_timesheet/models/project.py @@ -108,10 +108,7 @@ class Project(models.Model): @api.depends('sale_order_id', 'partner_id', 'pricing_type') def _compute_display_create_order(self): for project in self: - show = True - if not project.partner_id or project.pricing_type == 'task_rate' or not project.allow_billable or project.sale_order_id: - show = False - project.display_create_order = show + project.display_create_order = project.partner_id and project.pricing_type == 'task_rate' @api.depends('allow_timesheets', 'allow_billable') def _compute_timesheet_product_id(self):