Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
Coopdevs OCB mirror
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Coopdevs
Odoo
Coopdevs OCB mirror
Commits
d248c666
Commit
d248c666
authored
14 years ago
by
Quentin De Paoli
Browse files
Options
Downloads
Patches
Plain Diff
[IMP] event: events analysis
bzr revid: qdp-launchpad@tinyerp.com-20101014172248-rbb3kmrfk5pfgysy
parent
15581aa5
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
addons/event/report/report_event_registration.py
+52
-17
52 additions, 17 deletions
addons/event/report/report_event_registration.py
addons/event/report/report_event_registration_view.xml
+29
-25
29 additions, 25 deletions
addons/event/report/report_event_registration_view.xml
with
81 additions
and
42 deletions
addons/event/report/report_event_registration.py
+
52
−
17
View file @
d248c666
...
...
@@ -25,19 +25,18 @@ import tools
class
report_event_registration
(
osv
.
osv
):
_name
=
"
report.event.registration
"
_description
=
"
Events
on registrations and Events on type
"
_description
=
"
Events
Analysis
"
_auto
=
False
_rec_name
=
'
date
'
_columns
=
{
'
date
'
:
fields
.
date
(
'
Date
'
,
readonly
=
True
),
'
date
'
:
fields
.
date
(
'
Event Start
Date
'
,
readonly
=
True
),
'
year
'
:
fields
.
char
(
'
Year
'
,
size
=
4
,
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
(
'
Date
'
,
size
=
128
,
readonly
=
True
),
'
event_id
'
:
fields
.
many2one
(
'
event.event
'
,
'
Event Related
'
,
required
=
True
),
'
draft_state
'
:
fields
.
integer
(
'
# No of draft Registration.
'
,
size
=
20
),
'
confirm_state
'
:
fields
.
integer
(
'
# No of Confirm Registration
'
,
size
=
20
),
'
event_id
'
:
fields
.
many2one
(
'
event.event
'
,
'
Event
'
,
required
=
True
),
'
draft_state
'
:
fields
.
integer
(
'
# No of Draft Registrations
'
,
size
=
20
),
'
confirm_state
'
:
fields
.
integer
(
'
# No of Confirmed Registrations
'
,
size
=
20
),
'
register_max
'
:
fields
.
integer
(
'
Maximum Registrations
'
),
'
nbevent
'
:
fields
.
integer
(
'
Number Of Events
'
),
'
type
'
:
fields
.
many2one
(
'
event.type
'
,
'
Event Type
'
),
...
...
@@ -59,8 +58,27 @@ class report_event_registration(osv.osv):
cr
.
execute
(
"""
CREATE OR REPLACE view report_event_registration AS (
SELECT
e.id AS id,
c.event_id AS event_id,
id,
event_id,
date,
user_id,
section_id,
company_id,
product_id,
speaker_id,
year,
month,
nbevent,
type,
SUM(draft_state) AS draft_state,
SUM(confirm_state) AS confirm_state,
SUM(total) AS total,
register_max,
state
FROM(
SELECT
MIN(e.id) AS id,
e.id AS event_id,
e.date_begin AS date,
e.user_id AS user_id,
e.section_id AS section_id,
...
...
@@ -69,26 +87,43 @@ class report_event_registration(osv.osv):
e.main_speaker_id AS speaker_id,
to_char(e.date_begin,
'
YYYY
'
) AS year,
to_char(e.date_begin,
'
MM
'
) AS month,
to_char(e.date_begin,
'
YYYY-MM-DD
'
) AS day,
count(t.id) AS nbevent,
count(e.id) AS nbevent,
t.id AS type,
(SELECT SUM(c.nb_register) FROM event_registration c WHERE c.event_id=e.id AND t.id=e.type AND c.state IN (
'
draft
'
))
AS draft_state,
(SELECT SUM(c.nb_register) FROM event_registration c WHERE c.event_id=e.id AND t.id=e.type AND c.state IN (
'
open
'
))
AS confirm_state,
(SELECT SUM(c.price_subtotal) FROM event_registration c WHERE c.event_id=e.id AND t.id=e.type AND c.state IN (
'
done
'
))
AS total,
CASE WHEN c.state IN (
'
draft
'
) THEN c.nb_register ELSE 0 END
AS draft_state,
CASE WHEN c.state IN (
'
open
'
,
'
done
'
) THEN c.nb_register ELSE 0 END
AS confirm_state,
CASE WHEN c.state IN (
'
done
'
) THEN c.price_subtotal ELSE 0 END
AS total,
e.register_max AS register_max,
e.state AS state
FROM
event_event e
INNER
JOIN
LEFT
JOIN
event_registration c ON (e.id=c.event_id)
INNER
JOIN
LEFT
JOIN
event_type t ON (e.type=t.id)
GROUP BY
to_char(e.date_begin,
'
YYYY
'
),
to_char(e.date_begin,
'
MM
'
),
c.state,
c.nb_register,
t.id, e.id, e.date_begin, e.main_speaker_id,
e.register_max, e.type, e.state, c.event_id, e.user_id,e.company_id,e.product_id,e.section_id,
to_char(e.date_begin,
'
YYYY-MM-DD
'
)
)
"""
)
to_char(e.date_begin,
'
YYYY-MM-DD
'
), c.id, c.price_subtotal )AS foo
GROUP BY
id,
event_id,
date,
user_id,
section_id,
company_id,
product_id,
speaker_id,
year,
month,
nbevent,
type,
register_max,
state
)
"""
)
report_event_registration
()
This diff is collapsed.
Click to expand it.
addons/event/report/report_event_registration_view.xml
+
29
−
25
View file @
d248c666
<?xml version="1.0"?>
<openerp>
<data>
<!-- report , event on registration... start -->
<record
model=
"ir.ui.view"
id=
"report_event_registration_tree"
>
<field
name=
"name"
>
report.event.registration.tree
</field>
<field
name=
"model"
>
report.event.registration
</field>
<field
name=
"type"
>
tree
</field>
<field
name=
"arch"
type=
"xml"
>
<tree
colors=
"blue:state in ('draft');black:state in ('confirm'
,'approved'
);gray:state in('done','cancel')"
string=
"Event
on Registration
"
>
<tree
colors=
"blue:state in ('draft');black:state in ('confirm');gray:state in('done','cancel')"
string=
"Event
s Analysis
"
>
<field
name=
"date"
invisible=
"1"
/>
<field
name=
"user_id"
invisible=
"1"
/>
<field
name=
"speaker_id"
invisible=
"1"
/>
<field
name=
"year"
invisible=
"1"
/>
<field
name=
"day"
invisible=
"1"
/>
<field
name=
"month"
invisible=
"1"
/>
<field
name=
"event_id"
invisible=
"1"
/>
<field
name=
"state"
invisible=
"1"
/>
<field
name=
"type"
invisible=
"1"
/>
<field
name=
"nbevent"
/>
<field
name=
"draft_state"
invisible=
"context.get('no_of_draft_visible', False)"
/>
<field
name=
"draft_state"
invisible=
"context.get('no_of_draft_
in
visible', False)"
/>
<field
name=
"confirm_state"
/>
<field
name=
"register_max"
invisible=
"context.get('max_reg_event_visible', True)"
/>
<field
name=
"company_id"
invisible=
"1"
/>
<field
name=
"product_id"
invisible=
"1"
/>
<field
name=
"section_id"
invisible=
"1"
/>
<field
name=
"total"
invisible=
"context.get('total_visible', True)"
sum=
"Total"
/>
<field
name=
"total"
invisible=
"context.get('total_
in
visible', True)"
sum=
"Total"
/>
</tree>
</field>
</record>
<record
model =
"ir.ui.view"
id=
"report_event_registration_graph"
>
<field
name=
"name"
>
report.event.registration.graph
</field>
<field
name=
"model"
>
report.event.registration
</field>
...
...
@@ -54,27 +55,29 @@
<group
col=
"8"
colspan=
"4"
>
<filter
icon=
"terp-go-year"
string=
"Last 365 Days"
name=
"365day"
domain=
"[('date','<=', time.strftime('%%Y-%%m-%%d')),('date','>',(datetime.date.today()-datetime.timedelta(days=365)).strftime('%%Y-%%m-%%d'))]"
help=
"
Tasks performed
in last 365 days"
/>
help=
"
Events with beginning date
in last 365 days"
/>
<filter
icon=
"terp-go-month"
string=
"Last 30 Days"
name=
"month"
domain=
"[('date','<=', time.strftime('%%Y-%%m-%%d')), ('date','>',(datetime.date.today()-datetime.timedelta(days=30)).strftime('%%Y-%%m-%%d'))]"
help=
"
Tasks performed
in last 30 days"
/>
help=
"
Events with beginning date
in last 30 days"
/>
<filter
icon=
"terp-go-week"
string=
"Last 7 Days"
separator=
"1"
domain=
"[('date','<=', time.strftime('%%Y-%%m-%%d')), ('date','>',(datetime.date.today()-datetime.timedelta(days=7)).strftime('%%Y-%%m-%%d'))]"
help=
"
Tasks dur
in
g
last 7 days"
/>
help=
"
Events with beginning date
in last 7 days"
/>
<separator
orientation=
"vertical"
/>
<filter
string=
"Invoiced"
name=
"invoiced"
icon=
"terp-dolar"
help =
"Invoices"
context=
"{'total_visible':0}"
/>
<filter
icon=
"terp-check"
string=
"Current Event"
name=
"draft"
string=
"Current Event
s
"
name=
"draft"
domain=
"[('state','in',('draft', 'confirm'))]"
help=
"Events in draft or confirmed state"
/>
<separator
orientation=
"vertical"
/>
<filter
icon=
"terp-camera_test"
string=
"Confirmed Registrations"
domain=
"[('state','=','confirm')]"
context=
"{'no_of_draft_visible':1}"
help=
"Events in confirmed state"
/>
help=
"Registrations in confirmed or done state"
context=
"{'no_of_draft_invisible':1}"
/>
<filter
string=
"Invoiced"
name=
"invoiced"
icon=
"terp-dolar"
help =
"Invoiced Registrations only"
context=
"{'total_invisible':0, 'no_of_draft_invisible':1}"
/>
<separator
orientation=
"vertical"
/>
<field
name=
"event_id"
string=
"Event"
/>
<field
name=
"user_id"
widget=
"selection"
>
...
...
@@ -87,22 +90,24 @@
<newline/>
<group
expand=
"1"
string=
"Group By..."
colspan=
"4"
col=
"12"
>
<filter
string=
"Event"
name=
"event"
icon=
"terp-crm"
context=
"{'group_by':'event_id', 'max_reg_event_visible':0}"
/>
<filter
string=
"Responsible"
name=
"user_id"
icon=
"terp-personal"
context=
"{'group_by': 'user_id'}"
/>
<filter
string=
"Speaker"
name=
"speaker"
icon=
"terp-personal+"
context=
"{'group_by': 'speaker_id'}"
/>
<filter
string=
"Sale Team"
icon=
"terp-personal"
context=
"{'group_by': 'section_id'}"
/>
<filter
string=
"Product"
icon=
"terp-product"
context=
"{'group_by': 'product_id'}"
/>
<filter
string=
"Company"
icon=
"terp-go-home"
domain=
"[]"
context=
"{'group_by':'company_id'}"
groups=
"base.group_multi_company"
/>
<filter
string=
"Event Type"
icon=
"terp-crm"
context=
"{'group_by':'type'}"
/>
<separator
orientation=
"vertical"
/>
<filter
string=
"State"
icon=
"terp-stock_effects-object-colorize"
context=
"{'group_by':'state'}"
help=
"Registration State"
/>
<filter
string=
"Event"
name=
"event"
icon=
"terp-crm"
context=
"{'group_by':'event_id', 'max_reg_event_visible':0}"
/>
<filter
string=
"Product"
icon=
"terp-product"
context=
"{'group_by': 'product_id'}"
/>
<separator
orientation=
"vertical"
/>
<filter
string=
"Speaker"
name=
"user"
icon=
"terp-personal+"
context=
"{'group_by': 'speaker_id'}"
/>
<filter
string=
"Event Type"
icon=
"terp-crm"
context=
"{'group_by':'type'}"
/>
<filter
string=
"State"
icon=
"terp-stock_effects-object-colorize"
context=
"{'group_by':'state'}"
help=
"Events States"
/>
<separator
orientation=
"vertical"
groups=
"base.group_multi_company"
/>
<filter
string=
"Company"
icon=
"terp-go-home"
domain=
"[]"
context=
"{'group_by':'company_id'}"
groups=
"base.group_multi_company"
/>
<separator
orientation=
"vertical"
/>
<filter
string=
"Date"
icon=
"terp-go-month"
domain=
"[]"
context=
"{'group_by':'da
y'}
"
/>
domain=
"[]"
context=
"{'group_by':'da
te'}"
help=
"Event Beginning Date
"
/>
<filter
string=
"Month"
icon=
"terp-go-month"
domain=
"[]"
context=
"{'group_by':'month'}"
/>
domain=
"[]"
context=
"{'group_by':'month'}"
help=
"Event Beginning Date"
/>
<filter
string=
"Year"
icon=
"terp-go-year"
domain=
"[]"
context=
"{'group_by':'year'}"
/>
domain=
"[]"
context=
"{'group_by':'year'}"
help=
"Event Beginning Date"
/>
</group>
<newline/>
<group
expand=
"0"
string=
"Extended Filters..."
groups=
"base.group_extended"
>
...
...
@@ -114,7 +119,7 @@
</record>
<record
model=
"ir.actions.act_window"
id=
"action_report_event_registration"
>
<field
name=
"name"
>
Registration
Analysis
</field>
<field
name=
"name"
>
Events
Analysis
</field>
<field
name=
"res_model"
>
report.event.registration
</field>
<field
name=
"view_type"
>
form
</field>
<field
name=
"view_mode"
>
tree,graph
</field>
...
...
@@ -122,7 +127,7 @@
<field
name=
"context"
>
{"search_default_365day":1, "search_default_invoiced":1, "search_default_event":1, 'group_by_no_leaf':1, 'group_by':[]}
</field>
</record>
<record
model=
"ir.actions.act_window.view"
id=
"action_report_event_registration_tree"
>
<record
model=
"ir.actions.act_window.view"
id=
"action_report_event_registration_tree"
>
<field
name=
"sequence"
eval=
"1"
/>
<field
name=
"view_mode"
>
tree
</field>
<field
name=
"view_id"
ref=
"report_event_registration_tree"
/>
...
...
@@ -138,6 +143,5 @@
<menuitem
parent=
"base.menu_report_association"
action=
"action_report_event_registration"
id=
"menu_report_event_registration"
sequence=
"3"
groups=
"base.group_system,base.group_marketing_manager"
/>
<!-- end... -->
</data>
</openerp>
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment