[IMP] sale_timesheet: removes pricing_type in _check_sale_line_type

Since the pricing_type is compute non_stored field and the fixed_rate
value of this is set when the sale_line_id is defined in the project.
The condition checks if the pricing_type='fixed_rate' is useless.

task-2442683

closes odoo/odoo#66181
This commit is contained in:
Xavier BOL (xbo)
2021-04-16 10:35:47 +02:00
committed by Yannick Tivisse
parent 0cf146cb2d
commit f228ac33bd
+6 -7
View File
@@ -140,14 +140,13 @@ class Project(models.Model):
for project in self.filtered(lambda p: not p.project_overview):
project.project_overview = project.allow_billable or project.allow_timesheets
@api.constrains('sale_line_id', 'pricing_type')
@api.constrains('sale_line_id')
def _check_sale_line_type(self):
for project in self:
if project.pricing_type == 'fixed_rate':
if project.sale_line_id and not project.sale_line_id.is_service:
raise ValidationError(_("A billable project should be linked to a Sales Order Item having a Service product."))
if project.sale_line_id and project.sale_line_id.is_expense:
raise ValidationError(_("A billable project should be linked to a Sales Order Item that does not come from an expense or a vendor bill."))
for project in self.filtered(lambda project: project.sale_line_id):
if not project.sale_line_id.is_service:
raise ValidationError(_("A billable project should be linked to a Sales Order Item having a Service product."))
if project.sale_line_id.is_expense:
raise ValidationError(_("A billable project should be linked to a Sales Order Item that does not come from an expense or a vendor bill."))
@api.onchange('allow_billable')
def _onchange_allow_billable(self):