Beispiel #1
0
    def upload_report(self,
                      cr,
                      uid,
                      report_id,
                      file_sxw,
                      file_type,
                      context=None):
        '''
        Untested function
        '''
        pool = pooler.get_pool(cr.dbname)
        sxwval = StringIO(base64.decodestring(file_sxw))
        if file_type == 'sxw':
            fp = open(
                addons.get_module_resource('base_report_designer',
                                           'openerp_sxw2rml',
                                           'normalized_oo2rml.xsl'), 'rb')
        if file_type == 'odt':
            fp = open(
                addons.get_module_resource('base_report_designer',
                                           'openerp_sxw2rml',
                                           'normalized_odt2rml.xsl'), 'rb')
        report = pool.get('ir.actions.report.xml').write(
            cr, uid, [report_id], {
                'report_sxw_content': base64.decodestring(file_sxw),
                'report_rml_content': str(sxw2rml(sxwval, xsl=fp.read())),
            })

        # FIXME: this should be moved to an override of the ir.actions.report_xml.create() method
        cr.commit()
        pool.get('ir.actions.report.xml').register_all(cr)
        openerp.modules.registry.RegistryManager.signal_registry_change(
            cr.dbname)

        return True
Beispiel #2
0
 def upload_report(self,
                   cr,
                   uid,
                   report_id,
                   file_sxw,
                   file_type,
                   context=None):
     '''
     Untested function
     '''
     pool = pooler.get_pool(cr.dbname)
     sxwval = StringIO(base64.decodestring(file_sxw))
     if file_type == 'sxw':
         fp = open(
             addons.get_module_resource('base_report_designer',
                                        'openerp_sxw2rml',
                                        'normalized_oo2rml.xsl'), 'rb')
     if file_type == 'odt':
         fp = open(
             addons.get_module_resource('base_report_designer',
                                        'openerp_sxw2rml',
                                        'normalized_odt2rml.xsl'), 'rb')
     report = pool.get('ir.actions.report.xml').write(
         cr, uid, [report_id], {
             'report_sxw_content': base64.decodestring(file_sxw),
             'report_rml_content': str(sxw2rml(sxwval, xsl=fp.read())),
         })
     pool.get('ir.actions.report.xml').register_all(cr)
     return True
 def upload_report(self, cr, uid, report_id, file_sxw, file_type, context=None):
     """
     Untested function
     """
     pool = pooler.get_pool(cr.dbname)
     sxwval = StringIO(base64.decodestring(file_sxw))
     if file_type == "sxw":
         fp = open(
             addons.get_module_resource("base_report_designer", "openerp_sxw2rml", "normalized_oo2rml.xsl"), "rb"
         )
     if file_type == "odt":
         fp = open(
             addons.get_module_resource("base_report_designer", "openerp_sxw2rml", "normalized_odt2rml.xsl"), "rb"
         )
     report = pool.get("ir.actions.report.xml").write(
         cr,
         uid,
         [report_id],
         {
             "report_sxw_content": base64.decodestring(file_sxw),
             "report_rml_content": str(sxw2rml(sxwval, xsl=fp.read())),
         },
     )
     pool.get("ir.actions.report.xml").register_all(cr)
     return True
Beispiel #4
0
 def sxwtorml(self, cr, uid, file_sxw, file_type):
     '''
     The use of this function is to get rml file from sxw file.
     '''
     sxwval = StringIO(base64.decodestring(file_sxw))
     if file_type=='sxw':
         fp = open(addons.get_module_resource('base_report_designer','openerp_sxw2rml', 'normalized_oo2rml.xsl'),'rb')
     if file_type=='odt':
         fp = open(addons.get_module_resource('base_report_designer','openerp_sxw2rml', 'normalized_odt2rml.xsl'),'rb')
     return  {'report_rml_content': str(sxw2rml(sxwval, xsl=fp.read()))}
 def sxwtorml(self, cr, uid, file_sxw, file_type):
     '''
     The use of this function is to get rml file from sxw file.
     '''
     sxwval = StringIO(base64.decodestring(file_sxw))
     if file_type=='sxw':
         fp = open(get_module_resource('base_report_designer','openerp_sxw2rml', 'normalized_oo2rml.xsl'),'rb')
     if file_type=='odt':
         fp = open(get_module_resource('base_report_designer','openerp_sxw2rml', 'normalized_odt2rml.xsl'),'rb')
     return  {'report_rml_content': str(sxw2rml(sxwval, xsl=fp.read()))}
 def sxwtorml(self, cr, uid, file_sxw, file_type):
     """
     The use of this function is to get rml file from sxw file.
     """
     sxwval = StringIO(base64.decodestring(file_sxw))
     if file_type == "sxw":
         fp = open(
             addons.get_module_resource("base_report_designer", "openerp_sxw2rml", "normalized_oo2rml.xsl"), "rb"
         )
     if file_type == "odt":
         fp = open(
             addons.get_module_resource("base_report_designer", "openerp_sxw2rml", "normalized_odt2rml.xsl"), "rb"
         )
     return {"report_rml_content": str(sxw2rml(sxwval, xsl=fp.read()))}
    def upload_report(self, cr, uid, report_id, file_sxw, file_type, context=None):
        '''
        Untested function
        '''
        sxwval = StringIO(base64.decodestring(file_sxw))
        if file_type=='sxw':
            fp = open(get_module_resource('base_report_designer','openerp_sxw2rml', 'normalized_oo2rml.xsl'),'rb')
        if file_type=='odt':
            fp = open(get_module_resource('base_report_designer','openerp_sxw2rml', 'normalized_odt2rml.xsl'),'rb')
        report = self.pool['ir.actions.report.xml'].write(cr, uid, [report_id], {
            'report_sxw_content': base64.decodestring(file_sxw), 
            'report_rml_content': str(sxw2rml(sxwval, xsl=fp.read())), 
        })

        return True
Beispiel #8
0
    def upload_report(self, cr, uid, report_id, file_sxw, file_type, context=None):
        '''
        Untested function
        '''
        pool = pooler.get_pool(cr.dbname)
        sxwval = StringIO(base64.decodestring(file_sxw))
        if file_type=='sxw':
            fp = open(addons.get_module_resource('base_report_designer','openerp_sxw2rml', 'normalized_oo2rml.xsl'),'rb')
        if file_type=='odt':
            fp = open(addons.get_module_resource('base_report_designer','openerp_sxw2rml', 'normalized_odt2rml.xsl'),'rb')
        report = pool.get('ir.actions.report.xml').write(cr, uid, [report_id], {
            'report_sxw_content': base64.decodestring(file_sxw), 
            'report_rml_content': str(sxw2rml(sxwval, xsl=fp.read())), 
        })

        # FIXME: this should be moved to an override of the ir.actions.report_xml.create() method
        cr.commit()
        pool.get('ir.actions.report.xml').register_all(cr)
        openerp.modules.registry.RegistryManager.signal_registry_change(cr.dbname)

        return True