Odoo Help

0

how to know which model is active in report

By
madan
on 6/20/16, 2:24 AM 535 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


About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)

Stats

Asked: 6/20/16, 2:24 AM
Seen: 535 times
Last updated: 6/20/16, 5:27 AM