From 697153f8bd23680bcb9f68e6c366e77e85834f40 Mon Sep 17 00:00:00 2001 From: "ARA (OpenERP)" Date: Fri, 8 Oct 2010 14:33:26 +0530 Subject: [PATCH] [FIX] Event: Creating invoice from registration now open with good search view and customer invoice instead of vendor ivnoices bzr revid: ara@tinyerp.com-20101008090326-bzg7pmhymcwg8tsa --- addons/event/wizard/event_make_invoice.py | 26 +++++++++++------------ 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/addons/event/wizard/event_make_invoice.py b/addons/event/wizard/event_make_invoice.py index 8540c267ddb..96bffff537c 100644 --- a/addons/event/wizard/event_make_invoice.py +++ b/addons/event/wizard/event_make_invoice.py @@ -28,10 +28,9 @@ class event_make_invoice(osv.osv_memory): _name = "event.make.invoice" _description = "Event Make Invoice" _columns = { - 'grouped': fields.boolean('Group the invoices'), 'invoice_date':fields.date('Invoice Date'), - } + } def view_init(self, cr, uid, fields, context=None): """ @@ -65,22 +64,22 @@ class event_make_invoice(osv.osv_memory): _("Registration doesn't have any partner to invoice.")) def default_get(self, cr, uid, fields_list, context=None): - res = super(event_make_invoice, self).default_get(cr, uid, fields_list, context) - return res - - def make_invoice(self, cr, uid, ids, context={}): + return super(event_make_invoice, self).default_get(cr, uid, fields_list, context) + def make_invoice(self, cr, uid, ids, context=None): reg_obj = self.pool.get('event.registration') + mod_obj = self.pool.get('ir.model.data') newinv = [] + if context is None: + context = {} for data in self.browse(cr, uid, ids): res = reg_obj.action_invoice_create(cr, uid, context.get(('active_ids'),[]), data.grouped, date_inv = data.invoice_date) - mod_obj =self.pool.get('ir.model.data') - result = mod_obj._get_id(cr, uid, 'account', 'view_account_invoice_filter') - - id = mod_obj.read(cr, uid, result, ['res_id']) - + form_id = mod_obj._get_id(cr, uid, 'account', 'invoice_form') + form_res = mod_obj.browse(cr, uid, form_id, context=context).res_id + tree_id = mod_obj._get_id(cr, uid, 'account', 'invoice_tree') + tree_res = mod_obj.browse(cr, uid, tree_id, context=context).res_id return { 'domain': "[('id','in',%s)]" % res, 'name': 'Invoices', @@ -88,10 +87,11 @@ class event_make_invoice(osv.osv_memory): 'view_mode': 'tree,form', 'res_model': 'account.invoice', 'view_id': False, + 'views': [(tree_res, 'tree'), (form_res, 'form')], 'context': "{'type':'out_refund'}", 'type': 'ir.actions.act_window', - 'search_view_id': id['id'] } event_make_invoice() -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file