Good Night, I am calling a method within another method of the same class. with the option self.env['account.journal'].Method()
I do not get an error, but the view is not shown (it only comes out loading a few seconds and stays on the same page) what could it be?
The action is called from an inherited view(account.account_journal_dashboard_kanban_view). if from the inherited view, change for the specific action. for example: "tipo12()" loads the view without problems. so I conclude that the problem can be the general method (action_crear_documento) Please your support.
class AccountJournal(models.Model):
_inherit = "account.journal"
@api.multi
def tipo11(self):
ref = request.env.ref("account.invoice_form")
return {
"type": "ir.actions.act_window",
"res_model": "account.invoice",
"target": "self",
"view_id": ref.id,
"view_mode": "form",
"context": {
'type': 'out_invoice',
'journal_type': 'sale',
'type_code': '11',
"domain": [('type', 'in', ('out_invoice', 'out_refund')), ('journal_id.invoice_type_code_id', '=', '11')]
}
@api.multi
def tipo12(self):
ref = request.env.ref("account.invoice_form")
return {
"type": "ir.actions.act_window",
"res_model": "account.invoice",
"target": "self",
"view_id": ref.id,
"view_mode": "form",
"context": {
'type': 'out_invoice',
'journal_type': 'sale',
'type_code': '12',
"domain": [('type', 'in', ('out_invoice', 'out_refund')), ('journal_id.invoice_type_code_id', '=', '12')]
}
@api.multi
def action_crear_documento(self):
if self.type=="sale":
if self.invoice_type_code_id=="11":
self.env['account.journal'].tipo11()
elif self.invoice_type_code_id=="12":
self.env['account.journal'].tipo12()