Hello all,
I'm in Odoo 8.
Thanks to help
My wizard class send data variable like this to the report. I know it works because I see it in the log.
class create_deposit_wizard(models.Model):
_name = 'create.deposit.wizard'
_description = 'Create a new deposit'
journal_id = fields.Many2one('account.journal', string='Journal du depot')
date_from = fields.Datetime("Start Date")
date_to = fields.Datetime("End Date")
def print_report(self, cr, uid, ids, data, context=None):
if context is None:
context = {}
data = {}
data['form'] = self.read(cr, uid, ids, ['journal_id', 'date_to', 'date_from'], context=context)[0]
_logger.error("print_report in create_deposit_wizard BEGIN")
_logger.error("ids :: " + str(ids))
_logger.error("data :: " + str(data))
_logger.error("context :: " + str(context))
return self.pool['report'].get_action(cr, uid, [], 'sale_lapagept.report_create_deposit_cf', data=data, context=context)
But I'm not able to recup the data variable in the report parser. What is wrong?
class create_deposit_cf(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
super(create_deposit_cf, self).__init__(cr, uid, name, context=context)
_logger.error("context :: %s", str(context))
self.localcontext.update({
'prout': 'prout',
'liness': 'lines',
})
_logger.error("data", str(data['form']))
I get this error :
File "/home/odoo-test/addons_pt/sale_lapagept/report/report_create_deposit_cf.py", line 16, in __init__ _logger.error("data", str(data['form'])) NameError: global name 'data' is not defined