Beispiel #1
0
    def check(self, cr, uid, ids, context=None):
        config_obj = self.pool.get('oo.config')
        data = self.read(cr, uid, ids, ['host', 'port', 'ooo_restart_cmd'])[0]
        del data['id']
        config_id = config_obj.search(cr, 1, [], context=context)
        if config_id:
            config_obj.write(cr, 1, config_id, data, context=context)
        else:
            config_id = config_obj.create(cr, 1, data, context=context)

        try:
            fp = tools.file_open('report_aeroo_ooo/test_temp.odt', mode='rb')
            file_data = fp.read()
            DC = netsvc.Service._services.setdefault(
                'openoffice', OpenOffice_service(cr, data['host'],
                                                 data['port']))
            with aeroo_lock:
                DC.putDocument(file_data)
                DC.saveByStream()
                fp.close()
                DC.closeDocument()
                del DC
        except DocumentConversionException, e:
            netsvc.Service.remove('openoffice')
            error_details = str(e)
            state = 'error'
Beispiel #2
0
 def _check(self, cr, uid, data, context):
     try:
         fp = tools.file_open('report_aeroo_ooo/test_temp.odt', mode='rb')
         file_data = fp.read()
         DC = netsvc.SERVICES.setdefault('openoffice', \
                 OpenOffice_service(cr, data['form']['host'], data['form']['port']))
         DC.putDocument(file_data)
         DC.saveByStream()
         fp.close()
         DC.closeDocument()
         del DC
         return 'done'
     except DocumentConversionException, e:
         if 'openoffice' in netsvc.SERVICES:
             del netsvc.SERVICES['openoffice']
         context['error_text'] = e.message
         return 'error'
Beispiel #3
0
            from report_aeroo_ooo.report import OpenOffice_service
        except Exception, e:
            OpenOffice_service = False

        if OpenOffice_service:
            cr.execute(
                "SELECT id, state FROM ir_module_module WHERE name='report_aeroo_ooo'"
            )
            helper_module = cr.dictfetchone()
            helper_installed = helper_module['state'] == 'installed'

        if OpenOffice_service and helper_installed:
            cr.execute("SELECT host, port FROM oo_config")
            host, port = cr.fetchone()
            try:
                OpenOffice_service(cr, host, port)
                _logger.info(
                    "OpenOffice.org connection successfully established")
            except Exception, e:
                cr.rollback()
                _logger.error(str(e))
        ##############################################

        cr.execute(
            "SELECT * FROM ir_act_report_xml WHERE report_type = 'aeroo' and active = true ORDER BY id"
        )  # change for OpenERP 6.0
        records = cr.dictfetchall()
        for record in records:
            parser = rml_parse
            if record['parser_state'] == 'loc' and record['parser_loc']:
                parser = self.load_from_file(record['parser_loc'], cr.dbname,