Skip to Content
Menu
This question has been flagged
1 Reply
2353 Views

Hi All,

Right now we can see journal items when we click on more button in particular account(account.account ) ,same way i want to go journal entries based on the account type what we posted in journal entries. ....

like this I created  ====>  https://prnt.sc/gmw6t5

                                                https://prnt.sc/gmw73c


But its not filtering as per my account type

this is my updated code........


class account_account(models.Model):

_inherit = 'account.account'

def view_jounral_entries(self):

return {
'name': 'Journal Entries',
'view_type': 'form',
'view_mode': 'tree',
'res_model': 'account.move',
'type': 'ir.actions.act_window'
}
 <record id="action_filter_account_move" model="ir.actions.server">
        <field name="sequence" eval="3"/>
<field name="state">code</field>
<field name="type">ir.actions.server</field>
<field name="model_id" ref="payment_receipt_invoice.model_account_account"/>
<field name="code">model.browse(context.get('active_ids')).view_jounral_entries()</field>
<field name="condition">True</field>
<field name="name">Jounral Entries</field>
</record>

<record id="value_id_name" model="ir.values">
<field name="name">Journal</field>
<field name="key">action</field>
<field name="model">account.account</field>
<field name="key2">client_action_multi</field>
<field name="value" eval="'ir.actions.server,%d'%action_filter_account_move"/>
</record>


Avatar
Discard
Best Answer

<record id="action_filter_account_move" model="ir.actions.server">
   <field name="name">Show Journal Entry</field>
   <field name="model_id" ref="model_account_account" />
   <field name="state">code</field>
   <field name="code">action = self.filter_account_move(cr, uid,
    context.get('active_ids', []), context=context)</field>
  </record>

  <record id="action_filter_move" model="ir.values">
   <field eval="'client_action_multi'" name="key2" />
   <field eval="'account.account'" name="model" />
   <field name="name">Show Journal Entry</field>
   <field eval="'ir.actions.server,%d'%action_filter_account_move"
    name="value" />
  </record>



  write code in XML file it will create Show Journal Entry option under the action of account form view and then you have to create a method in py under the account.account model  "filter_account_move", when you click on Show Journal Entry from the account view it will be going to execute this method and so now here you can write your logic and return list view of account.move (journal entry)

  I hope it will helpful to you

Avatar
Discard