Esempio n. 1
0
            special_dict = {"REPORT_LOCALE": language or "en_US", "IS_JASPERSERVER": "yes"}

            # we must retrieve label in the language document (not user's language)
            for l in doc_obj.browse(self.cr, self.uid, current_document.id, context={"lang": language}).label_ids:
                special_dict["I18N_" + l.name.upper()] = l.value

            # If report is launched since a wizard, we can retrieve some parameters
            for d in self.custom.keys():
                special_dict["CUSTOM_" + d.upper()] = self.custom[d]

            # If special value is available in context, we add them as parameters
            if context.get("jasper") and isinstance(context["jasper"], dict):
                for d in context["jasper"].keys():
                    special_dict["CONTEXT_" + d.upper()] = context["jasper"][d]

            par = parameter(self.attrs, d_par, special_dict)
            body_args = {
                "format": self.attrs["params"][0],
                "path": self.path or self.attrs["params"][1],
                "param": par,
                "database": "/openerp/databases/%s" % self.cr.dbname,
            }

            ###
            ## Execute the before query if it available
            ##
            if js_conf.get("before"):
                self.cr.execute(js_conf["before"], {"id": ex})

            body = BODY_TEMPLATE % body_args
            log_debug("****\n%s\n****" % body)
Esempio n. 2
0
            }

            # we must retrieve label in the language document (not user's language)
            for l in self.doc_obj.browse(self.cr, self.uid, current_document.id, context={'lang': language}).label_ids:
                special_dict['I18N_' + l.name.upper()] = (l.value_type == 'char' and l.value) or l.value_text or ''

            # If report is launched since a wizard, we can retrieve some parameters
            for d in self.custom.keys():
                special_dict['CUSTOM_' + d.upper()] = self.custom[d]

            # If special value is available in context, we add them as parameters
            if context.get('jasper') and isinstance(context['jasper'], dict):
                for d in context['jasper'].keys():
                    special_dict['CONTEXT_' + d.upper()] = context['jasper'][d]

            par = parameter(self.attrs, d_par, special_dict)
            body_args = {
                'format': self.attrs['params'][0],
                'path': self.path or self.attrs['params'][1],
                'param': par,
                'database': '/openerp/databases/%s' % self.cr.dbname,
            }

            ###
            ## Execute the before query if it available
            ##
            if js_conf.get('before'):
                self.cr.execute(js_conf['before'], {'id': ex})

            body = BODY_TEMPLATE % body_args
            log_debug('****\n%s\n****' % body)
Esempio n. 3
0
            d_par['company_zip'] = addr.zip or ''
            d_par['company_city'] = addr.city or ''
            d_par['company_country'] = addr.country_id.name or ''
            d_par['company_phone'] = addr.phone or ''
            d_par['company_fax'] = addr.fax or ''
            d_par['company_mail'] = addr.email or ''

            for p in current_document.param_ids:
                if p.code and  p.code.startswith('[['):
                        d_par[p.name.lower()] = eval(p.code.replace('[[', '').replace(']]', ''), {'o': cur_obj, 'c': cny, 't': time}) or ''
                else:
                        d_par[p.name] = p.code

            self.outputFormat = current_document.format.lower()

            par = parameter(self.attrs, d_par)
            body_args = {
                'format': self.attrs['params'][0],
                'path': self.path or self.attrs['params'][1],
                'param': par,
                'database': '/openerp/databases/%s' % self.cr.dbname,
            }

            ###
            ## Execute the before query if it available
            ##
            if js_conf.get('before'):
                self.cr.execute(js_conf['before'], {'id': ex})

            body = BODY_TEMPLATE % body_args
            log_debug('****\n%s\n****' % body)