[FIX] hr_expense: open the account.move from the expense

bzr revid: qdp-launchpad@openerp.com-20130306171736-32gq9iyshvcpiddg
This commit is contained in:
Quentin (OpenERP) 2013-03-06 18:17:36 +01:00
parent fd54f58ccb
commit 0b2fa6275c
2 changed files with 6 additions and 5 deletions

View File

@ -362,10 +362,11 @@ class hr_expense_expense(osv.osv):
This function returns an action that display existing account.move of given expense ids.
'''
assert len(ids) == 1, 'This option should only be used for a single id at a time'
voucher_id = self.browse(cr, uid, ids[0], context=context).voucher_id.id
expense = self.browse(cr, uid, ids[0], context=context)
assert expense.account_move_id
try:
dummy, view_id = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'account', 'view_move_form')
except:
except ValueError, e:
view_id = False
result = {
'name': _('Expense Account Move'),
@ -376,7 +377,7 @@ class hr_expense_expense(osv.osv):
'type': 'ir.actions.act_window',
'nodestroy': True,
'target': 'current',
'res_id': account_move_id,
'res_id': expense.account_move_id.id,
}
return result

View File

@ -67,7 +67,7 @@
<button name="refuse" states="confirm,accepted" string="Refuse" type="workflow" groups="base.group_hr_user" />
<button name="draft" states="confirm,cancelled" string="Set to Draft" type="workflow" groups="base.group_hr_user" />
<button name="done" states="accepted" string="Generate Accounting Entries" type="workflow" groups="account.group_account_invoice" class="oe_highlight"/>
<button name="action_view_move" states="done" string="Open Account Item" type="object" groups="account.group_account_invoice"/>
<button name="action_view_move" states="done" string="Open Accounting Entries" type="object" groups="account.group_account_invoice"/>
<field name="state" widget="statusbar" statusbar_visible="draft,confirm,accepted,done" statusbar_colors='{"confirm":"blue","cancelled":"red"}'/>
</header>
<sheet>
@ -134,7 +134,7 @@
<group string="Accounting Data">
<field name="journal_id" widget="selection" domain="[('type', '=', 'purchase')]"/>
<field name="account_move_id"/>
<field name="voucher_id" context="{'form_view_ref': 'account_voucher.view_purchase_receipt_form'}"/>
<field name="voucher_id" invisible="1" context="{'form_view_ref': 'account_voucher.view_purchase_receipt_form'}"/>
</group>
</group>
</page>