Skip to Content
Menu
This question has been flagged
4654 Views

def render_html(self, data):

self.model = self.env.context.get('active_model')

docs = self.env[self.model].browse(self.env.context.get('active_id'))

init_balance = data['form'].get('initial_balance', True)

sortby = data['form'].get('sortby', 'sort_date')

display_account = data['form']['display_account']

codes = []

if data['form'].get('journal_ids', False):

codes = [journal.code for journal in self.env['account.journal'].search([('id', 'in', data['form']['journal_ids'])])]

accounts = self.env['account.account'].search([])

accounts_res = self.with_context(data['form'].get('used_context',{}))._get_account_move_entry(accounts, init_balance, sortby, display_account)

docargs = {

'doc_ids': self.ids,

'doc_model': self.model,

'data': data['form'],

'docs': docs,

'time': time,

'Accounts': accounts_res,

'print_journal': codes,

}

return self.env['report'].render('account.report_generalledger', docargs)

in this function how i get know that which is active model.

thanks


Avatar
Discard