Files
odoo_source/addons/event_crm/models/event_event.py
T
Fabien Pinckaers 3363e55cac [IMP] cleanup of help messages in all modules
This commit aims at removing unuseful help message to:
1/ reduce translators work, to focus on more useful translations
2/ not sending unuseful information in load_views
3/ reduce help message to useful messages, so that we can mark
   fields having a tooltip in the future UI.
4/ some cleanup of existing messages too

The main use cases:
- REMOVED: help redundant with the field name, providing no extra info
- MOVED TO COMMENT: technical help messages, that should not be in UX

closes odoo/odoo#97279

Signed-off-by: Fabien Pinckaers <fp@odoo.com>
2022-08-02 00:26:53 +02:00

26 lines
916 B
Python

# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import fields, models, api
class EventEvent(models.Model):
_name = "event.event"
_inherit = "event.event"
lead_ids = fields.One2many(
'crm.lead', 'event_id', string="Leads", groups='sales_team.group_sale_salesman',
help="Leads generated from this event")
lead_count = fields.Integer(
string="# Leads", compute='_compute_lead_count', groups='sales_team.group_sale_salesman')
@api.depends('lead_ids')
def _compute_lead_count(self):
lead_data = self.env['crm.lead']._read_group(
[('event_id', 'in', self.ids)],
['event_id'], ['event_id']
)
mapped_data = {item['event_id'][0]: item['event_id_count'] for item in lead_data}
for event in self:
event.lead_count = mapped_data.get(event.id, 0)