[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>
This commit is contained in:
Nisha patel
2020-08-05 14:27:54 +00:00
committed by Yannick Tivisse
parent 9ea0aca6ea
commit e249d2b434
2 changed files with 3 additions and 0 deletions
@@ -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:
@@ -401,6 +401,7 @@
<field name="arch" type="xml">
<tree string="Service Types">
<field name="name" />
<field name="category"/>
</tree>
</field>
</record>