[IMP] thunderbird, outlook plugin

bzr revid: hmo@tinyerp.com-20100921150746-i4ccvy382ugl0pnb
This commit is contained in:
Harry (OpenERP) 2010-09-21 20:37:46 +05:30
parent 58558d98d4
commit e38d7bcf52
21 changed files with 2139 additions and 1867 deletions

View File

@ -1,5 +1,27 @@
#!/usr/bin/python
#-*- encoding: utf-8 -*-
# This module is part of the spambayes project, which is Copyright 2003
# The Python Software Foundation and is covered by the Python Software
# Foundation license.
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from win32com import universal
from win32com.server.exception import COMException
@ -40,8 +62,12 @@ def GetConn():
class ButtonEvent:
def OnClick(self, button, cancel):
mngr = manager.GetManager()
mngr.ShowManager()
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)
return cancel
#
class ViewPartners:
@ -55,12 +81,12 @@ class ViewPartners:
if ex:
is_login = str(data['login'])
if is_login == 'False':
win32ui.MessageBox("Please login to the database first", "Database Connection", win32con.MB_ICONEXCLAMATION)
win32ui.MessageBox("Please login to the database first", "OpenERP Connection", win32con.MB_ICONEXCLAMATION)
elif ex.Selection.Count == 1 or ex.Selection.Count == 0:
mngr = manager.GetManager()
mngr.ShowManager("IDD_VIEW_PARTNER_DIALOG")
elif ex.Selection.Count > 1:
win32ui.MessageBox("Multiple selection not allowed. Please select only one mail at a time.","",win32con.MB_ICONINFORMATION)
win32ui.MessageBox("Multiple selection not allowed. Please select only one mail at a time.","Open Contact",win32con.MB_ICONINFORMATION)
return cancel
#
class ArchiveEvent:
@ -74,14 +100,14 @@ class ArchiveEvent:
if ex:
is_login = str(data['login'])
if is_login == 'False':
win32ui.MessageBox("Please login to the database first", "Database Connection", win32con.MB_ICONEXCLAMATION)
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 archive to OpenERP","",win32con.MB_ICONINFORMATION)
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.","",win32con.MB_ICONINFORMATION)
win32ui.MessageBox("Multiple selection not allowed. Please select only one mail at a time.","Push to OpenERP",win32con.MB_ICONINFORMATION)
return cancel
#
class OutlookAddin:
@ -111,8 +137,8 @@ class OutlookAddin:
item = tools_menu.Controls.Add(Type=constants.msoControlButton, Temporary=True)
# Hook events for the item
item = self.menu_bar_arch_Button = DispatchWithEvents(item, ArchiveEvent)
item.Caption="Archive to OpenERP"
item.TooltipText = "Click to archive to OpenERP"
item.Caption="Push to OpenERP"
item.TooltipText = "Click to push to OpenERP"
item.Enabled = True
toolbar = bars.Item("Standard")
@ -120,8 +146,8 @@ class OutlookAddin:
item = toolbar.Controls.Add(Type=constants.msoControlButton, Temporary=True)
# Hook events for the item
item = self.toolbarButton = DispatchWithEvents(item, ArchiveEvent)
item.Caption="Archive to OpenERP"
item.TooltipText = "Click to archive to OpenERP"
item.Caption="Push to OpenERP"
item.TooltipText = "Click to push to OpenERP"
item.Enabled = True
# Adding Menu in Menu Bar to the Web Menu of the Outlook
@ -196,9 +222,11 @@ if __name__ == '__main__':
if "--unregister" in sys.argv:
UnregisterAddin(OutlookAddin)
UnregisterXMLConn(NewConn)
print "\n \tPlug In Un-registered Successfully.\n\tThank You for Using PlugIn."
else:
RegisterAddin(OutlookAddin)
RegisterXMLConn(NewConn)
print "\n \tPlug In Registered Successfully.\n\tEnjoy Archiving with OpenERP.\n\tSee UserGuide for More. "
#mngr = manager.GetManager()
#mngr.ShowManager("IDD_MANAGER")

View File

@ -218,6 +218,7 @@ class CkHtmlToXml(_object):
__del__ = lambda self : None;
def get_Utf8(self): return _chilkat.CkHtmlToXml_get_Utf8(self)
def put_Utf8(self, *args): return _chilkat.CkHtmlToXml_put_Utf8(self, *args)
def SetHtmlBytes(self, *args): return _chilkat.CkHtmlToXml_SetHtmlBytes(self, *args)
def UnlockComponent(self, *args): return _chilkat.CkHtmlToXml_UnlockComponent(self, *args)
def IsUnlocked(self): return _chilkat.CkHtmlToXml_IsUnlocked(self)
def SaveLastError(self, *args): return _chilkat.CkHtmlToXml_SaveLastError(self, *args)
@ -630,6 +631,10 @@ class CkSocket(_object):
def put_HttpProxyHostname(self, *args): return _chilkat.CkSocket_put_HttpProxyHostname(self, *args)
def get_HttpProxyPort(self): return _chilkat.CkSocket_get_HttpProxyPort(self)
def put_HttpProxyPort(self, *args): return _chilkat.CkSocket_put_HttpProxyPort(self, *args)
def get_NumSslAcceptableClientCAs(self): return _chilkat.CkSocket_get_NumSslAcceptableClientCAs(self)
def GetSslAcceptableClientCaDn(self, *args): return _chilkat.CkSocket_GetSslAcceptableClientCaDn(self, *args)
def getSslAcceptableClientCaDn(self, *args): return _chilkat.CkSocket_getSslAcceptableClientCaDn(self, *args)
def AddSslAcceptableClientCaDn(self, *args): return _chilkat.CkSocket_AddSslAcceptableClientCaDn(self, *args)
def UnlockComponent(self, *args): return _chilkat.CkSocket_UnlockComponent(self, *args)
def IsUnlocked(self): return _chilkat.CkSocket_IsUnlocked(self)
def AsyncSendBytes(self, *args): return _chilkat.CkSocket_AsyncSendBytes(self, *args)
@ -1241,6 +1246,8 @@ class CkRsa(_object):
def signHashENC(self, *args): return _chilkat.CkRsa_signHashENC(self, *args)
def get_VerboseLogging(self): return _chilkat.CkRsa_get_VerboseLogging(self)
def put_VerboseLogging(self, *args): return _chilkat.CkRsa_put_VerboseLogging(self, *args)
def get_NoUnpad(self): return _chilkat.CkRsa_get_NoUnpad(self)
def put_NoUnpad(self, *args): return _chilkat.CkRsa_put_NoUnpad(self, *args)
def UnlockComponent(self, *args): return _chilkat.CkRsa_UnlockComponent(self, *args)
def SaveLastError(self, *args): return _chilkat.CkRsa_SaveLastError(self, *args)
def LastErrorXml(self, *args): return _chilkat.CkRsa_LastErrorXml(self, *args)
@ -1338,7 +1345,6 @@ class CkEmail(_object):
def ComputeGlobalKey(self, *args): return _chilkat.CkEmail_ComputeGlobalKey(self, *args)
def computeGlobalKey(self, *args): return _chilkat.CkEmail_computeGlobalKey(self, *args)
def get_NumDaysOld(self): return _chilkat.CkEmail_get_NumDaysOld(self)
def UnwrapSecurity(self): return _chilkat.CkEmail_UnwrapSecurity(self)
def get_PreferredCharset(self, *args): return _chilkat.CkEmail_get_PreferredCharset(self, *args)
def preferredCharset(self): return _chilkat.CkEmail_preferredCharset(self)
def put_PreferredCharset(self, *args): return _chilkat.CkEmail_put_PreferredCharset(self, *args)
@ -1349,6 +1355,22 @@ class CkEmail(_object):
def AddEncryptCert(self, *args): return _chilkat.CkEmail_AddEncryptCert(self, *args)
def UnpackHtml(self, *args): return _chilkat.CkEmail_UnpackHtml(self, *args)
def SetFromMimeBytes(self, *args): return _chilkat.CkEmail_SetFromMimeBytes(self, *args)
def SetAttachmentDisposition(self, *args): return _chilkat.CkEmail_SetAttachmentDisposition(self, *args)
def RemoveHtmlAlternative(self): return _chilkat.CkEmail_RemoveHtmlAlternative(self)
def RemovePlainTextAlternative(self): return _chilkat.CkEmail_RemovePlainTextAlternative(self)
def AddHeaderField2(self, *args): return _chilkat.CkEmail_AddHeaderField2(self, *args)
def get_PrependHeaders(self): return _chilkat.CkEmail_get_PrependHeaders(self)
def put_PrependHeaders(self, *args): return _chilkat.CkEmail_put_PrependHeaders(self, *args)
def CreateDsn(self, *args): return _chilkat.CkEmail_CreateDsn(self, *args)
def CreateMdn(self, *args): return _chilkat.CkEmail_CreateMdn(self, *args)
def get_SigningHashAlg(self, *args): return _chilkat.CkEmail_get_SigningHashAlg(self, *args)
def signingHashAlg(self): return _chilkat.CkEmail_signingHashAlg(self)
def put_SigningHashAlg(self, *args): return _chilkat.CkEmail_put_SigningHashAlg(self, *args)
def get_Pkcs7CryptAlg(self, *args): return _chilkat.CkEmail_get_Pkcs7CryptAlg(self, *args)
def pkcs7CryptAlg(self): return _chilkat.CkEmail_pkcs7CryptAlg(self)
def put_Pkcs7CryptAlg(self, *args): return _chilkat.CkEmail_put_Pkcs7CryptAlg(self, *args)
def get_Pkcs7KeyLength(self): return _chilkat.CkEmail_get_Pkcs7KeyLength(self)
def put_Pkcs7KeyLength(self, *args): return _chilkat.CkEmail_put_Pkcs7KeyLength(self, *args)
def SetTextBody(self, *args): return _chilkat.CkEmail_SetTextBody(self, *args)
def getRelatedStringCrLf(self, *args): return _chilkat.CkEmail_getRelatedStringCrLf(self, *args)
def getRelatedContentID(self, *args): return _chilkat.CkEmail_getRelatedContentID(self, *args)
@ -1664,7 +1686,20 @@ class CkCert(_object):
__del__ = lambda self : None;
def CheckRevoked(self): return _chilkat.CkCert_CheckRevoked(self)
def get_Sha1Thumbprint(self, *args): return _chilkat.CkCert_get_Sha1Thumbprint(self, *args)
def TestCert(self): return _chilkat.CkCert_TestCert(self)
def ExportCertXml(self, *args): return _chilkat.CkCert_ExportCertXml(self, *args)
def exportCertXml(self): return _chilkat.CkCert_exportCertXml(self)
def get_VerboseLogging(self): return _chilkat.CkCert_get_VerboseLogging(self)
def put_VerboseLogging(self, *args): return _chilkat.CkCert_put_VerboseLogging(self, *args)
def get_CertVersion(self): return _chilkat.CkCert_get_CertVersion(self)
def SetPrivateKey(self, *args): return _chilkat.CkCert_SetPrivateKey(self, *args)
def get_OcspUrl(self, *args): return _chilkat.CkCert_get_OcspUrl(self, *args)
def ocspUrl(self): return _chilkat.CkCert_ocspUrl(self)
def FindIssuer(self): return _chilkat.CkCert_FindIssuer(self)
def LoadByIssuerAndSerialNumber(self, *args): return _chilkat.CkCert_LoadByIssuerAndSerialNumber(self, *args)
def get_SelfSigned(self): return _chilkat.CkCert_get_SelfSigned(self)
def SetPrivateKeyPem(self, *args): return _chilkat.CkCert_SetPrivateKeyPem(self, *args)
def GetPrivateKeyPem(self, *args): return _chilkat.CkCert_GetPrivateKeyPem(self, *args)
def getPrivateKeyPem(self): return _chilkat.CkCert_getPrivateKeyPem(self)
def getEncoded(self): return _chilkat.CkCert_getEncoded(self)
def issuerE(self): return _chilkat.CkCert_issuerE(self)
def issuerC(self): return _chilkat.CkCert_issuerC(self)
@ -1781,6 +1816,8 @@ class CkCertStore(_object):
def OpenOutlookStore(self, *args): return _chilkat.CkCertStore_OpenOutlookStore(self, *args)
def OpenRegistryStore(self, *args): return _chilkat.CkCertStore_OpenRegistryStore(self, *args)
def FindCertBySha1Thumbprint(self, *args): return _chilkat.CkCertStore_FindCertBySha1Thumbprint(self, *args)
def get_VerboseLogging(self): return _chilkat.CkCertStore_get_VerboseLogging(self)
def put_VerboseLogging(self, *args): return _chilkat.CkCertStore_put_VerboseLogging(self, *args)
def lastErrorText(self): return _chilkat.CkCertStore_lastErrorText(self)
def lastErrorXml(self): return _chilkat.CkCertStore_lastErrorXml(self)
def lastErrorHtml(self): return _chilkat.CkCertStore_lastErrorHtml(self)
@ -1875,6 +1912,23 @@ class CkMime(_object):
def AddContentLength(self): return _chilkat.CkMime_AddContentLength(self)
def get_VerboseLogging(self): return _chilkat.CkMime_get_VerboseLogging(self)
def put_VerboseLogging(self, *args): return _chilkat.CkMime_put_VerboseLogging(self, *args)
def DecryptUsingPfxData(self, *args): return _chilkat.CkMime_DecryptUsingPfxData(self, *args)
def DecryptUsingPfxFile(self, *args): return _chilkat.CkMime_DecryptUsingPfxFile(self, *args)
def AddPfxSourceData(self, *args): return _chilkat.CkMime_AddPfxSourceData(self, *args)
def AddPfxSourceFile(self, *args): return _chilkat.CkMime_AddPfxSourceFile(self, *args)
def get_Pkcs7CryptAlg(self, *args): return _chilkat.CkMime_get_Pkcs7CryptAlg(self, *args)
def pkcs7CryptAlg(self): return _chilkat.CkMime_pkcs7CryptAlg(self)
def put_Pkcs7CryptAlg(self, *args): return _chilkat.CkMime_put_Pkcs7CryptAlg(self, *args)
def get_Pkcs7KeyLength(self): return _chilkat.CkMime_get_Pkcs7KeyLength(self)
def put_Pkcs7KeyLength(self, *args): return _chilkat.CkMime_put_Pkcs7KeyLength(self, *args)
def get_SigningHashAlg(self, *args): return _chilkat.CkMime_get_SigningHashAlg(self, *args)
def signingHashAlg(self): return _chilkat.CkMime_signingHashAlg(self)
def put_SigningHashAlg(self, *args): return _chilkat.CkMime_put_SigningHashAlg(self, *args)
def GetHeaderFieldAttribute(self, *args): return _chilkat.CkMime_GetHeaderFieldAttribute(self, *args)
def getHeaderFieldAttribute(self, *args): return _chilkat.CkMime_getHeaderFieldAttribute(self, *args)
def HasSignatureSigningTime(self, *args): return _chilkat.CkMime_HasSignatureSigningTime(self, *args)
def GetSignatureSigningTime(self, *args): return _chilkat.CkMime_GetSignatureSigningTime(self, *args)
def RemoveHeaderField(self, *args): return _chilkat.CkMime_RemoveHeaderField(self, *args)
def entireHead(self): return _chilkat.CkMime_entireHead(self)
def entireBody(self): return _chilkat.CkMime_entireBody(self)
def xml(self): return _chilkat.CkMime_xml(self)
@ -2111,6 +2165,14 @@ class CkMailMan(_object):
def put_HttpProxyPassword(self, *args): return _chilkat.CkMailMan_put_HttpProxyPassword(self, *args)
def get_HttpProxyPort(self): return _chilkat.CkMailMan_get_HttpProxyPort(self)
def put_HttpProxyPort(self, *args): return _chilkat.CkMailMan_put_HttpProxyPort(self, *args)
def get_AutoFix(self): return _chilkat.CkMailMan_get_AutoFix(self)
def put_AutoFix(self, *args): return _chilkat.CkMailMan_put_AutoFix(self, *args)
def get_VerboseLogging(self): return _chilkat.CkMailMan_get_VerboseLogging(self)
def put_VerboseLogging(self, *args): return _chilkat.CkMailMan_put_VerboseLogging(self, *args)
def get_Pop3Stls(self): return _chilkat.CkMailMan_get_Pop3Stls(self)
def put_Pop3Stls(self, *args): return _chilkat.CkMailMan_put_Pop3Stls(self, *args)
def AddPfxSourceData(self, *args): return _chilkat.CkMailMan_AddPfxSourceData(self, *args)
def AddPfxSourceFile(self, *args): return _chilkat.CkMailMan_AddPfxSourceFile(self, *args)
def lastErrorText(self): return _chilkat.CkMailMan_lastErrorText(self)
def lastErrorXml(self): return _chilkat.CkMailMan_lastErrorXml(self)
def lastErrorHtml(self): return _chilkat.CkMailMan_lastErrorHtml(self)
@ -2183,8 +2245,6 @@ class CkMailMan(_object):
def put_ReadTimeout(self, *args): return _chilkat.CkMailMan_put_ReadTimeout(self, *args)
def get_ConnectTimeout(self): return _chilkat.CkMailMan_get_ConnectTimeout(self)
def put_ConnectTimeout(self, *args): return _chilkat.CkMailMan_put_ConnectTimeout(self, *args)
def get_AutoUnwrapSecurity(self): return _chilkat.CkMailMan_get_AutoUnwrapSecurity(self)
def put_AutoUnwrapSecurity(self, *args): return _chilkat.CkMailMan_put_AutoUnwrapSecurity(self, *args)
def get_ResetDateOnLoad(self): return _chilkat.CkMailMan_get_ResetDateOnLoad(self)
def put_ResetDateOnLoad(self, *args): return _chilkat.CkMailMan_put_ResetDateOnLoad(self, *args)
def get_OpaqueSigning(self): return _chilkat.CkMailMan_get_OpaqueSigning(self)
@ -2197,8 +2257,6 @@ class CkMailMan(_object):
def put_StartTLS(self, *args): return _chilkat.CkMailMan_put_StartTLS(self, *args)
def get_EmbedCertChain(self): return _chilkat.CkMailMan_get_EmbedCertChain(self)
def put_EmbedCertChain(self, *args): return _chilkat.CkMailMan_put_EmbedCertChain(self, *args)
def get_AutoSaveCerts(self): return _chilkat.CkMailMan_get_AutoSaveCerts(self)
def put_AutoSaveCerts(self, *args): return _chilkat.CkMailMan_put_AutoSaveCerts(self, *args)
def get_PopSsl(self): return _chilkat.CkMailMan_get_PopSsl(self)
def put_PopSsl(self, *args): return _chilkat.CkMailMan_put_PopSsl(self, *args)
def get_SmtpSsl(self): return _chilkat.CkMailMan_get_SmtpSsl(self)
@ -2320,6 +2378,8 @@ class CkGzip(_object):
def xfdlToXml(self, *args): return _chilkat.CkGzip_xfdlToXml(self, *args)
def Encode(self, *args): return _chilkat.CkGzip_Encode(self, *args)
def encode(self, *args): return _chilkat.CkGzip_encode(self, *args)
def get_VerboseLogging(self): return _chilkat.CkGzip_get_VerboseLogging(self)
def put_VerboseLogging(self, *args): return _chilkat.CkGzip_put_VerboseLogging(self, *args)
def lastErrorText(self): return _chilkat.CkGzip_lastErrorText(self)
def lastErrorXml(self): return _chilkat.CkGzip_lastErrorXml(self)
def lastErrorHtml(self): return _chilkat.CkGzip_lastErrorHtml(self)
@ -2471,6 +2531,11 @@ class CkCrypt2(_object):
def put_UuFilename(self, *args): return _chilkat.CkCrypt2_put_UuFilename(self, *args)
def get_VerboseLogging(self): return _chilkat.CkCrypt2_get_VerboseLogging(self)
def put_VerboseLogging(self, *args): return _chilkat.CkCrypt2_put_VerboseLogging(self, *args)
def AddPfxSourceData(self, *args): return _chilkat.CkCrypt2_AddPfxSourceData(self, *args)
def AddPfxSourceFile(self, *args): return _chilkat.CkCrypt2_AddPfxSourceFile(self, *args)
def get_Pkcs7CryptAlg(self, *args): return _chilkat.CkCrypt2_get_Pkcs7CryptAlg(self, *args)
def pkcs7CryptAlg(self): return _chilkat.CkCrypt2_pkcs7CryptAlg(self)
def put_Pkcs7CryptAlg(self, *args): return _chilkat.CkCrypt2_put_Pkcs7CryptAlg(self, *args)
def get_FirstChunk(self): return _chilkat.CkCrypt2_get_FirstChunk(self)
def put_FirstChunk(self, *args): return _chilkat.CkCrypt2_put_FirstChunk(self, *args)
def get_LastChunk(self): return _chilkat.CkCrypt2_get_LastChunk(self)
@ -2847,6 +2912,16 @@ class CkFtp2(_object):
def get_SslProtocol(self, *args): return _chilkat.CkFtp2_get_SslProtocol(self, *args)
def sslProtocol(self): return _chilkat.CkFtp2_sslProtocol(self)
def put_SslProtocol(self, *args): return _chilkat.CkFtp2_put_SslProtocol(self, *args)
def get_AutoGetSizeForProgress(self): return _chilkat.CkFtp2_get_AutoGetSizeForProgress(self)
def put_AutoGetSizeForProgress(self, *args): return _chilkat.CkFtp2_put_AutoGetSizeForProgress(self, *args)
def get_SyncPreview(self, *args): return _chilkat.CkFtp2_get_SyncPreview(self, *args)
def syncPreview(self): return _chilkat.CkFtp2_syncPreview(self)
def SyncRemoteTree2(self, *args): return _chilkat.CkFtp2_SyncRemoteTree2(self, *args)
def get_AutoFix(self): return _chilkat.CkFtp2_get_AutoFix(self)
def put_AutoFix(self, *args): return _chilkat.CkFtp2_put_AutoFix(self, *args)
def get_ClientIpAddress(self, *args): return _chilkat.CkFtp2_get_ClientIpAddress(self, *args)
def clientIpAddress(self): return _chilkat.CkFtp2_clientIpAddress(self)
def put_ClientIpAddress(self, *args): return _chilkat.CkFtp2_put_ClientIpAddress(self, *args)
CkFtp2_swigregister = _chilkat.CkFtp2_swigregister
CkFtp2_swigregister(CkFtp2)
@ -3060,6 +3135,40 @@ class CkHttp(_object):
def PostUrlEncoded(self, *args): return _chilkat.CkHttp_PostUrlEncoded(self, *args)
def PostBinary(self, *args): return _chilkat.CkHttp_PostBinary(self, *args)
def postBinary(self, *args): return _chilkat.CkHttp_postBinary(self, *args)
def QuickGetObj(self, *args): return _chilkat.CkHttp_QuickGetObj(self, *args)
def get_SessionLogFilename(self, *args): return _chilkat.CkHttp_get_SessionLogFilename(self, *args)
def sessionLogFilename(self): return _chilkat.CkHttp_sessionLogFilename(self)
def put_SessionLogFilename(self, *args): return _chilkat.CkHttp_put_SessionLogFilename(self, *args)
def get_BgLastErrorText(self, *args): return _chilkat.CkHttp_get_BgLastErrorText(self, *args)
def bgLastErrorText(self): return _chilkat.CkHttp_bgLastErrorText(self)
def get_BgResultData(self, *args): return _chilkat.CkHttp_get_BgResultData(self, *args)
def get_BgResultInt(self): return _chilkat.CkHttp_get_BgResultInt(self)
def get_BgResultString(self, *args): return _chilkat.CkHttp_get_BgResultString(self, *args)
def bgResultString(self): return _chilkat.CkHttp_bgResultString(self)
def get_BgTaskFinished(self): return _chilkat.CkHttp_get_BgTaskFinished(self)
def get_BgTaskRunning(self): return _chilkat.CkHttp_get_BgTaskRunning(self)
def get_BgTaskSuccess(self): return _chilkat.CkHttp_get_BgTaskSuccess(self)
def get_EventLogCount(self): return _chilkat.CkHttp_get_EventLogCount(self)
def get_KeepEventLog(self): return _chilkat.CkHttp_get_KeepEventLog(self)
def put_KeepEventLog(self, *args): return _chilkat.CkHttp_put_KeepEventLog(self, *args)
def get_UseBgThread(self): return _chilkat.CkHttp_get_UseBgThread(self)
def put_UseBgThread(self, *args): return _chilkat.CkHttp_put_UseBgThread(self, *args)
def BgResponseObject(self): return _chilkat.CkHttp_BgResponseObject(self)
def BgTaskAbort(self): return _chilkat.CkHttp_BgTaskAbort(self)
def ClearEventLog(self): return _chilkat.CkHttp_ClearEventLog(self)
def EventLogName(self, *args): return _chilkat.CkHttp_EventLogName(self, *args)
def eventLogName(self, *args): return _chilkat.CkHttp_eventLogName(self, *args)
def EventLogValue(self, *args): return _chilkat.CkHttp_EventLogValue(self, *args)
def eventLogValue(self, *args): return _chilkat.CkHttp_eventLogValue(self, *args)
def SleepMs(self, *args): return _chilkat.CkHttp_SleepMs(self, *args)
def get_ClientIpAddress(self, *args): return _chilkat.CkHttp_get_ClientIpAddress(self, *args)
def clientIpAddress(self): return _chilkat.CkHttp_clientIpAddress(self)
def put_ClientIpAddress(self, *args): return _chilkat.CkHttp_put_ClientIpAddress(self, *args)
def get_ProxyAuthMethod(self, *args): return _chilkat.CkHttp_get_ProxyAuthMethod(self, *args)
def proxyAuthMethod(self): return _chilkat.CkHttp_proxyAuthMethod(self)
def put_ProxyAuthMethod(self, *args): return _chilkat.CkHttp_put_ProxyAuthMethod(self, *args)
def AddQuickHeader(self, *args): return _chilkat.CkHttp_AddQuickHeader(self, *args)
def RemoveQuickHeader(self, *args): return _chilkat.CkHttp_RemoveQuickHeader(self, *args)
def SetSslClientCert(self, *args): return _chilkat.CkHttp_SetSslClientCert(self, *args)
def get_LastHeader(self, *args): return _chilkat.CkHttp_get_LastHeader(self, *args)
def lastHeader(self): return _chilkat.CkHttp_lastHeader(self)
@ -3210,6 +3319,10 @@ class CkHttpRequest(_object):
def UsePostMultipartForm(self): return _chilkat.CkHttpRequest_UsePostMultipartForm(self)
def GetUrlEncodedParams(self, *args): return _chilkat.CkHttpRequest_GetUrlEncodedParams(self, *args)
def getUrlEncodedParams(self): return _chilkat.CkHttpRequest_getUrlEncodedParams(self)
def AddStringForUpload(self, *args): return _chilkat.CkHttpRequest_AddStringForUpload(self, *args)
def AddFileForUpload2(self, *args): return _chilkat.CkHttpRequest_AddFileForUpload2(self, *args)
def AddStringForUpload2(self, *args): return _chilkat.CkHttpRequest_AddStringForUpload2(self, *args)
def AddBytesForUpload2(self, *args): return _chilkat.CkHttpRequest_AddBytesForUpload2(self, *args)
def path(self): return _chilkat.CkHttpRequest_path(self)
def charset(self): return _chilkat.CkHttpRequest_charset(self)
def httpVersion(self): return _chilkat.CkHttpRequest_httpVersion(self)
@ -3290,6 +3403,7 @@ class CkHttpResponse(_object):
def get_Header(self, *args): return _chilkat.CkHttpResponse_get_Header(self, *args)
def get_Body(self, *args): return _chilkat.CkHttpResponse_get_Body(self, *args)
def get_BodyStr(self, *args): return _chilkat.CkHttpResponse_get_BodyStr(self, *args)
def get_BodyQP(self, *args): return _chilkat.CkHttpResponse_get_BodyQP(self, *args)
def get_StatusLine(self, *args): return _chilkat.CkHttpResponse_get_StatusLine(self, *args)
def get_StatusCode(self): return _chilkat.CkHttpResponse_get_StatusCode(self)
def get_Charset(self, *args): return _chilkat.CkHttpResponse_get_Charset(self, *args)
@ -3386,6 +3500,11 @@ class CkImap(_object):
def put_HttpProxyHostname(self, *args): return _chilkat.CkImap_put_HttpProxyHostname(self, *args)
def get_HttpProxyPort(self): return _chilkat.CkImap_get_HttpProxyPort(self)
def put_HttpProxyPort(self, *args): return _chilkat.CkImap_put_HttpProxyPort(self, *args)
def get_UidNext(self): return _chilkat.CkImap_get_UidNext(self)
def get_AutoFix(self): return _chilkat.CkImap_get_AutoFix(self)
def put_AutoFix(self, *args): return _chilkat.CkImap_put_AutoFix(self, *args)
def AddPfxSourceData(self, *args): return _chilkat.CkImap_AddPfxSourceData(self, *args)
def AddPfxSourceFile(self, *args): return _chilkat.CkImap_AddPfxSourceFile(self, *args)
def Connect(self, *args): return _chilkat.CkImap_Connect(self, *args)
def Disconnect(self): return _chilkat.CkImap_Disconnect(self)
def IsConnected(self): return _chilkat.CkImap_IsConnected(self)
@ -3447,8 +3566,6 @@ class CkImap(_object):
def GetMailNumAttach(self, *args): return _chilkat.CkImap_GetMailNumAttach(self, *args)
def GetMailAttachSize(self, *args): return _chilkat.CkImap_GetMailAttachSize(self, *args)
def GetMailAttachFilename(self, *args): return _chilkat.CkImap_GetMailAttachFilename(self, *args)
def get_AutoUnwrapSecurity(self): return _chilkat.CkImap_get_AutoUnwrapSecurity(self)
def put_AutoUnwrapSecurity(self, *args): return _chilkat.CkImap_put_AutoUnwrapSecurity(self, *args)
def get_PeekMode(self): return _chilkat.CkImap_get_PeekMode(self)
def put_PeekMode(self, *args): return _chilkat.CkImap_put_PeekMode(self, *args)
def get_SessionLog(self, *args): return _chilkat.CkImap_get_SessionLog(self, *args)
@ -4557,6 +4674,12 @@ class CkSFtp(_object):
def get_HttpProxyUsername(self, *args): return _chilkat.CkSFtp_get_HttpProxyUsername(self, *args)
def httpProxyUsername(self): return _chilkat.CkSFtp_httpProxyUsername(self)
def put_HttpProxyUsername(self, *args): return _chilkat.CkSFtp_put_HttpProxyUsername(self, *args)
def get_TcpNoDelay(self): return _chilkat.CkSFtp_get_TcpNoDelay(self)
def put_TcpNoDelay(self, *args): return _chilkat.CkSFtp_put_TcpNoDelay(self, *args)
def get_AccumulateBuffer(self, *args): return _chilkat.CkSFtp_get_AccumulateBuffer(self, *args)
def ClearAccumulateBuffer(self): return _chilkat.CkSFtp_ClearAccumulateBuffer(self)
def AccumulateBytes(self, *args): return _chilkat.CkSFtp_AccumulateBytes(self, *args)
def AuthenticatePwPk(self, *args): return _chilkat.CkSFtp_AuthenticatePwPk(self, *args)
CkSFtp_swigregister = _chilkat.CkSFtp_swigregister
CkSFtp_swigregister(CkSFtp)
@ -4683,6 +4806,8 @@ class CkSsh(_object):
def httpProxyUsername(self): return _chilkat.CkSsh_httpProxyUsername(self)
def put_HttpProxyUsername(self, *args): return _chilkat.CkSsh_put_HttpProxyUsername(self, *args)
def ChannelReceiveUntilMatchN(self, *args): return _chilkat.CkSsh_ChannelReceiveUntilMatchN(self, *args)
def ChannelReadAndPoll2(self, *args): return _chilkat.CkSsh_ChannelReadAndPoll2(self, *args)
def AuthenticatePwPk(self, *args): return _chilkat.CkSsh_AuthenticatePwPk(self, *args)
def SaveLastError(self, *args): return _chilkat.CkSsh_SaveLastError(self, *args)
def LastErrorXml(self, *args): return _chilkat.CkSsh_LastErrorXml(self, *args)
def LastErrorHtml(self, *args): return _chilkat.CkSsh_LastErrorHtml(self, *args)
@ -5271,6 +5396,7 @@ class CkSshTunnel(_object):
def put_SocksVersion(self, *args): return _chilkat.CkSshTunnel_put_SocksVersion(self, *args)
def get_ConnectTimeoutMs(self): return _chilkat.CkSshTunnel_get_ConnectTimeoutMs(self)
def put_ConnectTimeoutMs(self, *args): return _chilkat.CkSshTunnel_put_ConnectTimeoutMs(self, *args)
def get_ListenPort(self): return _chilkat.CkSshTunnel_get_ListenPort(self)
CkSshTunnel_swigregister = _chilkat.CkSshTunnel_swigregister
CkSshTunnel_swigregister(CkSshTunnel)
@ -5352,6 +5478,7 @@ class CkNtlm(_object):
def get_ServerChallenge(self, *args): return _chilkat.CkNtlm_get_ServerChallenge(self, *args)
def serverChallenge(self): return _chilkat.CkNtlm_serverChallenge(self)
def put_ServerChallenge(self, *args): return _chilkat.CkNtlm_put_ServerChallenge(self, *args)
def LoadType3(self, *args): return _chilkat.CkNtlm_LoadType3(self, *args)
CkNtlm_swigregister = _chilkat.CkNtlm_swigregister
CkNtlm_swigregister(CkNtlm)
@ -5415,6 +5542,8 @@ class CkDkim(_object):
def NumDomainKeySignatures(self, *args): return _chilkat.CkDkim_NumDomainKeySignatures(self, *args)
def AddDkimSignature(self, *args): return _chilkat.CkDkim_AddDkimSignature(self, *args)
def AddDomainKeySignature(self, *args): return _chilkat.CkDkim_AddDomainKeySignature(self, *args)
def LoadDkimPkBytes(self, *args): return _chilkat.CkDkim_LoadDkimPkBytes(self, *args)
def LoadDomainKeyPkBytes(self, *args): return _chilkat.CkDkim_LoadDomainKeyPkBytes(self, *args)
def SaveLastError(self, *args): return _chilkat.CkDkim_SaveLastError(self, *args)
def LastErrorXml(self, *args): return _chilkat.CkDkim_LastErrorXml(self, *args)
def LastErrorHtml(self, *args): return _chilkat.CkDkim_LastErrorHtml(self, *args)

View File

@ -1,4 +1,8 @@
# This package defines dialog boxes used by the main
# This module is part of the spambayes project, which is Copyright 2003
# The Python Software Foundation and is covered by the Python Software
# Foundation license.
import os, sys, stat
#import dialog_map

View File

@ -1,6 +1,10 @@
# A core, data-driven dialog.
# Driven completely by "Control Processor" objects.
# This module is part of the spambayes project, which is Copyright 2003
# The Python Software Foundation and is covered by the Python Software
# Foundation license.
import win32gui, win32api, win32con
import commctrl
import struct, array

View File

@ -1,5 +1,9 @@
# Generic utilities for dialog functions.
# This module is part of the spambayes project, which is Copyright 2003
# The Python Software Foundation and is covered by the Python Software
# Foundation license.
def MAKELONG(l,h):
return ((h & 0xFFFF) << 16) | (l & 0xFFFF)

View File

@ -2,18 +2,39 @@
# These are extensions to basic Control Processors that are linked with
# Outlook-Plugin options.
# This module is part of the spambayes project, which is Copyright 2003
# The Python Software Foundation and is covered by the Python Software
# Foundation license.
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import win32gui, win32api, win32con, win32ui
import commctrl
import struct, array
from dlgutils import *
import xmlrpclib
import processors
verbose = 0 # set to 1 to see option values fetched and set.
# A ControlProcessor that is linked up with options. These get a bit smarter.
class OptionControlProcessor(processors.ControlProcessor):
def __init__(self, window, control_ids):
processors.ControlProcessor.__init__(self, window, control_ids)
@ -204,8 +225,8 @@ class CSComboProcessor(ComboProcessor):
try:
list=['CRM Lead']#, 'CRM Helpdesk', 'CRM Lead', 'CRM Meeting', 'CRM Opportunity', 'CRM Phonecall']
objlist = conn.GetAllObjects()
if 'crm.claim' in objlist:
list.append('CRM Claim')
# if 'crm.claim' in objlist:
# list.append('CRM Claim')
if 'crm.helpdesk' in objlist:
list.append('CRM Helpdesk')
if 'crm.fundraising' in objlist:
@ -284,4 +305,4 @@ class GroupProcessor(OptionControlProcessor):
def UpdateControl_FromValue(self):
pass
def UpdateValue_FromControl(self):
pass
pass

View File

@ -1,5 +1,30 @@
# Control Processors for our dialog.
# This module is part of the spambayes project, which is Copyright 2003
# The Python Software Foundation and is covered by the Python Software
# Foundation license.
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import win32gui, win32api, win32con
import commctrl
import struct, array
@ -87,21 +112,6 @@ class RadioButtonProcessor(ControlProcessor):
conn.setitem('protocol', text)
p=conn.getitem('protocol')
# def OnCommand(self, wparam, lparam):
# win32ui.MessageBox("clicked===",'')
# code = win32api.HIWORD(wparam)
# id = win32api.LOWORD(wparam)
# win32ui.MessageBox("clicked===",'')
# if code == win32con.BN_CLICKED:
# win32ui.MessageBox("clicked===",'')
# import win32ui
# conn = self.func()
# win32ui.MessageBox("clicked===",'')
# text=win32gui.GetDlgItemText(self.window.hwnd, self.control_id)
# win32ui.MessageBox("clicked===",'')
# conn.setitem('protocol', text)
# win32ui.MessageBox("clicked==="+text,'')
class CloseButtonProcessor(ButtonProcessor):
def OnClicked(self, id):
win32gui.EndDialog(self.window.hwnd, id)

View File

@ -1,3 +1,7 @@
# This module is part of the spambayes project, which is Copyright 2003
# The Python Software Foundation and is covered by the Python Software
# Foundation license.
# Package that manages and defines dialog resources
def GetImageParamsFromBitmapID(rc_parser, bmpid):

File diff suppressed because one or more lines are too long

View File

@ -33,7 +33,7 @@ STYLE DS_SETFONT | WS_POPUP | WS_CAPTION | WS_SYSMENU | DS_MODALFRAME
CAPTION "OpenERP Configuarion"
FONT 8, "Tahoma", 1000, 0, 0x0
BEGIN
DEFPUSHBUTTON "Cancel",ID_DONE,400,239,50,14//,WS_VISIBLE //| WS_TABSTOP
DEFPUSHBUTTON "Close",ID_DONE,400,239,50,14//,WS_VISIBLE //| WS_TABSTOP
CONTROL "",IDC_TAB,"SysTabControl32",0x0,8,7,440,228
CONTROL "",IDC_LIST,"SysListView32",WS_CHILD | WS_VISIBLE | WS_BORDER | WS_HSCROLL | WS_VSCROLL |
LVS_SHOWSELALWAYS | LVS_REPORT | LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES,0,0,0,0
@ -86,9 +86,9 @@ EXSTYLE WS_EX_CONTEXTHELP
CAPTION "About"
FONT 8, "Tahoma", 400, 0, 0x0
BEGIN
GROUPBOX "About OpenERP Outlook Plugin",IDC_STATIC,7,3,422,200
GROUPBOX "About Plugin",IDC_STATIC,7,3,422,200
CONTROL 1062,IDB_OPENERPLOGO,"Static",SS_BITMAP | SS_REALSIZEIMAGE,60,30,20,20
LTEXT "",IDC_ABOUT,80,90,250,100
LTEXT "",IDC_ABOUT,80,90,300,100
END
IDD_SERVER_PORT_DIALOG DIALOGEX 0, 0, 160, 55
@ -108,7 +108,7 @@ END
IDD_SYNC DIALOGEX 0, 0, 470, 320
STYLE DS_SETFONT | WS_POPUP | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_CONTEXTHELP
CAPTION "Archive to OpenERP"
CAPTION "Push to OpenERP"
FONT 8, "Tahoma", 1000, 0, 0x0
BEGIN
GROUPBOX " Link to an Existing Documents ", IDC_STATIC_GROUP, 8,5,250,290,WS_TABSTOP
@ -117,7 +117,7 @@ BEGIN
PUSHBUTTON "Search",ID_SEARCH,187,15,40,14,WS_TABSTOP
LTEXT "Documents : ",IDC_STATIC,15,140,100,14
CONTROL "List1",IDC_NAME_LIST,"SysListView32",WS_CHILD | WS_VISIBLE | WS_BORDER | LVS_SHOWSELALWAYS | LVS_REPORT | WS_TABSTOP, 15,150,234,110
PUSHBUTTON "Archive to OpenERP",ID_MAKE_ATTACHMENT,160,270,85,14,WS_TABSTOP
PUSHBUTTON "Push",ID_MAKE_ATTACHMENT,160,270,85,14,WS_TABSTOP
GROUPBOX " Create a Document ", IDC_STATIC_GROUP, 263,5,202,100,WS_TABSTOP
LTEXT "Type of Document : ",IDC_STATIC,266,25,100,12

View File

@ -1,3 +1,26 @@
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
#!/usr/bin/python
#-*- encoding: utf-8 -*-
import sys
import chilkat
import os
@ -10,31 +33,20 @@ def generateEML(mail):
body = mail.Body.encode("utf-8")
recipients = mail.Recipients
sender_email = mail.SenderEmailAddress
sender_name = mail.SenderName
sender_name = mail.SenderEmailAddress
attachments=mail.Attachments
# to = mail.To
# cc = mail.CC
# rec_date = mail.ReceivedTime
email = chilkat.CkEmail()
email.put_Subject (ustr(sub).encode('iso-8859-1'))
email.put_Body (ustr(body).encode('utf-8'))
email.put_FromAddress (ustr(sender_email).encode('iso-8859-1'))
email.put_From (ustr(sender_name).encode('iso-8859-1'))
email.put_From (ustr(sender_email).encode('iso-8859-1'))
for i in xrange(1, recipients.Count+1):
name = ustr(recipients.Item(i).Name).encode('iso-8859-1')
address = ustr(recipients.Item(i).Address).encode('iso-8859-1')
email.AddTo(name,address)
# email.AddMultipleTo(to)
# email.AddMultipleCC(cc)
# win32ui.MessageBox("cccc---"+str(dir(cc)),'')
# for i in xrange(1, cc.Count+1):
# name = ustr(recipients.Item(i).Name).encode('iso-8859-1')
# address = ustr(recipients.Item(i).Address).encode('iso-8859-1')
# email.AddCC(name,address)
eml_name= ustr(sub).encode('iso-8859-1')+'-'+str(mail.EntryID)[-9:]
ls = ['*', '/', '\\', '<', '>', ':', '?', '"', '|', '\t', '\n']
mails_folder_path = os.path.abspath(os.path.dirname(__file__)+"\\dialogs\\resources\\mails\\")
@ -79,5 +91,4 @@ def generateEML(mail):
sys.exit()
print "Saved EML!",eml_path
return eml_path
return eml_path

View File

@ -1,3 +1,28 @@
# This module is part of the spambayes project, which is Copyright 2003
# The Python Software Foundation and is covered by the Python Software
# Foundation license.
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import os
import sys
import win32api, win32con
@ -83,6 +108,7 @@ class OpenERPManager:
('Account Invoices','account.invoice',''), ('Accounts','account.account',''), \
('Projects', 'project.project',''),('Sale Orders','sale.order',''), \
('Project Tasks','project.task',''), ('Products', 'product.product', '')]
self.config=self.LoadConfig()
def WorkerThreadStarting(self):

View File

@ -1,376 +1,389 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import xmlrpclib
import sys
import socket
import os
import pythoncom
import time
from manager import ustr
import smtplib
from email.mime.text import MIMEText
from email.parser import*
import email
waittime = 10
wait_count = 0
wait_limit = 12
import binascii
import base64
def execute(connector, method, *args):
global wait_count
res = False
try:
res = getattr(connector,method)(*args)
except socket.error,e:
if e.args[0] == 111:
if wait_count > wait_limit:
print "Server is taking too long to start, it has exceeded the maximum limit of %d seconds."%(wait_limit)
clean()
sys.exit(1)
print 'Please wait %d sec to start server....'%(waittime)
wait_count += 1
time.sleep(waittime)
res = execute(connector, method, *args)
else:
return res
wait_count = 0
return res
class XMLRpcConn(object):
__name__ = 'XMLRpcConn'
_com_interfaces_ = ['_IDTExtensibility2']
_public_methods_ = ['GetDBList', 'login', 'GetAllObjects', 'GetObjList', 'InsertObj', 'DeleteObject', \
'ArchiveToOpenERP', 'IsCRMInstalled', 'GetPartners', 'GetObjectItems', \
'CreateCase', 'MakeAttachment', 'CreateContact', 'CreatePartner', 'getitem', 'setitem', \
'SearchPartnerDetail', 'WritePartnerValues', 'GetAllState', 'GetAllCountry' ]
_reg_clsctx_ = pythoncom.CLSCTX_INPROC_SERVER
_reg_clsid_ = "{C6399AFD-763A-400F-8191-7F9D0503CAE2}"
_reg_progid_ = "Python.OpenERP.XMLRpcConn"
_reg_policy_spec_ = "win32com.server.policy.EventHandlerPolicy"
def __init__(self,server='localhost',port=8069,uri='http://localhost:8069'):
self._server=server
self._port=port
self._uri=uri
self._obj_list=[]
self._dbname=''
self._uname='admin'
self._pwd='a'
self._login=False
self._running=False
self._uid=False
self._iscrm=True
self.partner_id_list=None
self.protocol=None
def getitem(self, attrib):
v=self.__getattribute__(attrib)
return str(v)
def setitem(self, attrib, value):
return self.__setattr__(attrib, value)
def GetDBList(self):
conn = xmlrpclib.ServerProxy(self._uri + '/xmlrpc/db')
try:
db_list = execute(conn, 'list')
if db_list == False:
self._running=False
return []
else:
self._running=True
except:
db_list=-1
self._running=True
return db_list
def login(self,dbname, user, pwd):
self._dbname = dbname
self._uname = user
self._pwd = pwd
conn = xmlrpclib.ServerProxy(str(self._uri) + '/xmlrpc/common')
uid = execute(conn,'login',dbname, ustr(user), ustr(pwd))
return uid
def GetAllObjects(self):
conn = xmlrpclib.ServerProxy(self._uri+ '/xmlrpc/object')
ids = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'ir.model','search',[])
objects = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'ir.model','read',ids,['model'])
obj_list = [item['model'] for item in objects]
return obj_list
def GetObjList(self):
self._obj_list=list(self._obj_list)
self._obj_list.sort(reverse=True)
return self._obj_list
def InsertObj(self, obj_title,obj_name,image_path):
self._obj_list=list(self._obj_list)
self._obj_list.append((obj_title,obj_name,ustr(image_path)))
self._obj_list.sort(reverse=True)
def DeleteObject(self,sel_text):
self._obj_list=list(self._obj_list)
for obj in self._obj_list:
if obj[0] == sel_text:
self._obj_list.remove(obj)
break
def ArchiveToOpenERP(self, recs, mail):
import win32ui, win32con
conn = xmlrpclib.ServerProxy(self._uri + '/xmlrpc/object')
import eml
new_msg = files = ext_msg =""
eml_path=eml.generateEML(mail)
att_name = ustr(eml_path.split('\\')[-1])
flag=False
attachments=mail.Attachments
try:
fp = open(eml_path, 'rb')
msg =fp.read()
fp.close()
new_mail = email.message_from_string(str(msg))
except Exception,e:
win32ui.MessageBox(str(e),"Reading Error Mail")
for rec in recs: #[('res.partner', 3, 'Agrolait')]
model = rec[0]
res_id = rec[1]
object_ids = execute ( conn,'execute',self._dbname,int(self._uid),self._pwd,'ir.model','search',[('model','=',model)])
object_name = execute( conn,'execute',self._dbname,int(self._uid),self._pwd,'ir.model','read',object_ids,['name'])[0]['name']
#Reading the Object ir.model Name
ext_ids = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'mailgate.message','search',[('message_id','=',mail.EntryID),('model','=',model),('res_id','=',res_id)])
if ext_ids:
name = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,model,'read',res_id,['name'])['name']
ext_msg += """This mail is already archived to {1} '{2}'.
""".format(object_name,name)
continue
msg = {
'subject':mail.Subject,
'date':str(mail.ReceivedTime),
'body':mail.Body,
'cc':mail.CC,
'from':mail.SenderEmailAddress,
'to':mail.To,
'message-id':str(new_mail.get('Message-Id')),
'references':str(new_mail.get('References')),
}
result = {}
if attachments:
result = self.MakeAttachment([rec], mail)
attachment_ids = result.get(model, {}).get(res_id, [])
ids = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'email.server.tools','history',model, res_id, msg, attachment_ids)
new_msg += """- {0} : {1}\n""".format(object_name,str(rec[2]))
flag = True
if flag:
t = ext_msg
t += """Mail archived Successfully with attachments.\n"""+new_msg
win32ui.MessageBox(t,"Archived to OpenERP",win32con.MB_ICONINFORMATION)
return flag
def IsCRMInstalled(self):
conn = xmlrpclib.ServerProxy(self._uri+ '/xmlrpc/object')
id = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'ir.model','search',[('model','=','crm.lead')])
return id
def GetPartners(self):
conn = xmlrpclib.ServerProxy(self._uri+ '/xmlrpc/object')
ids=[]
ids = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'res.partner','search',[])
ids.sort()
obj_list=[]
obj_list.append((-999, ustr('')))
for id in ids:
object = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'res.partner','read',[id],['id','name'])[0]
obj_list.append((object['id'], ustr(object['name'])))
return obj_list
def GetObjectItems(self, search_list=[], search_text=''):
import win32ui
res = []
conn = xmlrpclib.ServerProxy(self._uri+ '/xmlrpc/object')
for obj in search_list:
object_ids = execute ( conn,'execute',self._dbname,int(self._uid),self._pwd,'ir.model','search',[('model','=',obj)])
object_name = execute( conn,'execute',self._dbname,int(self._uid),self._pwd,'ir.model','read',object_ids,['name'])[0]['name']
if obj == "res.partner.address":
ids = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,obj,'search',['|',('name','ilike',ustr(search_text)),('email','ilike',ustr(search_text))])
recs = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,obj,'read',ids,['id','name','street','city'])
for rec in recs:
name = ustr(rec['name'])
if rec['street']:
name += ', ' + ustr(rec['street'])
if rec['city']:
name += ', ' + ustr(rec['city'])
res.append((obj,rec['id'],name,object_name))
else:
ids = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,obj,'search',[('name','ilike',ustr(search_text))])
recs = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,obj,'read',ids,['id','name'])
for rec in recs:
name = ustr(rec['name'])
res.append((obj,rec['id'],name,object_name))
return res
def CreateCase(self, section, mail, partner_ids, with_attachments=True):
res={}
import win32ui
import eml
section=str(section)
partner_ids=eval(str(partner_ids))
conn = xmlrpclib.ServerProxy(self._uri+ '/xmlrpc/object')
try:
eml_path=eml.generateEML(mail)
fp = open(eml_path, 'rb')
msg =fp.read()
fp.close()
new_mail = email.message_from_string(str(msg))
except Exception,e:
win32ui.MessageBox(str(e),"Mail Reading Error")
execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'email.server.tools','process_email',section, str(new_mail))
def MakeAttachment(self, recs, mail):
attachments = mail.Attachments
result = {}
conn = xmlrpclib.ServerProxy(self._uri+ '/xmlrpc/object')
att_folder_path = os.path.abspath(os.path.dirname(__file__)+"\\dialogs\\resources\\mails\\attachments\\")
if not os.path.exists(att_folder_path):
os.makedirs(att_folder_path)
for rec in recs: #[('res.partner', 3, 'Agrolait')]
obj = rec[0]
obj_id = rec[1]
res={}
res['res_model'] = obj
attachment_ids = []
if obj not in result:
result[obj] = {}
for i in xrange(1, attachments.Count+1):
fn = ustr(attachments[i].FileName)
if len(fn) > 64:
l = 64 - len(fn)
f = fn.split('.')
fn = f[0][0:l] + '.' + f[-1]
att_path = os.path.join(att_folder_path,fn)
attachments[i].SaveAsFile(att_path)
f=open(att_path,"rb")
content = "".join(f.readlines()).encode('base64')
f.close()
res['name'] = ustr(attachments[i].DisplayName)
res['datas_fname'] = ustr(fn)
res['datas'] = content
res['res_id'] = obj_id
id = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'ir.attachment','create',res)
attachment_ids.append(id)
result[obj].update({obj_id: attachment_ids})
return result
def CreateContact(self, sel=None, res=None):
res=eval(str(res))
self.partner_id_list=eval(str(self.partner_id_list))
if self.partner_id_list.get(sel,-999) != -999:
res['partner_id'] = self.partner_id_list[sel]
conn = xmlrpclib.ServerProxy(self._uri+ '/xmlrpc/object')
id = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'res.partner.address','create',res)
return id
def CreatePartner(self, res):
res=eval(str(res))
conn = xmlrpclib.ServerProxy(self._uri+ '/xmlrpc/object')
ids = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'res.partner','search',[('name','=',res['name'])])
if ids:
return False
id = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'res.partner','create',res)
return id
def SearchPartnerDetail(self, search_email_id):
import win32ui
res_vals = []
address = {}
conn = xmlrpclib.ServerProxy(self._uri+ '/xmlrpc/object')
address_id = execute(conn, 'execute', self._dbname, int(self._uid), self._pwd, 'res.partner.address', 'search', [('email','ilike',ustr(search_email_id))])
if not address_id :
return
address = execute(conn, 'execute', self._dbname, int(self._uid), self._pwd, 'res.partner.address','read',address_id[0],['id','partner_id','name','street','street2','city','state_id','country_id','phone','mobile','email','fax','zip'])
for key, vals in address.items():
res_vals.append([key,vals])
return res_vals
def WritePartnerValues(self, new_vals):
import win32ui
flag = -1
new_dict = dict(new_vals)
email=new_dict['email']
conn = xmlrpclib.ServerProxy(self._uri+ '/xmlrpc/object')
address_id = execute( conn, 'execute', self._dbname, int(self._uid), self._pwd, 'res.partner.address', 'search', [('email','=',ustr(email))])
if not address_id:
return flag
address = execute( conn, 'execute', self._dbname, int(self._uid), self._pwd, 'res.partner.address','read',address_id[0],['id','partner_id','state_id','country_id'])
vals_res_address={ 'name' : new_dict['name'],
'street':new_dict['street'],
'street2' : new_dict['street2'],
'city' : new_dict['city'],
'phone' : new_dict['phone'],
'mobile' : new_dict['mobile'],
'fax' : new_dict['fax'],
'zip' : new_dict['zip'],
}
if new_dict['partner_id'] != -1:
vals_res_address['partner_id'] = new_dict['partner_id']
if new_dict['state_id'] != -1:
vals_res_address['state_id'] = new_dict['state_id']
if new_dict['country_id'] != -1:
vals_res_address['country_id'] = new_dict['country_id']
temp = execute( conn, 'execute', self._dbname, int(self._uid), self._pwd, 'res.partner.address', 'write', address_id, vals_res_address)
if temp:
flag=1
else:
flag=0
return flag
def GetAllState(self):
import win32ui
state_list = []
state_ids = []
conn = xmlrpclib.ServerProxy(self._uri+ '/xmlrpc/object')
state_ids = execute( conn, 'execute', self._dbname, int(self._uid), self._pwd, 'res.country.state', 'search', [])
for state_id in state_ids:
obj = execute( conn, 'execute', self._dbname, int(self._uid), self._pwd, 'res.country.state', 'read', [state_id],['id','name'])[0]
state_list.append((obj['id'], ustr(obj['name'])))
return state_list
def GetAllCountry(self):
import win32ui
country_list = []
country_ids = []
conn = xmlrpclib.ServerProxy(self._uri+ '/xmlrpc/object')
country_ids = execute( conn, 'execute', self._dbname, int(self._uid), self._pwd, 'res.country', 'search', [])
for country_id in country_ids:
obj = execute( conn, 'execute', self._dbname, int(self._uid), self._pwd, 'res.country','read', [country_id], ['id','name'])[0]
country_list.append((obj['id'], ustr(obj['name'])))
return country_list
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import xmlrpclib
import sys
import socket
import os
import pythoncom
import time
from manager import ustr
import email
waittime = 10
wait_count = 0
wait_limit = 12
def execute(connector, method, *args):
global wait_count
res = False
try:
res = getattr(connector,method)(*args)
except socket.error,e:
if e.args[0] == 111:
if wait_count > wait_limit:
print "Server is taking too long to start, it has exceeded the maximum limit of %d seconds."%(wait_limit)
clean()
sys.exit(1)
print 'Please wait %d sec to start server....'%(waittime)
wait_count += 1
time.sleep(waittime)
res = execute(connector, method, *args)
else:
return res
wait_count = 0
return res
class XMLRpcConn(object):
__name__ = 'XMLRpcConn'
_com_interfaces_ = ['_IDTExtensibility2']
_public_methods_ = ['GetDBList', 'login', 'GetAllObjects', 'GetObjList', 'InsertObj', 'DeleteObject', 'GetCSList', \
'ArchiveToOpenERP', 'IsCRMInstalled', 'GetPartners', 'GetObjectItems', \
'CreateCase', 'MakeAttachment', 'CreateContact', 'CreatePartner', 'getitem', 'setitem', \
'SearchPartnerDetail', 'WritePartnerValues', 'GetAllState', 'GetAllCountry' ]
_reg_clsctx_ = pythoncom.CLSCTX_INPROC_SERVER
_reg_clsid_ = "{C6399AFD-763A-400F-8191-7F9D0503CAE2}"
_reg_progid_ = "Python.OpenERP.XMLRpcConn"
_reg_policy_spec_ = "win32com.server.policy.EventHandlerPolicy"
def __init__(self,server='localhost',port=8069,uri='http://localhost:8069'):
self._server=server
self._port=port
self._uri=uri
self._obj_list=[]
self._dbname=''
self._uname='admin'
self._pwd='a'
self._login=False
self._running=False
self._uid=False
self._iscrm=True
self.partner_id_list=None
self.protocol=None
def getitem(self, attrib):
v=self.__getattribute__(attrib)
return str(v)
def setitem(self, attrib, value):
return self.__setattr__(attrib, value)
def GetDBList(self):
conn = xmlrpclib.ServerProxy(self._uri + '/xmlrpc/db')
try:
db_list = execute(conn, 'list')
if db_list == False:
self._running=False
return []
else:
self._running=True
except:
db_list=-1
self._running=True
return db_list
def login(self,dbname, user, pwd):
self._dbname = dbname
self._uname = user
self._pwd = pwd
conn = xmlrpclib.ServerProxy(str(self._uri) + '/xmlrpc/common')
uid = execute(conn,'login',dbname, ustr(user), ustr(pwd))
return uid
def GetAllObjects(self):
conn = xmlrpclib.ServerProxy(self._uri+ '/xmlrpc/object')
ids = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'ir.model','search',[])
objects = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'ir.model','read',ids,['model'])
obj_list = [item['model'] for item in objects]
return obj_list
def GetObjList(self):
self._obj_list=list(self._obj_list)
self._obj_list.sort(reverse=True)
return self._obj_list
def InsertObj(self, obj_title,obj_name,image_path):
self._obj_list=list(self._obj_list)
self._obj_list.append((obj_title,obj_name,ustr(image_path)))
self._obj_list.sort(reverse=True)
def DeleteObject(self,sel_text):
self._obj_list=list(self._obj_list)
for obj in self._obj_list:
if obj[0] == sel_text:
self._obj_list.remove(obj)
break
def ArchiveToOpenERP(self, recs, mail):
import win32ui, win32con
conn = xmlrpclib.ServerProxy(self._uri + '/xmlrpc/object')
import eml
new_msg = files = ext_msg =""
eml_path=eml.generateEML(mail)
att_name = ustr(eml_path.split('\\')[-1])
flag=False
attachments=mail.Attachments
try:
fp = open(eml_path, 'rb')
msg =fp.read()
fp.close()
new_mail = email.message_from_string(str(msg))
except Exception,e:
win32ui.MessageBox(str(e),"Reading Error Mail")
for rec in recs: #[('res.partner', 3, 'Agrolait')]
model = rec[0]
res_id = rec[1]
#Check if mailgate installed
object_id = execute ( conn,'execute',self._dbname,int(self._uid),self._pwd,'ir.model','search',[('model','=','mailgate.message')])
if not object_id:
win32ui.MessageBox("Mailgate is not installed on your configured database '%s' !!\n\nPlease install it to archive the mail."%(self._dbname),"Mailgate not installed",win32con.MB_ICONERROR)
return
object_ids = execute ( conn,'execute',self._dbname,int(self._uid),self._pwd,'ir.model','search',[('model','=',model)])
object_name = execute( conn,'execute',self._dbname,int(self._uid),self._pwd,'ir.model','read',object_ids,['name'])[0]['name']
#Reading the Object ir.model Name
ext_ids = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'mailgate.message','search',[('message_id','=',mail.EntryID),('model','=',model),('res_id','=',res_id)])
if ext_ids:
name = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,model,'read',res_id,['name'])['name']
ext_msg += """This mail is already archived to {1} '{2}'.
""".format(object_name,name)
continue
msg = {
'subject':mail.Subject,
'date':str(mail.ReceivedTime),
'body':mail.Body,
'cc':mail.CC,
'from':mail.SenderEmailAddress,
'to':mail.To,
'message-id':str(new_mail.get('Message-Id')),
'references':str(new_mail.get('References')),
}
result = {}
if attachments:
result = self.MakeAttachment([rec], mail)
attachment_ids = result.get(model, {}).get(res_id, [])
ids = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'email.server.tools','history',model, res_id, msg, attachment_ids)
new_msg += """- {0} : {1}\n""".format(object_name,str(rec[2]))
flag = True
if flag:
t = ext_msg
t += """Mail archived Successfully with attachments.\n"""+new_msg
win32ui.MessageBox(t,"Archived to OpenERP",win32con.MB_ICONINFORMATION)
return flag
def IsCRMInstalled(self):
conn = xmlrpclib.ServerProxy(self._uri+ '/xmlrpc/object')
id = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'ir.model','search',[('model','=','crm.lead')])
return id
def GetCSList(self):
conn = xmlrpclib.ServerProxy(self._uri+ '/xmlrpc/object')
ids = execute(conn,'execute',self._dbname,int(int(self._uid)),self._pwd,'crm.case.section','search',[])
objects = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'crm.case.section','read',ids,['name'])
obj_list = [ustr(item['name']).encode('iso-8859-1') for item in objects]
return obj_list
def GetPartners(self):
conn = xmlrpclib.ServerProxy(self._uri+ '/xmlrpc/object')
ids=[]
obj_list=[]
ids = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'res.partner','search',[])
if ids:
ids.sort()
obj_list.append((-999, ustr('')))
for id in ids:
object = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'res.partner','read',[id],['id','name'])[0]
obj_list.append((object['id'], ustr(object['name'])))
obj_list.sort(lambda x, y: cmp(x[1],y[1]))
return obj_list
def GetObjectItems(self, search_list=[], search_text=''):
import win32ui
res = []
conn = xmlrpclib.ServerProxy(self._uri+ '/xmlrpc/object')
for obj in search_list:
object_ids = execute ( conn,'execute',self._dbname,int(self._uid),self._pwd,'ir.model','search',[('model','=',obj)])
object_name = execute( conn,'execute',self._dbname,int(self._uid),self._pwd,'ir.model','read',object_ids,['name'])[0]['name']
if obj == "res.partner.address":
ids = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,obj,'search',['|',('name','ilike',ustr(search_text)),('email','ilike',ustr(search_text))])
recs = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,obj,'read',ids,['id','name','street','city'])
for rec in recs:
name = ustr(rec['name'])
if rec['street']:
name += ', ' + ustr(rec['street'])
if rec['city']:
name += ', ' + ustr(rec['city'])
res.append((obj,rec['id'],name,object_name))
else:
ids = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,obj,'search',[('name','ilike',ustr(search_text))])
recs = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,obj,'read',ids,['id','name'])
for rec in recs:
name = ustr(rec['name'])
res.append((obj,rec['id'],name,object_name))
return res
def CreateCase(self, section, mail, partner_ids, with_attachments=True):
res={}
import win32ui
import eml
section=str(section)
partner_ids=eval(str(partner_ids))
conn = xmlrpclib.ServerProxy(self._uri+ '/xmlrpc/object')
try:
eml_path=eml.generateEML(mail)
fp = open(eml_path, 'rb')
msg =fp.read()
fp.close()
new_mail = email.message_from_string(str(msg))
except Exception,e:
win32ui.MessageBox(str(e),"Mail Reading Error")
execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'email.server.tools','process_email',section, str(new_mail))
def MakeAttachment(self, recs, mail):
attachments = mail.Attachments
result = {}
conn = xmlrpclib.ServerProxy(self._uri+ '/xmlrpc/object')
att_folder_path = os.path.abspath(os.path.dirname(__file__)+"\\dialogs\\resources\\mails\\attachments\\")
if not os.path.exists(att_folder_path):
os.makedirs(att_folder_path)
for rec in recs: #[('res.partner', 3, 'Agrolait')]
obj = rec[0]
obj_id = rec[1]
res={}
res['res_model'] = obj
attachment_ids = []
if obj not in result:
result[obj] = {}
for i in xrange(1, attachments.Count+1):
fn = ustr(attachments[i].FileName)
if len(fn) > 64:
l = 64 - len(fn)
f = fn.split('.')
fn = f[0][0:l] + '.' + f[-1]
att_path = os.path.join(att_folder_path,fn)
attachments[i].SaveAsFile(att_path)
f=open(att_path,"rb")
content = "".join(f.readlines()).encode('base64')
f.close()
res['name'] = ustr(attachments[i].DisplayName)
res['datas_fname'] = ustr(fn)
res['datas'] = content
res['res_id'] = obj_id
id = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'ir.attachment','create',res)
attachment_ids.append(id)
result[obj].update({obj_id: attachment_ids})
return result
def CreateContact(self, sel=None, res=None):
res=eval(str(res))
self.partner_id_list=eval(str(self.partner_id_list))
if self.partner_id_list.get(sel,-999) != -999:
res['partner_id'] = self.partner_id_list[sel]
conn = xmlrpclib.ServerProxy(self._uri+ '/xmlrpc/object')
id = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'res.partner.address','create',res)
return id
def CreatePartner(self, res):
res=eval(str(res))
conn = xmlrpclib.ServerProxy(self._uri+ '/xmlrpc/object')
ids = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'res.partner','search',[('name','=',res['name'])])
if ids:
return False
id = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'res.partner','create',res)
return id
def SearchPartnerDetail(self, search_email_id):
import win32ui
res_vals = []
address = {}
conn = xmlrpclib.ServerProxy(self._uri+ '/xmlrpc/object')
address_id = execute(conn, 'execute', self._dbname, int(self._uid), self._pwd, 'res.partner.address', 'search', [('email','ilike',ustr(search_email_id))])
if not address_id :
return
address = execute(conn, 'execute', self._dbname, int(self._uid), self._pwd, 'res.partner.address','read',address_id[0],['id','partner_id','name','street','street2','city','state_id','country_id','phone','mobile','email','fax','zip'])
for key, vals in address.items():
res_vals.append([key,vals])
return res_vals
def WritePartnerValues(self, new_vals):
import win32ui
flag = -1
new_dict = dict(new_vals)
email=new_dict['email']
conn = xmlrpclib.ServerProxy(self._uri+ '/xmlrpc/object')
address_id = execute( conn, 'execute', self._dbname, int(self._uid), self._pwd, 'res.partner.address', 'search', [('email','=',ustr(email))])
if not address_id:
return flag
address = execute( conn, 'execute', self._dbname, int(self._uid), self._pwd, 'res.partner.address','read',address_id[0],['id','partner_id','state_id','country_id'])
vals_res_address={ 'name' : new_dict['name'],
'street':new_dict['street'],
'street2' : new_dict['street2'],
'city' : new_dict['city'],
'phone' : new_dict['phone'],
'mobile' : new_dict['mobile'],
'fax' : new_dict['fax'],
'zip' : new_dict['zip'],
}
if new_dict['partner_id'] != -1:
vals_res_address['partner_id'] = new_dict['partner_id']
if new_dict['state_id'] != -1:
vals_res_address['state_id'] = new_dict['state_id']
if new_dict['country_id'] != -1:
vals_res_address['country_id'] = new_dict['country_id']
temp = execute( conn, 'execute', self._dbname, int(self._uid), self._pwd, 'res.partner.address', 'write', address_id, vals_res_address)
if temp:
flag=1
else:
flag=0
return flag
def GetAllState(self):
import win32ui
state_list = []
state_ids = []
conn = xmlrpclib.ServerProxy(self._uri+ '/xmlrpc/object')
state_ids = execute( conn, 'execute', self._dbname, int(self._uid), self._pwd, 'res.country.state', 'search', [])
for state_id in state_ids:
obj = execute( conn, 'execute', self._dbname, int(self._uid), self._pwd, 'res.country.state', 'read', [state_id],['id','name'])[0]
state_list.append((obj['id'], ustr(obj['name'])))
return state_list
def GetAllCountry(self):
import win32ui
country_list = []
country_ids = []
conn = xmlrpclib.ServerProxy(self._uri+ '/xmlrpc/object')
country_ids = execute( conn, 'execute', self._dbname, int(self._uid), self._pwd, 'res.country', 'search', [])
for country_id in country_ids:
obj = execute( conn, 'execute', self._dbname, int(self._uid), self._pwd, 'res.country','read', [country_id], ['id','name'])[0]
country_list.append((obj['id'], ustr(obj['name'])))
return country_list

View File

@ -13,7 +13,7 @@
<hbox>
<description>&name.value;</description>
<spacer width="50"/>
<textbox id="txtname" align="right" />
<textbox id="txtselectpartner" align="right" />
</hbox>
</groupbox>
<description></description>

View File

@ -38,7 +38,7 @@
<toolbarbutton id="GA-button"
class="toolbarbutton-1"
image="&menuicon.value;"
label= "Archive To OpenERP"
label= "Push To OpenERP"
oncommand="searchmail();" />
</toolbarpalette>

View File

@ -1329,9 +1329,7 @@ var listPartnerHandler = {
listItem.value = arrPartnerList[i][0];
cmdPartnerList.appendChild(listItem);
}
}
},
onFault: function (client, ctxt, fault) {
@ -1873,7 +1871,10 @@ var listCreatePartnerHandler = {
onResult: function(client, context, result) {
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect UniversalBrowserAccess');
var createId = result.QueryInterface(Components.interfaces.nsISupportsPRInt32);
setPartnerId(createId);
txtselectpartner = document.getElementById('txtselectpartner')
if(typeof(createId.data) == 'number' && createId!=0){
window.opener.document.getElementById('txtselectpartner').setAttribute('value',txtselectpartner.value);
window.close();
}
if(createId == 0){
@ -1891,6 +1892,7 @@ var listCreatePartnerHandler = {
//function to create the tiny partner object
function createPartner(){
var branchobj = getPref();
txtselectpartner = document.getElementById('txtselectpartner')
setServerService('xmlrpc/object');
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect UniversalBrowserAccess');
var xmlRpcClient = getXmlRpc();
@ -1904,12 +1906,13 @@ function createPartner(){
strmethod.data = 'create_partner';
var strobj = xmlRpcClient.createType(xmlRpcClient.STRING,{});
strobj.data = 'thunderbird.partner';
if(document.getElementById('txtname').value ==''){
if(document.getElementById('txtselectpartner').value ==''){
alert("You Must Enter Partner Name.");
return false;
}
var a = ['name'];
var b = [document.getElementById('txtname').value];
setPartnerId(txtselectpartner.value)
var a = ['partner_id','name'];
var b = [getPartnerId(),txtselectpartner.value];
var arrofarr = dictcontact(a,b);
xmlRpcClient.asyncCall(listCreatePartnerHandler,null,'execute',[strDbName,struids,strpass,strobj,strmethod,arrofarr],6);
}

View File

@ -1,6 +1,6 @@
<!ENTITY tinyplugin "OpenERP Configuration">
<!ENTITY tinypluginconfig "Archieve To OpenERP">
<!ENTITY tinyarchive "Archive to OpenERP">
<!ENTITY tinypluginconfig "Push To OpenERP">
<!ENTITY tinyarchive "Push to OpenERP">
<!ENTITY imageicon.value "chrome://openerp_plugin/skin/NEWT1.png">
<!ENTITY menuicon.value "chrome://openerp_plugin/skin/openerp-icon.png">
<!ENTITY partnericon.value "chrome://openerp_plugin/skin/partner.png">

View File

@ -1,10 +1,10 @@
<!ENTITY title.label "Archive To OpenERP">
<!ENTITY title.label "Push To OpenERP">
<!ENTITY gptinyobj.label "Link to an Existing Document">
<!ENTITY newobject.label "New Documents">
<!ENTITY document.label "Documents">
<!ENTITY bsearch.label "Search">
<!ENTITY close.label "Close">
<!ENTITY attach.label "Archive to OpenERP">
<!ENTITY attach.label "Push">
<!ENTITY create.label "New Contact">
<!ENTITY archive.label "Create">
<!ENTITY attach.label "Attach">