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
- Kế toán
- Tồn kho
- PoS
- Project
- MRP
Câu hỏi này đã bị gắn cờ
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')]
}
Bạn có hứng thú với cuộc thảo luận không? Đừng chỉ đọc, hãy tham gia nhé!
Tạo tài khoản ngay hôm nay để tận hưởng các tính năng độc đáo và tham gia cộng đồng tuyệt vời của chúng tôi!
Đăng kýBài viết liên quan | Trả lời | Lượt xem | Hoạt động | |
---|---|---|---|---|
|
2
thg 8 25
|
2701 | ||
|
1
thg 7 25
|
1082 | ||
|
1
thg 8 25
|
1151 | ||
|
0
thg 5 25
|
1507 | ||
|
2
thg 4 25
|
3673 |