Good afternoon,
I am trying to create an action and change the default action of the accounting Dashboard for invoices.
I want to show a form view with specific values.
but I have an error message that I don't understand.
MODEL
# -*- coding: utf-8 -*-
from odoo import fields,models,api,_
from odoo.exceptions import UserError
class AccountJournal(models.Model):
_inherit = "account.journal"
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("account.journal.dashboard.kanban") and the action and edit the view manually test. switch to
<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'
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Accounting
- Inventory
- PoS
- Project management
- MRP
This question has been flagged
Hi,
You have to define the function with the name action_boleta_venta1 in the account.journal model .
class AccountJournal(models.Model):
_inherit = 'account.journal'
@api.multi
def action_boleta_venta1(self):
#write the function
Thanks
thanks I check it, I defined the action in the view. That way it should work too? If you have the answer, tell me. Thank you.
change the button type to action then
<button type = "action" name = "action_boleta_venta1" class = "btn btn-primary btn-sm">
<span> New 5555ll </span>
</button>
Thank you very much for all the support.
Hello,
The action shows the view of the invoice tree, with the correct values, but when I click on an invoice it shows nothing, it does nothing. The Create or perform any action button.
also the name of the header appears as: Accounting panel / Unnamed I must say: Accounting panel / Invoice.
What values are not correct?
Thank you,
@api.multi
def action_boleta_venta2(self):
ref = request.env.ref("account.invoice_tree")
return {
"type": "ir.actions.act_window",
"res_model": "account.invoice",
"target": "self",
"view_id": ref.id,
"view_type": "form",
'view_mode': 'tree',
"context": {
'type': 'out_invoice',
'journal_type': 'sale',
'type_code': '08',
'default_number': 'Nota de Débito'
},
"domain": [('type', 'in', ('out_invoice', 'out_refund')),('journal_id.invoice_type_code_id', '=', '08'),('state', '=', 'draft')]
}
Enjoying the discussion? Don't just read, join in!
Create an account today to enjoy exclusive features and engage with our awesome community!
Sign upRelated Posts | Replies | Views | Activity | |
---|---|---|---|---|
|
2
Nov 24
|
263 | ||
|
1
Oct 24
|
328 | ||
|
4
Oct 24
|
324 | ||
Connect Odoo with unopim
Solved
|
|
2
Oct 24
|
361 | |
|
2
Dec 24
|
666 |