Odoo Help

Welcome!

This community 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.

0

how to know which model is active in report

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


Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

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