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

Good afternoon, I have an action that shows me the tree view of the invoices, shows me the values ​​correctly, but when I click on an invoice it shows nothing, it does nothing. The create button also does not perform any action.

also the name of the header appears as: Accounting Dashboard / Unnamed I should say: Accounting Dashboard / Invoice Please your support.

class AccountJournal(models.Model): 

 _inherit = "account.journal"

@api.multi
def action_boleta_venta2(self):
ref = request.env.ref("account.invoice_tree")
#print( str(self.number[0:4]) + " - " + str(int(self.number[5:len(self.number)])))
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',
'name':_('Invoice')
},
"domain": [('type', 'in', ('out_invoice', 'out_refund')),('state', '=', 'draft')]
}

if i change to view_mode = "tree, form" gives me the error: 

Got view modes ['tree', 'form'] and view id 458 for action {'context': {'type_code': '08', 'journal_type': 'sale', 'type': 'out_invoice', 'name ':' Invoice ',' default_number ':' Debit Note '},' target ':' self ',' type ':' ir.actions.act_window ',' domain ': [(' type ',' in ' , ('out_invoice', 'out_refund')), ('state', '=', 'draft')], 'flags': {},' view_mode ':' tree, form ',' res_model ':' account .invoice ',' view_type ':' form ',' view_id ': 458}

Avatar
Discard

Hope this will helps you to customize odoo modules: https://www.scoop.it/t/learn-openerp

Best Answer

Hi,

Try this,


@api.multi
def action_boleta_venta2(self):
tree_view_id = self.env.ref("account.invoice_tree")
form_view_id = self.env.ref("account.invoice_form")
views = [
(tree_view_id, 'tree'),
(form_view_id, 'form'),
]
return {
'name': _('Invoice'),
"res_model": "account.invoice",
'views': views,
'view_id': False,
'view_type': 'form',
"view_mode": 'tree,form',
"context": {
'type': 'out_invoice',
'journal_type': 'sale',
'type_code': '08',
'default_number': 'Nota de Débito',

}

Thanks

Avatar
Discard
Author

Hello,

I will not see an error, when I click on the button, it appears loading but does not redirect me anywhere.

Thanks for the help.

Related Posts Replies Views Activity
2
Nov 24
262
1
Oct 24
328
4
Oct 24
323
2
Oct 24
360
2
Dec 24
661