[FIX] Now the action is type object, method return the same action in order to have the right context.

bzr revid: vta@openerp.com-20121108103634-acxd3tyzd13b09ck
This commit is contained in:
vta vta@openerp.com 2012-11-08 11:36:34 +01:00
parent d9acaadba7
commit cb7cb1420b
2 changed files with 22 additions and 13 deletions

View File

@ -486,6 +486,25 @@ class account_bank_statement(osv.osv):
default['move_line_ids'] = []
return super(account_bank_statement, self).copy(cr, uid, id, default, context=context)
def button_journal_entries(self, cr, uid, ids, context=None):
mod_obj = self.pool.get('ir.model.data')
res = mod_obj.get_object_reference(cr, uid, 'account', 'view_move_line_tree')
res_id = res and res[1] or False
ctx = dict(context)
ctx.update({
'active_model': 'account.bank.statement',
'active_id': ids[0],
})
return {
'view_type':'tree',
'view_mode':'tree',
'res_model':'account.move.line',
'view_id':res_id,
'type':'ir.actions.act_window',
'domain':[('statement_id','=',ctx.get('active_id'))],
'context':ctx,
}
account_bank_statement()
class account_bank_statement_line(osv.osv):

View File

@ -680,25 +680,15 @@
</field>
</record>
<record id="action_view_bank_statement_journal_entries" model="ir.actions.act_window">
<field name="name">Journal Items</field>
<field name="res_model">account.move.line</field>
<field name="view_type">tree</field>
<field name="view_mode">tree</field>
<field name="view_id" ref="view_move_line_tree"/>
<field name="domain">[('statement_id', '=', context.get('active_ids'))]</field>
</record>
<record id="view_bank_statement_form_journal_items" model="ir.ui.view">
<field name="name">account.bank.statement.journal.items.form.inherit</field>
<field name="model">account.bank.statement</field>
<field name="inherit_id" ref="view_bank_statement_form"/>
<field name="arch" type="xml">
<xpath expr="//div[@name='import_buttons']" position="inside">
<button name="%(action_view_bank_statement_journal_entries)d"
string="Journal Items" type="action"
attrs="{'invisible':[('state','!=','confirm')]}"
context="{'journal_id':'journal_id'}"/>
<button name="button_journal_entries"
string="Journal Items" type="object"
attrs="{'invisible':[('state','!=','confirm')]}"/>
</xpath>
</field>
</record>