[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
This commit is contained in:
parent
ec4fc783a6
commit
697153f8bd
|
@ -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:
|
Loading…
Reference in New Issue