[MOVE] Moved log analysis (based on now removed res.Logs) to mail.message reports.

bzr revid: tde@openerp.com-20120404132328-gfjop8t7n14ghpf8
This commit is contained in:
Thibault Delavallée 2012-04-04 15:23:28 +02:00
parent d99ff2ceef
commit a3ca99e7bc
7 changed files with 212 additions and 164 deletions

View File

@ -186,46 +186,4 @@ class board_line(osv.osv):
'position': lambda *args: 'left'
}
#class res_log_report(osv.osv):
# CSV:: access_res_log_report all,res.log.report,model_res_log_report,,1,0,0,0
#""" Log Report """
#_name = "res.log.report"
#_auto = False
#_description = "Log Report"
#_columns = {
#'name': fields.char('Year', size=64, required=False, readonly=True),
#'month':fields.selection([('01', 'January'), ('02', 'February'), \
#('03', 'March'), ('04', 'April'),\
#('05', 'May'), ('06', 'June'), \
#('07', 'July'), ('08', 'August'),\
#('09', 'September'), ('10', 'October'),\
#('11', 'November'), ('12', 'December')], 'Month', readonly=True),
#'day': fields.char('Day', size=128, readonly=True),
#'creation_date': fields.date('Creation Date', readonly=True),
#'res_model': fields.char('Object', size=128),
#'nbr': fields.integer('# of Entries', readonly=True)
#}
#def init(self, cr):
#"""
#Log Report
#@param cr: the current row, from the database cursor
#"""
#tools.drop_view_if_exists(cr,'res_log_report')
#cr.execute("""
#CREATE OR REPLACE VIEW res_log_report AS (
#SELECT
#l.id as id,
#1 as nbr,
#to_char(l.create_date, 'YYYY') as name,
#to_char(l.create_date, 'MM') as month,
#to_char(l.create_date, 'YYYY-MM-DD') as day,
#to_char(l.create_date, 'YYYY-MM-DD') as creation_date,
#l.res_model as res_model,
#date_trunc('day',l.create_date) as create_date
#FROM
#res_log l
#)""")
#res_log_report()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<data>
<!-- User Connection -->
<record model="ir.ui.view" id="view_user_connection_tree">
<field name="name">user.connection.tree</field>
@ -21,125 +22,11 @@
<field name="view_id" ref="view_user_connection_tree"></field>
</record>
<!-- Latest Activities -->
<!--
<record model="ir.actions.act_window" id="action_latest_activities_tree">
<field name="name">Latest Activities</field>
<field name="res_model">res.log</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
</record>
-->
<!-- Log report search view -->
<!--
<record id="view_res_log_report_filter" model="ir.ui.view">
<field name="name">res.log.report.select</field>
<field name="model">res.log.report</field>
<field name="type">search</field>
<field name="arch" type="xml">
<search string="Log Analysis">
<group>
<filter icon="terp-go-year" string=" Year "
domain="[('create_date','&lt;=', time.strftime('%%Y-%%m-%%d')),('create_date','&gt;=',time.strftime('%%Y-01-01'))]"
help="Log created in current year"/>
<filter icon="terp-go-month" string=" Month "
name="month"
domain="[('create_date','&lt;=',(datetime.date.today()+relativedelta(day=31)).strftime('%%Y-%%m-%%d')),('create_date','&gt;=',(datetime.date.today()-relativedelta(day=1)).strftime('%%Y-%%m-%%d'))]"
help="Log created in current month"/>
<filter icon="terp-go-month"
string=" Month-1 "
domain="[('create_date','&lt;=', (datetime.date.today() - relativedelta(day=31, months=1)).strftime('%%Y-%%m-%%d')),('create_date','&gt;=',(datetime.date.today() - relativedelta(day=1,months=1)).strftime('%%Y-%%m-%%d'))]"
help="Log created in last month"/>
</group>
<newline/>
<group expand="1" string="Group By...">
<filter string="Model" icon="terp-go-home" context="{'group_by':'res_model'}" />
<separator orientation="vertical"/>
<filter string="Day" icon="terp-go-today"
domain="[]" context="{'group_by':'day'}"/>
<filter string="Month" icon="terp-go-month"
domain="[]" context="{'group_by':'month'}" />
<filter string="Year" icon="terp-go-year"
domain="[]" context="{'group_by':'name'}" />
</group>
</search>
</field>
</record>
-->
<!-- Log report Tree view -->
<!--
<record id="view_res_log_report_tree" model="ir.ui.view">
<field name="name">res.log.report.tree</field>
<field name="model">res.log.report</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Log Analysis">
<field name="name" invisible="1"/>
<field name="month" invisible="1"/>
<field name="day" invisible="1"/>
<field name="res_model" invisible="1"/>
<field name="nbr" />
<field name="creation_date" invisible="1"/>
</tree>
</field>
</record>
-->
<record id="board_config_overview" model="ir.actions.client">
<field name="name">Configuration Overview</field>
<field name="tag">board.config.overview</field>
</record>
<!-- Monthly Activity per Document -->
<!--
<record id="board_res_log_report_graph" model="ir.ui.view">
<field name="name">board.res.log.report.graph</field>
<field name="model">res.log.report</field>
<field name="type">graph</field>
<field name="arch" type="xml">
<graph string="Monthly Activity per Document" type="bar">
<field name="res_model"/>
<field name="nbr" operator="+"/>
</graph>
</field>
</record>
<record id="board_monthly_res_log_report_action" model="ir.actions.act_window">
<field name="name">Monthly Activity per Document</field>
<field name="res_model">res.log.report</field>
<field name="view_type">form</field>
<field name="view_mode">graph,tree</field>
<field name="domain">[('create_date','&gt;',(datetime.date.today()-datetime.timedelta(days=30)).strftime('%Y-%m-%d'))]</field>
<field name="context">{'group_by':['res_model'],'group_by_no_leaf':1}</field>
<field name="view_id" ref="board_res_log_report_graph"></field>
</record>
-->
<!-- Weekly Global Activity -->
<!--
<record id="board_weekly_res_log_report_graph" model="ir.ui.view">
<field name="name">board.weekly.res.log.report.graph</field>
<field name="model">res.log.report</field>
<field name="type">graph</field>
<field name="arch" type="xml">
<graph string="Weekly Global Activity" type="bar">
<field name="day"/>
<field name="nbr" operator="+"/>
</graph>
</field>
</record>
<record id="board_weekly_res_log_report_action" model="ir.actions.act_window">
<field name="name">Weekly Global Activity</field>
<field name="res_model">res.log.report</field>
<field name="view_type">form</field>
<field name="view_mode">graph,tree</field>
<field name="domain">[('create_date','&gt;',(datetime.date.today()-datetime.timedelta(days=7)).strftime('%Y-%m-%d'))]</field>
<field name="context">{'group_by':['day'],'group_by_no_leaf':1}</field>
<field name="view_id" ref="board_weekly_res_log_report_graph"></field>
</record>
-->
<record id="board_administration_form" model="ir.ui.view">
<field name="name">board.administration.form</field>
<field name="model">board.board</field>
@ -174,5 +61,5 @@
<menuitem id="base.menu_dashboard" name="Dashboards" parent="base.menu_reporting_board" sequence="0"/>
<menuitem id="base.menu_dashboard_admin" action="open_board_administration_form" parent="base.menu_dashboard" icon="terp-graph"/>
</data>
</data>
</openerp>

