diff options
| author | Nisha patel <nit@odoo.com> | 2020-08-05 12:23:03 +0000 |
|---|---|---|
| committer | Yannick Tivisse <yti@odoo.com> | 2020-08-05 14:27:54 +0000 |
| commit | e249d2b434cf883e1881c6f0c4d54cd5b1b1d978 (patch) | |
| tree | ab4c996ee1ec0768c4b8e77db9973629ab3d952a /addons/fleet/models/fleet_vehicle_model.py | |
| parent | 9ea0aca6ea30fe42e1a7e0a4eaeb79f92a521152 (diff) | |
[FIX] fleet: Fix model_count and category in the fleet
Currently, in Configuration > Service Type > Add a new service type.
The category field is mandatory but it does not appear on list view.
So in this commit, display the mandatory category field on list view
Currently, in Configuration > Manufacturers. The count of Models is
always 0 because the it's compute stored field without the depends
so not computed each time.
So in this commit, fix the count of models by adding a correct trigger
closes odoo/odoo#55475
Taskid: 2296851
Closes: #54515
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
Diffstat (limited to 'addons/fleet/models/fleet_vehicle_model.py')
| -rw-r--r-- | addons/fleet/models/fleet_vehicle_model.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/addons/fleet/models/fleet_vehicle_model.py b/addons/fleet/models/fleet_vehicle_model.py index d46564f44d1..48f36492c58 100644 --- a/addons/fleet/models/fleet_vehicle_model.py +++ b/addons/fleet/models/fleet_vehicle_model.py @@ -45,7 +45,9 @@ class FleetVehicleModelBrand(models.Model): name = fields.Char('Make', required=True) image_128 = fields.Image("Logo", max_width=128, max_height=128) model_count = fields.Integer(compute="_compute_model_count", string="", store=True) + model_ids = fields.One2many('fleet.vehicle.model', 'brand_id') + @api.depends('model_ids') def _compute_model_count(self): Model = self.env['fleet.vehicle.model'] for record in self: |
