[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
This commit is contained in:
Xavier BOL (xbo)
2021-04-16 10:35:47 +02:00
committed by Yannick Tivisse
parent 74f07717d0
commit 4909a3e26b
+1 -4
View File
@@ -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):