Skip to Content
Menu
This question has been flagged
1 Reply
2415 Views
Good morning,
I have an action that should take me to the tree view (account.invoice_tree) and then when clicking on an invoice, go to the form view (account.invoice_form)

I'm trying this code, but when I click the button, it doesn't do anything to me. At the top there is a message that indicates loading, but it stays on the same screen without redirecting me.
That may be wrong.
Thank you.
@api.multi
    def action_boleta_venta4(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'
                }
        }
Avatar
Discard
Best Answer

Hi,

Try this code,


@api.multi
def action_boleta_venta4(self):
tree_view_id = self.env.ref('account.invoice_tree').id
form_view_id = self.env.ref('account.invoice_form').id
return {
'type': 'ir.actions.act_window',
'views': [(tree_view_id, 'tree'), (form_view_id, 'form')],
'view_mode': 'tree,form',
'name': _('Invoices'),
'res_model': 'account.invoice',
'context': {
'type': 'out_invoice',
'journal_type': 'sale',
'type_code': '08',
'default_number': 'Nota de Débito'
}
}

Thanks

Avatar
Discard
Author

Tranks.

Related Posts Replies Views Activity
2
Nov 24
272
1
Oct 24
335
4
Oct 24
326
2
Oct 24
362
2
Dec 24
678