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

print pos receipt

By
ramy mabrouk
on 7/22/15, 12:08 PM 714 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

0
ramy mabrouk
On 7/26/15, 6:45 PM

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 ?

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: 7/22/15, 12:08 PM
Seen: 714 times
Last updated: 7/26/15, 7:54 PM