Skip to Content
Menu
This question has been flagged
1 Reply
4019 Views

hi,

i am using this function to print a pos receipt in my costume module but it shows nothing, no errors or pdf files  



    @api.one
def print_report(self):
cr, uid, context = self.env.args
pos_ids = self.pool.get('pos.order').search(cr, uid,[('id', '=', self.pos_order.id)], context=context)
datas = {
'ids': pos_ids,
'model':'pos.order',
'from': self.pos_order.read()[0],
}
print pos_ids
print datas
# print data['form']
        ret_val = self.env['report'].get_action(self.pos_order, 'point_of_sale.report_receipt', data=datas)
        return ret_val

Avatar
Discard
Author Best Answer

afer a lot of searches i found that changing the function to the below is calling the report but it does not call the report parser class which raises function not found error


 @api.one
def print_report(self):
report_obj = self.env['report']
report = report_obj._get_report_from_name('point_of_sale.report_receipt')
docargs = {
'doc_ids': self.pos_order.id,
'doc_model': report.model,
'docs': self.pos_order,
}
return report_obj.render('point_of_sale.report_receipt', docargs)


now the question is how to include the report parser class in this call ?

Avatar
Discard
Related Posts Replies Views Activity
3
May 24
5357
0
Jun 24
417
0
Dec 23
345
1
Oct 23
942
2
Jan 23
1572