[FIX]event : fixed the event registration report.

bzr revid: vra@tinyerp.com-20101013123714-cxe5rq2iub0qynau
This commit is contained in:
vra 2010-10-13 18:07:14 +05:30
parent 2f0ae0d7e0
commit f00296a0bd
3 changed files with 5 additions and 9 deletions

View File

@ -311,7 +311,7 @@ class event_registration(osv.osv):
"partner_invoice_id": fields.many2one('res.partner', 'Partner Invoiced', readonly=True, states={'draft': [('readonly', False)]}),
"contact_id": fields.many2one('res.partner.contact', 'Partner Contact', readonly=False, states={'done': [('readonly', True)]}), #TODO: filter only the contacts that have a function into the selected partner_id
"unit_price": fields.float('Unit Price', required=True, digits_compute=dp.get_precision('Sale Price'), readonly=True, states={'draft': [('readonly', False)]}),
'price_subtotal': fields.function(_amount_line, method=True, string='Subtotal', digits_compute=dp.get_precision('Sale Price')),
'price_subtotal': fields.function(_amount_line, method=True, string='Subtotal', digits_compute=dp.get_precision('Sale Price'), store=True),
"badge_ids": fields.one2many('event.registration.badge', 'registration_id', 'Badges', readonly=False, states={'done': [('readonly', True)]}),
"event_product": fields.char("Invoice Name", size=128, readonly=True, states={'draft': [('readonly', False)]}),
"tobe_invoiced": fields.boolean("To be Invoiced", readonly=True, states={'draft': [('readonly', False)]}),

View File

@ -46,7 +46,6 @@ class report_event_registration(osv.osv):
'speaker_id': fields.many2one('res.partner', 'Speaker', readonly=True),
'company_id': fields.many2one('res.company', 'Company', readonly=True),
'product_id': fields.many2one('product.product', 'Product', readonly=True),
"invoice_id": fields.many2one("account.invoice", "Invoice", readonly=True),
'total': fields.float('Total'),
'section_id': fields.related('event_id', 'section_id', type='many2one', relation='crm.case.section', string='Sale Team', store=True, readonly=True),
}
@ -73,10 +72,9 @@ class report_event_registration(osv.osv):
to_char(e.date_begin, 'YYYY-MM-DD') AS day,
count(t.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 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 state IN ('open')) AS confirm_state,
(SELECT SUM(c.invoice_id) FROM event_registration c WHERE c.event_id=e.id AND t.id=e.type) AS invoice_id,
(SELECT SUM(c.unit_price * c.nb_register) FROM event_registration c WHERE c.event_id=e.id AND t.id=e.type) AS total,
(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,
e.register_max AS register_max,
e.state AS state
FROM

View File

@ -23,7 +23,6 @@
<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="invoice_id" invisible="1"/>
<field name="section_id" invisible="1"/>
<field name="total" invisible="context.get('total_visible', True)" sum="Total"/>
</tree>
@ -69,7 +68,6 @@
<filter string="Invoiced"
name="invoiced"
icon="terp-dolar"
domain="[('invoice_id','!=','')]"
help = "Invoices" context="{'total_visible':0}"/>
<filter icon="terp-check"
string="Current Event" name="draft"
@ -121,7 +119,7 @@
<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_invoiced":1, "search_default_event":1,"search_default_365day":1,'group_by_no_leaf':1,'group_by':[]}</field>
<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">