[FIX] HR_expense:HR - Invoicing an expense doesn't open the invoice form

lp bug: https://launchpad.net/bugs/720629 fixed

bzr revid: ara@tinyerp.com-20110218132742-fyambo8pxr3fs1n1
This commit is contained in:
ARA (OpenERP) 2011-02-18 18:57:42 +05:30
parent 14c8efe536
commit b36b8ba642
2 changed files with 20 additions and 1 deletions

View File

@ -124,6 +124,25 @@ class hr_expense_expense(osv.osv):
self.write(cr, uid, ids, {'state':'paid'})
return True
def invoice(self, cr, uid, ids, context=None):
mod_obj = self.pool.get('ir.model.data')
inv_id = self.action_invoice_create(cr, uid, ids)
res = mod_obj.get_object_reference(cr, uid, 'account', 'invoice_form')
res_id = res and res[1] or False,
return {
'name': 'Supplier Invoices',
'view_type': 'form',
'view_mode': 'form',
'view_id': [res_id],
'res_model': 'account.invoice',
'context': "{'type':'out_invoice', 'journal_type': 'purchase'}",
'type': 'ir.actions.act_window',
'nodestroy': True,
'target': 'current',
'res_id': inv_id,
}
def action_invoice_create(self, cr, uid, ids):
res = False
invoice_obj = self.pool.get('account.invoice')

View File

@ -104,7 +104,7 @@
<button name="draft" states="confirm,cancelled" string="Set to Draft" type="workflow" icon="gtk-convert" groups="base.group_hr_user"/>
<button name="refuse" states="confirm,accepted" string="Refuse" type="workflow" icon="gtk-no" groups="base.group_hr_user" />
<button name="confirm" states="draft" string="Confirm" type="workflow" icon="gtk-apply"/>
<button name="invoice" states="accepted" string="Invoice" type="workflow" icon="gtk-go-forward" groups="base.group_hr_user"/>
<button name="invoice" states="accepted" string="Invoice" type="object" icon="gtk-go-forward" groups="base.group_hr_user"/>
<button name="validate" states="confirm" string="Approve" type="workflow" icon="gtk-go-forward" groups="base.group_hr_user"/>
</group>
</page>