Hello,
I have one wizard which have start date and end date.
Now, I want report between this two dates for another model.
I can search the record between the dates in model but in the report, wizard's id is pass.
How can i pass this search id which is from another model.
class TreeIssueDateWiseReport(models.TransientModel):
_name = 'tree.issue.date.wise.report'
_description = "Tree Issue Date Wise Report"
start_date = fields.Date('Start Date', required=True)
end_date = fields.Date('End Date', required=True)
@api.multi
def calculate_report(self):
self.ensure_one()
data = {}
data['ids'] = self.env.context.get('active_ids', [])
data['model'] = self.env.context.get('active_model', 'ir.ui.menu')
data['form'] = self.read(['start_date', 'end_date'])[0]
tree_search_obj = self.env['tree.temp'].search([('date', '>=', self.start_date), ('date', '<=', self.end_date)]).ids
# data['form'] = tree_search_obj
# docargs = {
# 'tree': tree_search_obj,
# 'wizard': self.id,
# }
datas = {
'ids': tree_search_obj,
'model': 'tree.temp',
'form': tree_search_obj,
}
return {
'type': 'ir.actions.report.xml',
'report_name': 'work_order.report_tree_issue_date',
'datas': datas}
# self.render_html()
# return self.env['report'].get_action(self, 'work_order.report_tree_issue_date', data=docargs)]
@api.multi
def render_html(self, data=None):
print "data ::::::::::::::: ", data
print "self =============== ", self
report_obj = self.env['report']
report = report_obj._get_report_from_name('work_order.report_tree_issue_date')
tree_search_obj = self.env['tree.temp'].search([('date', '>=', self.start_date), ('date', '<=', self.end_date)]).ids
docargs = {
'doc_ids': tree_search_obj,
'doc_model': 'tree.temp',
'docs': tree_search_obj,
}
return report_obj.render('work_order.report_tree_issue_date', docargs)
Thanks in advance,
any update ??