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

Good morning,
How can I change the action of the accounting Dashboard button, to show a personalized view of my customer invoice.

locate the view and the action:
account.journal.dashboard.kanban.
<button type = "object" name = "action_create_new" class = "btn btn-primary btn-sm">
<span> New 5555ll </span>
</button>

what would be the steps to follow. Please appreciate your support.

Avatar
Discard
Best Answer

HI,

For this you can inherit the corresponding model and redefine the button action in the python or you can inherit the view and make changes in the button and call your new action from it.

For inheriting and making changes inside an existing view see this: Inherit and Make change in Existing View


Thanks

Avatar
Discard
Author

Hi, create the model.

# -*- coding: utf-8 -*-

from odoo import fields,models,api,_

from odoo.exceptions import UserError

class AccountJournal(models.Model):

_inherit = "account.journal"

and a view for the account.journal model

<odoo>

<data>

<record id="action_boleta_venta1" model="ir.actions.act_window">

<field name="name">BOLETA DE VENTA1</field>

<field name="res_model">account.journal</field>

<field name="view_id" ref="account.account_journal_dashboard_kanban_view" />

<field name="view_mode">kanban</field>

<field name="context">

{

'type':'out_invoice',

'journal_type': 'sale',

'type_code':'03',

}

</field>

<field name="domain">

[('type','=','out_invoice'),('journal_id.invoice_type_code_id','=','03')]

</field>

<field name="search_view_id" ref="account.view_account_invoice_filter" />

</record>

</data>

</odoo>

locate the view and the action and edit the view manually test. switch to

account.journal.dashboard.kanban.

<button type = "object" name = "action_boleta_venta1" class = "btn btn-primary btn-sm">

<span> New 5555ll </span>

</button>

errors:

AttributeError: type object 'account.journal' has no attribute 'action_boleta_venta1'

You have to define the function with the name action_boleta_venta1 in account.journal model

Related Posts Replies Views Activity
2
Nov 24
264
1
Oct 24
332
4
Oct 24
324
2
Oct 24
361
2
Dec 24
667