Server IP : 127.0.0.2 / Your IP : 3.144.6.159 Web Server : Apache/2.4.18 (Ubuntu) System : User : www-data ( ) PHP Version : 7.0.33-0ubuntu0.16.04.16 Disable Function : disk_free_space,disk_total_space,diskfreespace,dl,exec,fpaththru,getmyuid,getmypid,highlight_file,ignore_user_abord,leak,listen,link,opcache_get_configuration,opcache_get_status,passthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,php_uname,phpinfo,posix_ctermid,posix_getcwd,posix_getegid,posix_geteuid,posix_getgid,posix_getgrgid,posix_getgrnam,posix_getgroups,posix_getlogin,posix_getpgid,posix_getpgrp,posix_getpid,posix,_getppid,posix_getpwnam,posix_getpwuid,posix_getrlimit,posix_getsid,posix_getuid,posix_isatty,posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid,posix_setpgid,posix_setsid,posix_setuid,posix_times,posix_ttyname,posix_uname,pclose,popen,proc_open,proc_close,proc_get_status,proc_nice,proc_terminate,shell_exec,source,show_source,system,virtual MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /opt/odoo/addons/crm/report/ |
Upload File : |
# -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. from odoo import fields, models, tools class ActivityReport(models.Model): """ CRM Lead Analysis """ _name = "crm.activity.report" _auto = False _description = "CRM Activity Analysis" _rec_name = 'id' date = fields.Datetime('Date', readonly=True) author_id = fields.Many2one('res.partner', 'Created By', readonly=True) user_id = fields.Many2one('res.users', 'Salesperson', readonly=True) team_id = fields.Many2one('crm.team', 'Sales Team', readonly=True) lead_id = fields.Many2one('crm.lead', "Lead", readonly=True) subject = fields.Char('Summary', readonly=True) subtype_id = fields.Many2one('mail.message.subtype', 'Activity', readonly=True) country_id = fields.Many2one('res.country', 'Country', readonly=True) company_id = fields.Many2one('res.company', 'Company', readonly=True) stage_id = fields.Many2one('crm.stage', 'Stage', readonly=True) partner_id = fields.Many2one('res.partner', 'Partner/Customer', readonly=True) lead_type = fields.Char( string='Type', selection=[('lead', 'Lead'), ('opportunity', 'Opportunity')], help="Type is used to separate Leads and Opportunities") active = fields.Boolean('Active', readonly=True) probability = fields.Float('Probability', group_operator='avg', readonly=True) def init(self): tools.drop_view_if_exists(self._cr, 'crm_activity_report') self._cr.execute(""" CREATE VIEW crm_activity_report AS ( select m.id, m.subtype_id, m.author_id, m.date, m.subject, l.id as lead_id, l.user_id, l.team_id, l.country_id, l.company_id, l.stage_id, l.partner_id, l.type as lead_type, l.active, l.probability from "mail_message" m join "crm_lead" l on (m.res_id = l.id) WHERE (m.model = 'crm.lead') )""")