Odoo Mindscape. Understand Odoo faster. Explore modules, fields, dependencies and version differences in one place instead of digging through the source code.

Module: Fleet

Entity: fleet.vehicle

Compute Method: _compute_model_year

View 18.0 View 19.0
Inputs Method Outputs
  • model_id
  • model_id.id
- '''
-         Copies all the related fields from the model to the vehicle
-         '''
- model_values = dict()
- for vehicle in self.filtered('model_id'):
-             if vehicle.model_id.id in model_values:
-                 write_vals = model_values[vehicle.model_id.id]
-             else:
-                 # copy if value is truthy
-                 write_vals = {MODEL_FIELDS_TO_VEHICLE[key]: vehicle.model_id[key] for key in MODEL_FIELDS_TO_VEHICLE\
-                     if vehicle.model_id[key]}
-                 model_values[vehicle.model_id.id] = write_vals
-             vehicle.update(write_vals)
+ self._load_fields_from_model(['model_year'])

Back to entity