[FIX] Now the action is type object, method return the same action in order to have...
authorvta vta@openerp.com <>
Thu, 8 Nov 2012 10:36:34 +0000 (11:36 +0100)
committervta vta@openerp.com <>
Thu, 8 Nov 2012 10:36:34 +0000 (11:36 +0100)
bzr revid: vta@openerp.com-20121108103634-acxd3tyzd13b09ck

addons/account/account_bank_statement.py
addons/account/account_view.xml

index 4808245..93d9dec 100644 (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):
index a946d04..059c96d 100644 (file)
             </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>