Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to create print template of the survey in OpenERP

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 309
    Comment on it

    In openerp to create print template of the survey means that first check response or survey and if response is available then print this response otherwise print survey form and the current row, from the database cursor and also the current user’s ID for security checks.

    In response standard dictionary is used for contextual values and in survey dictionary value is used to print survey form. use this function given below

     

    def action_print_survey(self, cr, uid, ids, context=None):
           
            if context is None:
                context = {}
            datas = {}
            if 'response_id' in context:
                response_id = context.get('response_id', 0)
                datas['ids'] = [context.get('survey_id', 0)]
            else:
                response_id = self.pool.get('survey.response').search(cr, uid, [('survey_id','=', ids)], context=context)
                datas['ids'] = ids
            page_setting = {'orientation': 'vertical', 'without_pagebreak': 0, 'paper_size': 'letter', 'page_number': 1, 'survey_title': 1}
            report = {}
            if response_id and response_id[0]:
                context.update({'survey_id': datas['ids']})
                datas['form'] = page_setting
                datas['model'] = 'survey.print.answer'
                report = {
                    'type': 'ir.actions.report.xml',
                    'report_name': 'survey.browse.response',
                    'datas': datas,
                    'context' : context,
                    'nodestroy':True,
                }
            else:
    
                datas['form'] = page_setting
                datas['model'] = 'survey.print'
                report = {
                    'type': 'ir.actions.report.xml',
                    'report_name': 'survey.form',
                    'datas': datas,
                    'context' : context,
                    'nodestroy':True,
                }
            return report

     

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: