[FIX] sale_timesheet: add onchange to set default value

When changing the type of a product to 'service' the
new service policy is empty by default, and should not
be !
This commit is contained in:
Jérome Maes
2017-10-17 09:04:49 +02:00
parent 44b3491450
commit a222afb7d4
+9
View File
@@ -52,3 +52,12 @@ class ProductTemplate(models.Model):
def _onchange_service_tracking(self):
if self.service_tracking != 'task_global_project':
self.project_id = False
@api.onchange('type')
def _onchange_type(self):
if self.type == 'service':
self.invoice_policy = 'order'
self.service_type = 'timesheet'
elif self.type == 'consu':
self.invoice_policy = 'order'
self.service_type = 'manual'