[MERGE] trunk-bug-1024145-abo: fix an issue in event reporting due to a missing outer join in the psql view
lp bug: https://launchpad.net/bugs/1024145 fixed bzr revid: abo@openerp.com-20121011145427-m8ol0yo980kz5j9k
This commit is contained in:
commit
9f296a8005
|
@ -23,16 +23,16 @@ from osv import fields, osv
|
|||
import tools
|
||||
|
||||
class report_event_registration(osv.osv):
|
||||
|
||||
_name = "report.event.registration"
|
||||
_description = "Events Analysis"
|
||||
_auto = False
|
||||
_columns = {
|
||||
'event_date': fields.char('Event Start Date', size=64, 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),
|
||||
'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),
|
||||
'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),
|
||||
|
@ -48,17 +48,18 @@ class report_event_registration(osv.osv):
|
|||
'company_id': fields.many2one('res.company', 'Company', readonly=True),
|
||||
}
|
||||
_order = 'event_date desc'
|
||||
|
||||
def init(self, cr):
|
||||
"""
|
||||
initialize the sql view for the event registration
|
||||
cr -- the cursor
|
||||
Initialize the sql view for the event registration
|
||||
"""
|
||||
tools.drop_view_if_exists(cr, 'report_event_registration')
|
||||
cr.execute("""
|
||||
CREATE OR REPLACE view report_event_registration AS (
|
||||
SELECT
|
||||
event_id,
|
||||
r.id,
|
||||
|
||||
# TOFIX this request won't select events that have no registration
|
||||
cr.execute(""" CREATE VIEW report_event_registration AS (
|
||||
SELECT
|
||||
e.id::char || '/' || coalesce(r.id::char,'') AS id,
|
||||
e.id AS event_id,
|
||||
e.user_id AS user_id,
|
||||
r.user_id AS user_id_registration,
|
||||
r.name AS name_registration,
|
||||
|
@ -72,23 +73,21 @@ class report_event_registration(osv.osv):
|
|||
CASE WHEN r.state IN ('open','done') THEN r.nb_register ELSE 0 END AS confirm_state,
|
||||
e.type AS event_type,
|
||||
e.register_max AS register_max,
|
||||
e.state AS event_state,
|
||||
r.state AS registration_state
|
||||
FROM
|
||||
e.state AS event_state,
|
||||
r.state AS registration_state
|
||||
FROM
|
||||
event_event e
|
||||
LEFT JOIN event_registration r ON (e.id=r.event_id)
|
||||
|
||||
LEFT JOIN
|
||||
event_registration r ON (e.id=r.event_id)
|
||||
|
||||
GROUP BY
|
||||
GROUP BY
|
||||
event_id,
|
||||
user_id_registration,
|
||||
e.id,
|
||||
r.id,
|
||||
registration_state,
|
||||
r.nb_register,
|
||||
event_type, e.id, e.date_begin, e.main_speaker_id,
|
||||
e.register_max,event_id, e.user_id,e.company_id,
|
||||
event_type,
|
||||
e.id,
|
||||
e.date_begin,
|
||||
e.user_id,
|
||||
event_state,
|
||||
e.company_id,
|
||||
|
@ -97,9 +96,8 @@ class report_event_registration(osv.osv):
|
|||
month,
|
||||
e.register_max,
|
||||
name_registration
|
||||
|
||||
)
|
||||
""")
|
||||
)
|
||||
""")
|
||||
|
||||
report_event_registration()
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<?xml version="1.0"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<data>
|
||||
|
||||
<!-- report , event on registration... start -->
|
||||
<!-- Report, event on registration -->
|
||||
<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>
|
||||
|
@ -28,7 +28,6 @@
|
|||
</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>
|
||||
|
@ -42,8 +41,7 @@
|
|||
</field>
|
||||
</record>
|
||||
|
||||
<!-- Event on Registration search view -->
|
||||
|
||||
<!-- Event on Registration search view -->
|
||||
<record model="ir.ui.view" id="view_report_event_registration_search">
|
||||
<field name="name">report.event.registration.search</field>
|
||||
<field name="model">report.event.registration</field>
|
||||
|
@ -82,28 +80,28 @@
|
|||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.actions.act_window" id="action_report_event_registration">
|
||||
<record model="ir.actions.act_window" id="action_report_event_registration">
|
||||
<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>
|
||||
<field name="search_view_id" ref="view_report_event_registration_search"/>
|
||||
<field name="context">{"search_default_year":1,"search_default_this_month":1,"search_default_365day":1, "search_default_invoiced":1, "search_default_event":1, 'group_by_no_leaf':1, 'group_by':[]}</field>
|
||||
<field name="context">{"search_default_year":1,"search_default_this_month":1,"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"/>
|
||||
<field name="act_window_id" ref="action_report_event_registration"/>
|
||||
</record>
|
||||
</record>
|
||||
|
||||
<record model="ir.actions.act_window.view" id="action_report_event_registration_graph">
|
||||
<record model="ir.actions.act_window.view" id="action_report_event_registration_graph">
|
||||
<field name="sequence" eval="2"/>
|
||||
<field name="view_mode">graph</field>
|
||||
<field name="view_id" ref="report_event_registration_graph"/>
|
||||
<field name="act_window_id" ref="action_report_event_registration"/>
|
||||
</record>
|
||||
</record>
|
||||
|
||||
<menuitem parent="base.menu_reporting" id="menu_reporting_events" sequence="30" groups="event.group_event_manager" name="Events"/>
|
||||
<menuitem parent="menu_reporting_events" action="action_report_event_registration" id="menu_report_event_registration" sequence="3" groups="event.group_event_manager"/>
|
||||
|
|
|
@ -1426,7 +1426,9 @@ class project_task_history_cumulative(osv.osv):
|
|||
}
|
||||
|
||||
def init(self, cr):
|
||||
cr.execute(""" CREATE OR REPLACE VIEW project_task_history_cumulative AS (
|
||||
tools.drop_view_if_exists(cr, 'report_event_registration')
|
||||
|
||||
cr.execute(""" CREATE VIEW project_task_history_cumulative AS (
|
||||
SELECT
|
||||
history.date::varchar||'-'||history.history_id::varchar AS id,
|
||||
history.date AS end_date,
|
||||
|
|
Loading…
Reference in New Issue