From 273a0b4a7a0ec3d1a6d9df86c6ad0af35c92c8cf Mon Sep 17 00:00:00 2001 From: Umesh Gupta Date: Fri, 8 Apr 2022 06:03:36 +0000 Subject: [PATCH] [IMP] crm: display correct team count while creating a stage Currently, when creating a new stage, even if there are sales team(s) available, the `team_count` always displays zero, because it is a computed field but is not dependent on any other field. This commit improves the behavior by small hack, which makes the compute method dependent on `team_id` field so that it can be triggered while creating a record. taskID-2819559 closes odoo/odoo#88738 Signed-off-by: Thibault Delavallee (tde) --- addons/crm/models/crm_stage.py | 1 + 1 file changed, 1 insertion(+) diff --git a/addons/crm/models/crm_stage.py b/addons/crm/models/crm_stage.py index 9c9bb99487d..678ae3e268e 100644 --- a/addons/crm/models/crm_stage.py +++ b/addons/crm/models/crm_stage.py @@ -45,5 +45,6 @@ class Stage(models.Model): # This field for interface only team_count = fields.Integer('team_count', compute='_compute_team_count') + @api.depends('team_id') def _compute_team_count(self): self.team_count = self.env['crm.team'].search_count([])