I need to pass the value of my two fields i.e date_from n date_to from my wizard to the report it calls/prints. Following is my code. This is working fine but only problem is i am not able to find how to print these two fields. Any help is appreciated.
class my_wizard_report(osv.osv_memory):
_name = 'my.wizard.report'
## _inherit = 'account.invoice'
_description = 'Test Report'
_columns = {
'date_from':fields.date('Date From',store=True),
'date_to':fields.date('Date To',store=True),
'invoice_ids':fields.many2many('account.invoice', string='Filter on invoices',help="Only selected invoices will be printed"),
}
_defaults = {
'date_from': lambda *a: time.strftime('%Y-%m-%d'),
'date_to': lambda *a: time.strftime('%Y-%m-%d'),
}
def print_report(self, cr, uid, ids, context=None):
datas = {}
if context is None:
context = {}
data = self.read(cr, uid, ids,['date_from', 'date_to', 'invoice_ids'], context=context)
date_from = data[0]['date_from']
date_to = data[0]['date_to']
obj = self.pool.get('account.invoice')
ids = obj.search(cr, uid, [('date_invoice','>=',date_from),('date_invoice','<=',date_to)])
datas = {
'ids': ids,
'model': 'account.invoice',
'form': data
}
return {'type': 'ir.actions.report.xml', 'report_name': 'account.invoice.rnd5c3tV', 'datas': datas}
my_wizard_report()print.report.form my.wizard.report form Print Report my.wizard.report form tree,form new
[C:\fakepath\screen2.png](/upfiles/13829406709416915.png)
[C:\fakepath\screen1.png](/upfiles/13829406868111841.png)
[C:\fakepath\reports.png](/upfiles/138294070242569.png)
↧