View File

@ -25,6 +25,7 @@ import mail_group
import mail_subscription
import res_users
import res_partner
import report
import wizard
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -56,16 +56,17 @@ The main features are:
'website': 'http://www.openerp.com',
'depends': ['base', 'base_tools'],
'data': [
"wizard/mail_compose_message_view.xml",
"mail_message_view.xml",
"mail_subscription_view.xml",
"mail_thread_view.xml",
"mail_group_view.xml",
"res_partner_view.xml",
'wizard/mail_compose_message_view.xml',
'mail_message_view.xml',
'mail_subscription_view.xml',
'mail_thread_view.xml',
'mail_group_view.xml',
'res_partner_view.xml',
'security/mail_security.xml',
'security/ir.model.access.csv',
'mail_data.xml',
'res_users_view.xml',
'report/mail_message_report_view.xml',
],
'installable': True,
'auto_install': False,

View File

@ -0,0 +1,25 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2009-Today OpenERP SA (<http://www.openerp.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import mail_message_report
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -0,0 +1,66 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2009-today OpenERP SA (<http://www.openerp.com>)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>
#
##############################################################################
from osv import fields, osv
import time
import tools
class mail_message_report(osv.osv):
#CSV:: access_res_log_report all,res.log.report,model_res_log_report,,1,0,0,0
""" Log Report """
_name = "mail.message.report"
_auto = False
_description = "Mail Message Report"
_columns = {
'name': fields.char('Year', size=64, required=False, readonly=True),
'month':fields.selection([('01', 'January'), ('02', 'February'), \
('03', 'March'), ('04', 'April'),\
('05', 'May'), ('06', 'June'), \
('07', 'July'), ('08', 'August'),\
('09', 'September'), ('10', 'October'),\
('11', 'November'), ('12', 'December')], 'Month', readonly=True),
'day': fields.char('Day', size=128, readonly=True),
'creation_date': fields.date('Creation Date', readonly=True),
'res_model': fields.char('Object', size=128),
'nbr': fields.integer('# of Entries', readonly=True)
}
def init(self, cr):
"""
Log Report
@param cr: the current row, from the database cursor
"""
tools.drop_view_if_exists(cr,'mail_message_report')
cr.execute("""
CREATE OR REPLACE VIEW mail_message_report AS (
SELECT
l.id as id,
1 as nbr,
to_char(l.create_date, 'YYYY') as name,
to_char(l.create_date, 'MM') as month,
to_char(l.create_date, 'YYYY-MM-DD') as day,
to_char(l.create_date, 'YYYY-MM-DD') as creation_date,
l.model as res_model,
date_trunc('day',l.create_date) as create_date
FROM
mail_message l
)""")

View File

@ -0,0 +1,110 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<!-- Latest Activities -->
<record model="ir.actions.act_window" id="action_latest_activities_tree">
<field name="name">Latest Activities</field>
<field name="res_model">mail.message</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
</record>
<!-- Mail message report search view -->
<record id="view_mail_message_report_filter" model="ir.ui.view">
<field name="name">mail.message.report.select</field>
<field name="model">mail.message.report</field>
<field name="type">search</field>
<field name="arch" type="xml">
<search string="Mail message Analysis">
<group>
<filter icon="terp-go-year" string=" Year "
domain="[('create_date','&lt;=', time.strftime('%%Y-%%m-%%d')),('create_date','&gt;=',time.strftime('%%Y-01-01'))]"
help="Messages created in current year"/>
<filter icon="terp-go-month" string=" Month "
name="month"
domain="[('create_date','&lt;=',(datetime.date.today()+relativedelta(day=31)).strftime('%%Y-%%m-%%d')),('create_date','&gt;=',(datetime.date.today()-relativedelta(day=1)).strftime('%%Y-%%m-%%d'))]"
help="Messages created in current month"/>
<filter icon="terp-go-month"
string=" Month-1 "
domain="[('create_date','&lt;=', (datetime.date.today() - relativedelta(day=31, months=1)).strftime('%%Y-%%m-%%d')),('create_date','&gt;=',(datetime.date.today() - relativedelta(day=1,months=1)).strftime('%%Y-%%m-%%d'))]"
help="Messages created in last month"/>
</group>
<newline/>
<group expand="1" string="Group By...">
<filter string="Model" icon="terp-go-home" context="{'group_by':'res_model'}" />
<separator orientation="vertical"/>
<filter string="Day" icon="terp-go-today"
domain="[]" context="{'group_by':'day'}"/>
<filter string="Month" icon="terp-go-month"
domain="[]" context="{'group_by':'month'}" />
<filter string="Year" icon="terp-go-year"
domain="[]" context="{'group_by':'name'}" />
</group>
</search>
</field>
</record>
<!-- Mail message report Tree view -->
<record id="view_mail_message_report_tree" model="ir.ui.view">
<field name="name">mail.message.report.tree</field>
<field name="model">mail.message.report</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Mail message Analysis">
<field name="name" invisible="1"/>
<field name="month" invisible="1"/>
<field name="day" invisible="1"/>
<field name="res_model" invisible="1"/>
<field name="nbr" />
<field name="creation_date" invisible="1"/>
</tree>
</field>
</record>
<!-- Monthly Activity per Document -->
<record id="board_mail_message_report_graph" model="ir.ui.view">
<field name="name">board.mail.message.report.graph</field>
<field name="model">mail.message.report</field>
<field name="type">graph</field>
<field name="arch" type="xml">
<graph string="Monthly Activity per Document" type="bar">
<field name="res_model"/>
<field name="nbr" operator="+"/>
</graph>
</field>
</record>
<record id="board_monthly_mail_message_report_action" model="ir.actions.act_window">
<field name="name">Monthly Activity per Document</field>
<field name="res_model">mail.message.report</field>
<field name="view_type">form</field>
<field name="view_mode">graph,tree</field>
<field name="domain">[('create_date','&gt;',(datetime.date.today()-datetime.timedelta(days=30)).strftime('%Y-%m-%d'))]</field>
<field name="context">{'group_by':['res_model'],'group_by_no_leaf':1}</field>
<field name="view_id" ref="board_mail_message_report_graph"></field>
</record>
<!-- Weekly Global Activity -->
<record id="board_weekly_mail_message_report_graph" model="ir.ui.view">
<field name="name">board.weekly.mail.message.report.graph</field>
<field name="model">mail.message.report</field>
<field name="type">graph</field>
<field name="arch" type="xml">
<graph string="Weekly Global Activity" type="bar">
<field name="day"/>
<field name="nbr" operator="+"/>
</graph>
</field>
</record>
<record id="board_weekly_mail_message_report_action" model="ir.actions.act_window">
<field name="name">Weekly Global Activity</field>
<field name="res_model">mail.message.report</field>
<field name="view_type">form</field>
<field name="view_mode">graph,tree</field>
<field name="domain">[('create_date','&gt;',(datetime.date.today()-datetime.timedelta(days=7)).strftime('%Y-%m-%d'))]</field>
<field name="context">{'group_by':['day'],'group_by_no_leaf':1}</field>
<field name="view_id" ref="board_weekly_mail_message_report_graph"></field>
</record>
</data>
</openerp>