mirror of
https://github.com/bringout/oca-ocb-mail.git
synced 2026-04-22 18:02:00 +02:00
19.0 vanilla
This commit is contained in:
parent
5df8c07b59
commit
daa394e8b0
2114 changed files with 564841 additions and 299642 deletions
|
|
@ -5,8 +5,7 @@ from markupsafe import Markup
|
|||
from odoo import fields, models, _, tools
|
||||
|
||||
|
||||
class MassMailing(models.Model):
|
||||
_name = 'mailing.mailing'
|
||||
class MailingMailing(models.Model):
|
||||
_inherit = 'mailing.mailing'
|
||||
|
||||
use_leads = fields.Boolean('Use Leads', compute='_compute_use_leads')
|
||||
|
|
@ -18,9 +17,9 @@ class MassMailing(models.Model):
|
|||
def _compute_crm_lead_count(self):
|
||||
lead_data = self.env['crm.lead'].with_context(active_test=False).sudo()._read_group(
|
||||
[('source_id', 'in', self.source_id.ids)],
|
||||
['source_id'], ['source_id'],
|
||||
['source_id'], ['__count'],
|
||||
)
|
||||
mapped_data = {datum['source_id'][0]: datum['source_id_count'] for datum in lead_data}
|
||||
mapped_data = {source.id: count for source, count in lead_data}
|
||||
for mass_mailing in self:
|
||||
mass_mailing.crm_lead_count = mapped_data.get(mass_mailing.source_id.id, 0)
|
||||
|
||||
|
|
@ -42,18 +41,18 @@ class MassMailing(models.Model):
|
|||
'name': _("Leads Analysis"),
|
||||
'res_model': 'crm.lead',
|
||||
'type': 'ir.actions.act_window',
|
||||
'view_mode': 'graph,pivot,tree,form',
|
||||
'view_mode': 'list,pivot,graph,form',
|
||||
}
|
||||
|
||||
def _prepare_statistics_email_values(self):
|
||||
self.ensure_one()
|
||||
values = super(MassMailing, self)._prepare_statistics_email_values()
|
||||
values = super()._prepare_statistics_email_values()
|
||||
if not self.user_id:
|
||||
return values
|
||||
if not self.env['crm.lead'].check_access_rights('read', raise_exception=False):
|
||||
if not self.env['crm.lead'].has_access('read'):
|
||||
return values
|
||||
values['kpi_data'][1]['kpi_col1'] = {
|
||||
'value': tools.format_decimalized_number(self.crm_lead_count, decimal=0),
|
||||
'value': tools.misc.format_decimalized_number(self.crm_lead_count, decimal=0),
|
||||
'col_subtitle': _('LEADS'),
|
||||
}
|
||||
values['kpi_data'][1]['kpi_name'] = 'lead'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue