Пример #1
0
 def OnClick(self, button, cancel):
     from win32com.client import Dispatch
     import win32con
     mngr = manager.GetManager()
     data = mngr.LoadConfig()
     outlook = Dispatch("Outlook.Application")
     ex = outlook.ActiveExplorer()
     if ex:
         is_login = str(data['login'])
         if is_login == 'False':
             win32ui.MessageBox("Please login to the database first",
                                "OpenERP Connection",
                                win32con.MB_ICONEXCLAMATION)
         elif ex.Selection.Count == 1:
             mngr = manager.GetManager()
             mngr.ShowManager("IDD_SYNC")
         elif ex.Selection.Count == 0:
             win32ui.MessageBox("No mail selected to push to OpenERP",
                                "Push to OpenERP",
                                win32con.MB_ICONINFORMATION)
         elif ex.Selection.Count > 1:
             win32ui.MessageBox(
                 "Multiple selection not allowed. Please select only one mail at a time.",
                 "Push to OpenERP", win32con.MB_ICONINFORMATION)
     return cancel
Пример #2
0
def Test():
    single_select = False
    import sys, os
    sys.path.append(
        os.path.abspath(os.path.join(os.path.dirname(sys.argv[0]), "..")))
    import manager
    mgr = manager.GetManager()
    if mgr.dialog_parser is None:
        import dialogs
        mgr.dialog_parser = dialogs.LoadDialogs()

    ids = [
        ("0000", "0000"),
    ]  # invalid ID for testing.
    d = FolderSelector(0, mgr, ids, single_select=single_select)
    if d.DoModal() != win32con.IDOK:
        print "Cancelled"
        return
    ids, include_sub = d.GetSelectedIDs()
    d = FolderSelector(0,
                       mgr,
                       ids,
                       single_select=single_select,
                       checkbox_state=include_sub)
    d.DoModal()
Пример #3
0
 def OnClick(self, button, cancel):
     import win32ui
     try:
         mngr = manager.GetManager()
         mngr.ShowManager()
     except Exception, e:
         win32ui.MessageBox("Fail to Initialize dialog.\n" + str(e),
                            "OpenERP Configuration", win32con.MB_ICONERROR)
Пример #4
0
import sys, os
if __name__ == '__main__':
    # Hack for testing - setup sys.path
    try:
        import spambayes.Version
    except ImportError:
        sys.path.append(
            os.path.abspath(
                os.path.join(os.path.dirname(sys.argv[0]), "..", "..")))
    try:
        import manager
    except ImportError:
        sys.path.append(
            os.path.abspath(os.path.join(os.path.dirname(sys.argv[0]), "..")))

    import manager, win32con
    mgr = manager.GetManager()
    from dialogs import ShowDialog, ShowWizard
    idd = "IDD_MANAGER"
    if len(sys.argv) > 1:
        idd = sys.argv[1]
    if idd == 'IDD_WIZARD':
        ShowWizard(0, mgr, idd)
    else:
        ShowDialog(0, mgr, mgr.config, idd)
    if "-d" in sys.argv:
        print "Dumping(but not saving) new manager configuration:"
        print mgr.options.display()
        print "-- end of configuration --"
    mgr.Close()
Пример #5
0
 def OnClick(self, button, cancel):
     mngr = manager.GetManager()
     mngr.ShowManager()
     return cancel
Пример #6
0
def GetConn():
    d = Dispatch("Python.OpenERP.XMLRpcConn")
    mngr = manager.GetManager()
    return d
Пример #7
0
 def GetAppDataPath(self):
     mngr = manager.GetManager()
     return mngr.data_directory
Пример #8
0
 def OnDisconnection(self, mode, custom):
     mngr = manager.GetManager()
     mngr.config['login'] = False
     mngr.SaveConfig()
     print "OnDisconnection"
Пример #9
0
 def OnDisconnection(self, mode, custom):
     mngr = manager.GetManager()
     mngr.config['login'] = False
     mngr.SaveConfig()
     self.item.close()
     pass