def get_openerp(): """openerp_instance""" global openerp_instance if not openerp_instance: config = kooltuo_config() openerp_instance = openerp(dbname=config.dbname, uri=config.uri, user=config.user, pwd=config.password) return openerp_instance
def OnClick(self, button, cancel): import win32ui # Possible, but not necessary, to use a Pythonwin GUI print "[ButtonEvent][OnClick] start" config = kooltuo_config() try: if config.validate_conection(): sync = syncronize() sync.sync_all() except ErrorValidatingConection, (instance): win32ui.MessageBox(instance.parameter)
def set_new_syncronization_time(self, item_type): """create a new record with the sync last date""" sync_rec = self.ooop.KooltuoSyncReport.new() sync_rec.outlook_application_id = self.oapp_id dt = datetime.now() + timedelta(seconds=2) #hack 4 outlook sync_rec.last_sync_date = str(dt) sync_rec.name = item_type_str(item_type) sync_rec.state = "done" sync_rec.save() #guardar en el cfg config = kooltuo_config() config.last_sync = dt # config.last_sync = sync_rec.last_sync_date config.save() return True
def set_new_syncronization_time(self, item_type): """create a new record with the sync last date""" sync_rec = self.ooop.KooltuoSyncReport.new() sync_rec.outlook_application_id = self.oapp_id dt = datetime.now()+ timedelta(seconds=2) #hack 4 outlook sync_rec.last_sync_date = str(dt) sync_rec.name = item_type_str(item_type) sync_rec.state = "done" sync_rec.save() #guardar en el cfg config = kooltuo_config() config.last_sync = dt # config.last_sync = sync_rec.last_sync_date config.save() return True
def __init__(self): print "[syncronize][__init__] start" self.openerp = conect.get_openerp() self.out_contacts = outlook_contacts() self.config = kooltuo_config() print "[syncronize][__init__] end"