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.

1

Printing report from the form view...

By
Krishna
on 10/16/13, 7:10 AM 2,380 views

I want to print report from my form view...for that i have to fetch data from wizard...Can anyone tell me how to browse record of wizard in my main python file???

Why would you need wizard data for this? Please elaborate.

Brett Lehrer
on 10/21/13, 10:57 PM

I have to give the print report button on the main form...so i need to define the method on my main python file..and for that i need to fetch data from wizard like price and quantity of product..so i am unable to get price data from wizard to my main python file..

Krishna
on 10/22/13, 2:43 AM

What specific report are you trying to print? That might help me understand what you're trying to do. Once you're done using a wizard, you should never need to access the wizard data again, the relevant info that came out of it should already be written to normal ERP objects.

Brett Lehrer
on 10/22/13, 4:27 AM

I am trying to print a pdf report using sxw to rml conversion..the report is printing but i am unable to see the data of wizard in the report...I am browsing record of wizard as normal erp object in my main .py file but the data is not showing..even I am printing that wizard data in my main file..but its giving error that browse record list has no attribute price.

Krishna
on 10/22/13, 7:23 AM
0
Jasad
On 10/22/13, 8:11 AM

Hi,

You can read the data from wizard as follows:

data = self.read(cr, uid, ids)[0]

and then you can return those data when you return for printing the report.

Ex:

def check_report(self, cr, uid, ids, context=None):

    if context is None:
        context = {}
    data = self.read(cr, uid, ids)[0]
    datas = {
         'ids': context.get('active_ids',[]),
         'model': 'account.analytic.journal',
         'form': data
             }
    return {
        'type': 'ir.actions.report.xml',
        'report_name': 'account.analytic.journal',
        'datas': datas,
        }

Then you can access this data from your report as follows:

[[ data['form']['filter'] ]]

hi..I am using browse function in my main python file..then it giving error like above.

Krishna
on 10/22/13, 8:55 AM

Please try with read function..In many cases, openerp used the read function to get the data from wizard for printing report.

Jasad
on 10/22/13, 10:34 AM

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

0 follower(s)

Stats

Asked: 10/16/13, 7:10 AM
Seen: 2380 times
Last updated: 3/16/15, 8:10 AM