[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) <tde@openerp.com>
This commit is contained in:
Umesh Gupta
2022-06-15 09:59:57 +02:00
parent 010ae983ea
commit 273a0b4a7a
+1
View File
@@ -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([])