[IMP] fleet: Make the image readonly on the vehicle and model

Currently when user change the image on a vehicle, it change it
for the car manufacturer and the goal of this image is to recognize
the manufacturer of the vehicle.

After this commit is applied, the model and vehicle image will be
fixed as per the selected brand image. user will not be able to
change from the vehicle and model.

closes odoo/odoo#44153

Taskid: 2168922
Closes: #44153
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
This commit is contained in:
Ujas Dubal
2020-02-19 10:54:30 +00:00
committed by Barad Mahendra
parent e28809a1d6
commit ff23944ad7
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -78,7 +78,7 @@ class FleetVehicle(models.Model):
horsepower_tax = fields.Float('Horsepower Taxation')
power = fields.Integer('Power', help='Power in kW of the vehicle')
co2 = fields.Float('CO2 Emissions', help='CO2 emissions of the vehicle')
image_128 = fields.Image(related='model_id.image_128', readonly=False)
image_128 = fields.Image(related='model_id.image_128', readonly=True)
contract_renewal_due_soon = fields.Boolean(compute='_compute_contract_reminder', search='_search_contract_renewal_due_soon',
string='Has Contracts to renew', multi='contract_info')
contract_renewal_overdue = fields.Boolean(compute='_compute_contract_reminder', search='_search_get_overdue_contract_reminder',
+1 -1
View File
@@ -14,7 +14,7 @@ class FleetVehicleModel(models.Model):
vendors = fields.Many2many('res.partner', 'fleet_vehicle_model_vendors', 'model_id', 'partner_id', string='Vendors')
manager_id = fields.Many2one('res.users', 'Fleet Manager', default=lambda self: self.env.uid,
domain=lambda self: [('groups_id', 'in', self.env.ref('fleet.fleet_group_manager').id)])
image_128 = fields.Image(related='brand_id.image_128', readonly=False)
image_128 = fields.Image(related='brand_id.image_128', readonly=True)
active = fields.Boolean(default=True)
@api.depends('name', 'brand_id')