Skip ke Konten
Menu
Pertanyaan ini telah diberikan tanda
1 Balas
3325 Tampilan

Hi everyone,

I'm trying to return a new tree view for account.move.lines from button in python. I've created a new tree view for account.move.line which i'm calling like this. 

Python code:

def open_invoice_lines(self):
return {
'type': "ir.actions.act_window",
'res_model': 'account.move.line',
'res_id': self.env['account.move.line'].search([('move_id','=',self.invoice_id.id)], limit=1).id,
# 'context': self._context,
'views': [(self.env.ref('default_payment.multi_invoice_lines_tree').id, 'tree')],
# 'view_id': self.env.ref('account.view_move_line_tree').id,
'domain': [('move_id','=',self.invoice_id.id),('exclude_from_invoice_tab','!=', True)],
'view_mode': 'tree',
'view_type': 'tree',
'target': "new",
}
 I've tried both 'views' and 'view_id' it returns standard tree view but not my custom tree. What could be the possible issue? 
Avatar
Buang
Jawaban Terbai

Hi,

Check the below code and make sure the view is present in the module.

return {
   'name': _('InvoiceMoveLine),
   'type': 'ir.actions.act_window',
   'view_mode': 'tree',
   'res_model': 'account.move.line',
   'view_id': self.env.ref('module_name.view_move_tree').id,
   'target': 'new',
'res_id':res_id,
'context':{} ,
'domain': domain
}

Regards

Avatar
Buang
Penulis

I'm doing exactly like this but it doesn't return anything or any error! Also view is present i've checked in debugger too.

Post Terkait Replies Tampilan Aktivitas
0
Agu 22
1887
2
Jun 21
4387
3
Nov 19
5097
1
Jun 22
2585
1
Des 20
1792