[REF] project_issue: replace report by pivot / graph views
hr.recruitment.report is not necessary anymore as it can be replaced by classic pivot and graph views on hr.applicant model. Applicant has been slighty modified to ease reporting * adding group_operator average on both days to computation; * adding group_operator average on working hours computation;
This commit is contained in:
committed by
Thibault Delavallée
parent
c0b2d51d00
commit
dcccb667bb
@@ -2,4 +2,3 @@
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from . import models
|
||||
from . import report
|
||||
|
||||
@@ -55,12 +55,12 @@ class ProjectIssue(models.Model):
|
||||
duration = fields.Float('Duration')
|
||||
task_id = fields.Many2one('project.task', string='Task', domain="[('project_id','=',project_id)]",
|
||||
help="You can link this issue to an existing task or directly create a new one from here")
|
||||
day_open = fields.Float(compute='_compute_day', string='Days to Assign', store=True)
|
||||
day_close = fields.Float(compute='_compute_day', string='Days to Close', store=True)
|
||||
day_open = fields.Float(compute='_compute_day', string='Days to Assign', store=True, group_operator="avg")
|
||||
day_close = fields.Float(compute='_compute_day', string='Days to Close', store=True, group_operator="avg")
|
||||
|
||||
user_id = fields.Many2one('res.users', string='Assigned to', index=True, track_visibility='onchange', default=lambda self: self.env.uid)
|
||||
working_hours_open = fields.Float(compute='_compute_day', string='Working Hours to assign the Issue', store=True)
|
||||
working_hours_close = fields.Float(compute='_compute_day', string='Working Hours to close the Issue', store=True)
|
||||
working_hours_open = fields.Float(compute='_compute_day', string='Working Hours to assign the Issue', store=True, group_operator="avg")
|
||||
working_hours_close = fields.Float(compute='_compute_day', string='Working Hours to close the Issue', store=True, group_operator="avg")
|
||||
inactivity_days = fields.Integer(compute='_compute_inactivity_days', string='Days since last action',
|
||||
help="Difference in days between last action and current date")
|
||||
color = fields.Integer('Color Index')
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from . import project_issue_report
|
||||
@@ -1,58 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from odoo import api, fields, models, tools
|
||||
|
||||
|
||||
class ProjectIssueReport(models.Model):
|
||||
_name = "project.issue.report"
|
||||
_auto = False
|
||||
|
||||
company_id = fields.Many2one('res.company', 'Company', readonly=True)
|
||||
opening_date = fields.Datetime('Date of Opening', readonly=True)
|
||||
create_date = fields.Datetime('Create Date', readonly=True)
|
||||
date_closed = fields.Datetime('Date of Closing', readonly=True)
|
||||
date_last_stage_update = fields.Datetime('Last Stage Update', readonly=True)
|
||||
stage_id = fields.Many2one('project.task.type', 'Stage')
|
||||
nbr_issues = fields.Integer('# of Issues', readonly=True)
|
||||
working_hours_open = fields.Float('Avg. Working Hours to Open', readonly=True, group_operator="avg")
|
||||
working_hours_close = fields.Float('Avg. Working Hours to Close', readonly=True, group_operator="avg")
|
||||
delay_open = fields.Float('Avg. Delay to Open', digits=(16, 2), readonly=True, group_operator="avg",
|
||||
help="Number of Days to open the project issue.")
|
||||
delay_close = fields.Float('Avg. Delay to Close', digits=(16, 2), readonly=True, group_operator="avg",
|
||||
help="Number of Days to close the project issue")
|
||||
priority = fields.Selection([('0', 'Low'), ('1', 'Normal'), ('2', 'High')])
|
||||
project_id = fields.Many2one('project.project', 'Project', readonly=True)
|
||||
user_id = fields.Many2one('res.users', 'Assigned to', readonly=True)
|
||||
partner_id = fields.Many2one('res.partner', 'Contact')
|
||||
email = fields.Integer('# Emails', readonly=True)
|
||||
|
||||
@api.model_cr
|
||||
def init(self):
|
||||
tools.drop_view_if_exists(self._cr, 'project_issue_report')
|
||||
self._cr.execute("""
|
||||
CREATE OR REPLACE VIEW project_issue_report AS (
|
||||
SELECT
|
||||
c.id as id,
|
||||
c.date_open as opening_date,
|
||||
c.create_date as create_date,
|
||||
c.date_last_stage_update as date_last_stage_update,
|
||||
c.user_id,
|
||||
c.working_hours_open,
|
||||
c.working_hours_close,
|
||||
c.stage_id,
|
||||
c.date_closed as date_closed,
|
||||
c.company_id as company_id,
|
||||
c.priority as priority,
|
||||
c.project_id as project_id,
|
||||
1 as nbr_issues,
|
||||
c.partner_id,
|
||||
c.day_open as delay_open,
|
||||
c.day_close as delay_close,
|
||||
(SELECT count(id) FROM mail_message WHERE model='project.issue' AND message_type IN ('email', 'comment') AND res_id=c.id) AS email
|
||||
|
||||
FROM
|
||||
project_issue c
|
||||
LEFT JOIN project_task t on c.task_id = t.id
|
||||
WHERE c.active= 'true'
|
||||
)""")
|
||||
@@ -1,46 +1,30 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<record id="view_project_issue_report_pivot" model="ir.ui.view">
|
||||
<field name="name">project.issue.report.pivot</field>
|
||||
<field name="model">project.issue.report</field>
|
||||
<field name="name">project.issue.pivot</field>
|
||||
<field name="model">project.issue</field>
|
||||
<field name="arch" type="xml">
|
||||
<pivot string="Project Issue" disable_linking="True">
|
||||
<field name="project_id" type="row"/>
|
||||
<field name="create_date" interval="month" type="col"/>
|
||||
<field name="nbr_issues" type="measure"/>
|
||||
</pivot>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_project_issue_report_graph" model="ir.ui.view">
|
||||
<field name="name">project.issue.report.graph</field>
|
||||
<field name="model">project.issue.report</field>
|
||||
<field name="name">project.issue.graph</field>
|
||||
<field name="model">project.issue</field>
|
||||
<field name="arch" type="xml">
|
||||
<graph string="Project Issue">
|
||||
<field name="project_id" type="row"/>
|
||||
<field name="create_date" interval="month" type="col"/>
|
||||
<field name="nbr_issues" type="measure"/>
|
||||
</graph>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- Custom reports (aka filters) -->
|
||||
<record id="filter_issue_report_delay" model="ir.filters">
|
||||
<field name="name">Delay</field>
|
||||
<field name="model_id">project.issue.report</field>
|
||||
<field name="user_id" eval="False"/>
|
||||
<field name="context">{'group_by': ['project_id'], 'measures': ['delay_close', 'delay_open']}</field>
|
||||
</record>
|
||||
<record id="filter_issue_report_responsible" model="ir.filters">
|
||||
<field name="name">By Responsible</field>
|
||||
<field name="model_id">project.issue.report</field>
|
||||
<field name="user_id" eval="False"/>
|
||||
<field name="context">{'group_by': ['project_id', 'user_id']}</field>
|
||||
</record>
|
||||
|
||||
<record id="view_project_issue_report_filter" model="ir.ui.view">
|
||||
<field name="name">project.issue.report.select</field>
|
||||
<field name="model">project.issue.report</field>
|
||||
<field name="name">project.issue.search</field>
|
||||
<field name="model">project.issue</field>
|
||||
<field name="arch" type="xml">
|
||||
<search string="Search">
|
||||
<field name="project_id"/>
|
||||
@@ -63,18 +47,36 @@
|
||||
|
||||
<record id="action_project_issue_report" model="ir.actions.act_window">
|
||||
<field name="name">Issues Analysis</field>
|
||||
<field name="res_model">project.issue.report</field>
|
||||
<field name="res_model">project.issue</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">graph,pivot</field>
|
||||
<field name="context">{'search_default_year':1,'search_default_This Month':1,'search_default_project':1}</field>
|
||||
<field name="search_view_id" ref="view_project_issue_report_filter"/>
|
||||
<field name="view_id"></field> <!-- force empty -->
|
||||
<field name="view_ids" eval="[(5, 0, 0),
|
||||
(0, 0, {'view_mode': 'pivot', 'view_id': ref('view_project_issue_report_pivot')}),
|
||||
(0, 0, {'view_mode': 'graph', 'view_id': ref('view_project_issue_report_graph')})]"/>
|
||||
<field name="help">This report on the project issues allows you to analyse the quality of your support or after-sales services. You can track the issues per age. You can analyse the time required to open or close an issue, the number of email to exchange and the time spent on average by issues.</field>
|
||||
</record>
|
||||
|
||||
<!-- Custom reports (aka filters) -->
|
||||
<record id="filter_issue_report_delay" model="ir.filters">
|
||||
<field name="name">Delay</field>
|
||||
<field name="model_id">project.issue</field>
|
||||
<field name="user_id" eval="False"/>
|
||||
<field name="action_id" ref="action_project_issue_report"/>
|
||||
<field name="context">{'group_by': ['project_id'], 'measures': ['delay_close', 'delay_open']}</field>
|
||||
</record>
|
||||
<record id="filter_issue_report_responsible" model="ir.filters">
|
||||
<field name="name">By Responsible</field>
|
||||
<field name="model_id">project.issue</field>
|
||||
<field name="user_id" eval="False"/>
|
||||
<field name="action_id" ref="action_project_issue_report"/>
|
||||
<field name="context">{'group_by': ['project_id', 'user_id']}</field>
|
||||
</record>
|
||||
|
||||
<record id="action_project_issue_report_filtered" model="ir.actions.act_window">
|
||||
<field name="name">Issues Analysis</field>
|
||||
<field name="res_model">project.issue.report</field>
|
||||
<field name="res_model">project.issue</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">graph,pivot</field>
|
||||
<field name="context">{
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
|
||||
access_project_issue_user,project.issue,model_project_issue,project.group_project_user,1,1,1,1
|
||||
access_project_issue_report_all,project.issue.report,model_project_issue_report,project.group_project_manager,1,1,1,1
|
||||
access_resource_calendar_project_manager,resource.calendar.project.manager,resource.model_resource_calendar,project.group_project_manager,1,1,1,1
|
||||
access_project_issue_report_user,project.issue.report user,model_project_issue_report,project.group_project_user,1,0,0,0
|
||||
access_project_issue_portal,project.issue,model_project_issue,base.group_portal,1,0,0,0
|
||||
|
||||
|
@@ -287,6 +287,7 @@
|
||||
<field name="view_type">form</field>
|
||||
<field name="name">Issues</field>
|
||||
<field name="view_mode">kanban,tree,form,calendar,graph,pivot</field>
|
||||
<field name="search_view_id" ref="view_project_issue_filter"/>
|
||||
<field name="context">{
|
||||
'search_default_project_id': [active_id],
|
||||
'default_project_id': active_id,
|
||||
@@ -306,6 +307,7 @@
|
||||
<field name="view_type">form</field>
|
||||
<field name="name">Issues</field>
|
||||
<field name="view_mode">kanban,tree,form,calendar,graph</field>
|
||||
<field name="search_view_id" ref="view_project_issue_filter"/>
|
||||
<field name="help" type="html">
|
||||
<p>
|
||||
The Odoo issues tracker allows you to efficiently manage things
|
||||
@@ -337,6 +339,7 @@
|
||||
(0, 0, {'view_mode': 'tree', 'view_id': ref('project_issue_tree_view')}),
|
||||
(0, 0, {'view_mode': 'calendar', 'view_id': ref('project_issue_calendar_view')}),
|
||||
(0, 0, {'view_mode': 'form', 'view_id': ref('project_issue_form_view')}),
|
||||
(0, 0, {'view_mode': 'pivot', 'view_id': ref('project_issue_pivot_view')}),
|
||||
(0, 0, {'view_mode': 'graph', 'view_id': ref('project_issue_graph_view')}),
|
||||
]"/>
|
||||
<field name="help" type="html">
|
||||
|
||||
Reference in New Issue
Block a user