summaryrefslogtreecommitdiff
path: root/addons
diff options
context:
space:
mode:
authorHarry (OpenERP) <hmo@tinyerp.com>2010-09-21 20:37:46 +0530
committerHarry (OpenERP) <hmo@tinyerp.com>2010-09-21 20:37:46 +0530
commite38d7bcf52fc57e5ee65f259e7b93a264fc3a0a1 (patch)
tree310e6c151152b7ce2821ef4addf35596ed1ecd05 /addons
parent58558d98d4160ad42c150cbffa032bd1dcb92dea (diff)
[IMP] thunderbird, outlook plugin
bzr revid: hmo@tinyerp.com-20100921150746-i4ccvy382ugl0pnb
Diffstat (limited to 'addons')
-rwxr-xr-xaddons/outlook/plugin/openerp-outlook-plugin/addin.py54
-rwxr-xr-xaddons/outlook/plugin/openerp-outlook-plugin/chilkat.py145
-rwxr-xr-xaddons/outlook/plugin/openerp-outlook-plugin/dialogs/__init__.py4
-rwxr-xr-xaddons/outlook/plugin/openerp-outlook-plugin/dialogs/dialog_map.py2839
-rwxr-xr-xaddons/outlook/plugin/openerp-outlook-plugin/dialogs/dlgcore.py4
-rwxr-xr-xaddons/outlook/plugin/openerp-outlook-plugin/dialogs/dlgutils.py4
-rwxr-xr-xaddons/outlook/plugin/openerp-outlook-plugin/dialogs/opt_processors.py35
-rwxr-xr-xaddons/outlook/plugin/openerp-outlook-plugin/dialogs/processors.py40
-rwxr-xr-xaddons/outlook/plugin/openerp-outlook-plugin/dialogs/resources/__init__.py4
-rwxr-xr-xaddons/outlook/plugin/openerp-outlook-plugin/dialogs/resources/dialogs.py10
-rwxr-xr-xaddons/outlook/plugin/openerp-outlook-plugin/dialogs/resources/dialogs.rc10
-rwxr-xr-xaddons/outlook/plugin/openerp-outlook-plugin/eml.py41
-rwxr-xr-xaddons/outlook/plugin/openerp-outlook-plugin/manager.py26
-rwxr-xr-xaddons/outlook/plugin/openerp-outlook-plugin/tiny_xmlrpc.py765
-rw-r--r--addons/thunderbird/plugin/openerp_plugin.xpibin152340 -> 149756 bytes
-rw-r--r--addons/thunderbird/plugin/openerp_plugin/chrome/openerp_plugin.jarbin71837 -> 70768 bytes
-rw-r--r--addons/thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/content/createpartner.xul2
-rwxr-xr-xaddons/thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/content/overlay.xul2
-rwxr-xr-xaddons/thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/content/tiny_xmlrpc.js13
-rwxr-xr-xaddons/thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/locale/en-US/overlay.dtd4
-rw-r--r--addons/thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/locale/en-US/plugin.dtd4
21 files changed, 2139 insertions, 1867 deletions
diff --git a/addons/outlook/plugin/openerp-outlook-plugin/addin.py b/addons/outlook/plugin/openerp-outlook-plugin/addin.py
index 3aa4a39574c..f8f96dcb962 100755
--- a/addons/outlook/plugin/openerp-outlook-plugin/addin.py
+++ b/addons/outlook/plugin/openerp-outlook-plugin/addin.py
@@ -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")
diff --git a/addons/outlook/plugin/openerp-outlook-plugin/chilkat.py b/addons/outlook/plugin/openerp-outlook-plugin/chilkat.py
index cc515f98959..14e9741d09b 100755
--- a/addons/outlook/plugin/openerp-outlook-plugin/chilkat.py
+++ b/addons/outlook/plugin/openerp-outlook-plugin/chilkat.py
@@ -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)
diff --git a/addons/outlook/plugin/openerp-outlook-plugin/dialogs/__init__.py b/addons/outlook/plugin/openerp-outlook-plugin/dialogs/__init__.py
index 535fe1cb58e..3b3d8973497 100755
--- a/addons/outlook/plugin/openerp-outlook-plugin/dialogs/__init__.py
+++ b/addons/outlook/plugin/openerp-outlook-plugin/dialogs/__init__.py
@@ -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
diff --git a/addons/outlook/plugin/openerp-outlook-plugin/dialogs/dialog_map.py b/addons/outlook/plugin/openerp-outlook-plugin/dialogs/dialog_map.py
index 1583ec7a458..455f447af06 100755
--- a/addons/outlook/plugin/openerp-outlook-plugin/dialogs/dialog_map.py
+++ b/addons/outlook/plugin/openerp-outlook-plugin/dialogs/dialog_map.py
@@ -1,1412 +1,1427 @@
- #!/usr/bin/python
- #-*- encoding: utf-8 -*-
-
-from processors import *
-from opt_processors import *
-import sys
-import os
-import addin
-from dialogs import ShowDialog, MakePropertyPage
-import win32ui
-import commctrl
-import win32con
-import win32gui
-import win32gui_struct
-import xmlrpclib
-from manager import ustr
-import chilkat
-
-try:
- enumerate
-except NameError: # enumerate new in 2.3
- def enumerate(seq):
- return [(i, seq[i]) for i in xrange(len(seq))]
-
-BIF_NEWDIALOGSTYLE = 0x00000040
-BIF_NONEWFOLDERBUTTON = 0x0000200
-CSIDL_COMMONMYPICTURES = 0x00000036
-
-class _WIN32MASKEDSTRUCT:
- def __init__(self, **kw):
- full_fmt = ""
- for name, fmt, default, mask in self._struct_items_:
- self.__dict__[name] = None
- if fmt == "z":
- full_fmt += "pi"
- else:
- full_fmt += fmt
- for name, val in kw.iteritems():
- if name not in self.__dict__:
- raise ValueError("LVITEM structures do not have an item '%s'" % (name,))
- self.__dict__[name] = val
-
- def __setattr__(self, attr, val):
- if not attr.startswith("_") and attr not in self.__dict__:
- raise AttributeError(attr)
- self.__dict__[attr] = val
-
- def toparam(self):
- self._buffs = []
- full_fmt = ""
- vals = []
- mask = 0
- # calc the mask
- for name, fmt, default, this_mask in self._struct_items_:
- if this_mask is not None and self.__dict__.get(name) is not None:
- mask |= this_mask
- self.mask = mask
- for name, fmt, default, this_mask in self._struct_items_:
- val = self.__dict__[name]
- if fmt == "z":
- fmt = "Pi"
- if val is None:
- vals.append(0)
- vals.append(0)
- else:
- # Note this demo still works with byte strings. An
- # alternate strategy would be to use unicode natively
- # and use the 'W' version of the messages - eg,
- # LVM_SETITEMW etc.
- val = val + "\0"
- if isinstance(val, unicode):
- val = val.encode("mbcs")
- str_buf = array.array("b", val)
- vals.append(str_buf.buffer_info()[0])
- vals.append(len(val))
- self._buffs.append(str_buf) # keep alive during the call.
- else:
- if val is None:
- val = default
- vals.append(val)
- full_fmt += fmt
- return struct.pack(*(full_fmt,) + tuple(vals))
-
-
-# NOTE: See the win32gui_struct module for an alternative way of dealing
-# with these structures
-class LVITEM(_WIN32MASKEDSTRUCT):
- _struct_items_ = [
- ("mask", "I", 0, None),
- ("iItem", "i", 0, None),
- ("iSubItem", "i", 0, None),
- ("state", "I", 0, commctrl.LVIF_STATE),
- ("stateMask", "I", 0, None),
- ("text", "z", None, commctrl.LVIF_TEXT),
- ("iImage", "i", 0, commctrl.LVIF_IMAGE),
- ("lParam", "i", 0, commctrl.LVIF_PARAM),
- ("iIdent", "i", 0, None),
- ("cchTextMax", "i", 0, 255),
- ("pszText", "i", 0, None),
- ("flags", "i", 0, None),
- ]
-
-class LVCOLUMN(_WIN32MASKEDSTRUCT):
- _struct_items_ = [
- ("mask", "I", 0, None),
- ("fmt", "i", 0, commctrl.LVCF_FMT),
- ("cx", "i", 0, commctrl.LVCF_WIDTH),
- ("text", "z", None, commctrl.LVCF_TEXT),
- ("iSubItem", "i", 0, commctrl.LVCF_SUBITEM),
- ("iImage", "i", 0, commctrl.LVCF_IMAGE),
- ("iOrder", "i", 0, commctrl.LVCF_ORDER),
- ]
-
-global flag_stop
-flag_stop=win32con.MB_ICONSTOP
-
-global flag_error
-flag_error=win32con.MB_ICONERROR
-
-global flag_info
-flag_info=win32con.MB_ICONINFORMATION
-
-global flag_excl
-flag_excl=win32con.MB_ICONEXCLAMATION
-
-#global NewConn
-NewConn=addin.GetConn()
-## Retrieves current registered XMLRPC connection
-def GetConn():
- return NewConn
-
-global objects_with_match
-objects_with_match=[]
-
-global hwndChk_list
-hwndChk_list=[]
-
-global search_text
-search_text='search_text'
-
-global name
-name=''
-global email
-email=''
-
-def check():
- server = NewConn.getitem('_server')
- port = NewConn.getitem('_port')
- NewConn.GetDBList()
- if str(NewConn.getitem('_running')) == 'False':
- win32ui.MessageBox("No server running on host "+ server+" at port "+str(port), "Server Connection", flag_excl)
- return False
- if str(NewConn.getitem('_login')) == 'False':
- win32ui.MessageBox("Please login to the database first", "Database Connection", flag_excl)
- return False
- return True
-def resetConnAttribs(window):
- config = window.manager.LoadConfig()
- NewConn.setitem('_server', config['server'])
- NewConn.setitem('_port', config['port'])
- NewConn.setitem('protocol', config['protocol'])
- NewConn.setitem('_uri', "http://" + config['server'] + ":" + str(config['port']))
- NewConn.setitem('_obj_list', config['objects'])
- NewConn.setitem('_dbname', config['database'])
- NewConn.setitem('_uname', config['uname'])
- NewConn.setitem('_pwd', config['pwd'])
- NewConn.setitem('_login', str(config['login']))
- return
-
-def setConnAttribs(server, port, manager):
- protocol = NewConn.getitem('protocol')
- if protocol=='XML-RPCS':
- protocol='https://'
- else:
- protocol='http://'
- uri = protocol + server + ":" + str(port)
- NewConn.setitem('_server',server)
- NewConn.setitem('_port',port)
- NewConn.setitem('_uri',uri)
- NewConn.GetDBList()
- manager.config = manager.LoadConfig()
- NewConn.setitem('_dbname',manager.config['database'])
- NewConn.setitem('_uname', manager.config['uname'])
- NewConn.setitem('_pwd', manager.config['pwd'])
- NewConn.setitem('_login', str(manager.config['login']))
- NewConn.setitem('_obj_list', manager.config['objects'])
- return
-
-def getConnAttributes(manager):
- manager.config['server'] = NewConn.getitem('_server')
- manager.config['port'] = NewConn.getitem('_port')
- manager.config['protocol'] = NewConn.getitem('protocol')
- manager.config['objects'] = eval(NewConn.getitem('_obj_list'))
- manager.config['database'] = NewConn.getitem('_dbname')
- manager.config['uname'] = NewConn.getitem('_uname')
- manager.config['pwd'] = NewConn.getitem('_pwd')
- manager.config['login'] = NewConn.getitem('_login')
- return
-
-def getMessage(e):
- import pywintypes
- print "Exception %s: %s"%(type(e),str(e))
- msg = str(e)
- if type(e) == pywintypes.com_error:
- msg=str(e)
- elif type(e) == xmlrpclib.Fault:
- msg = str(e.faultCode) or e.faultString or e.message or str(e)
- else:
- if hasattr(e, 'faultCode') and e.faultCode:
- msg = str(e.faultCode)
- elif hasattr(e, 'faultString') and e.faultString:
- msg = e.faultString
- elif hasattr(e, 'message') and e.message:
- msg = e.message
- return msg
-
-class OKButtonProcessor(ButtonProcessor):
- def __init__(self, window, control_ids):
- self.mngr = window.manager
- ControlProcessor.__init__(self, window, control_ids)
-
- def OnClicked(self, id):
- server = win32gui.GetDlgItemText(self.window.hwnd, self.other_ids[0])
- try:
- port = int(win32gui.GetDlgItemText(self.window.hwnd, self.other_ids[1]))
- except ValueError, e:
- print "Exception : %s"%str(e)
- win32ui.MessageBox("Port should be an integer", "Error", flag_excl)
- return
- except Exception,e:
- msg = getMessage(e)
- win32ui.MessageBox(msg, "Error", flag_excl)
- return
- setConnAttribs(server, port, self.mngr)
- if str(NewConn.getitem('_running')) == 'False':
- msg = "No server running on host '%s' at port '%d'. Press ignore to still continue with this configuration?"%(server,port)
- r=win32ui.MessageBox(msg, "Server Connection", win32con.MB_ABORTRETRYIGNORE | win32con.MB_ICONQUESTION)
- if r==3:
- resetConnAttribs(self.window)
- return
- elif r==4:
- self.OnClicked(id)
- elif r==5:
- setConnAttribs(server, port, self.mngr)
- win32gui.EndDialog(self.window.hwnd, id)
-
-class DoneButtonProcessor(ButtonProcessor):
- def OnClicked(self, id):
- getConnAttributes(self.window.manager)
- self.window.manager.SaveConfig()
- win32gui.EndDialog(self.window.hwnd, id)
-
-class MessageProcessor(ControlProcessor):
- def Init(self):
- text = "This Outlook Plugin for OpenERP s.a. has been developed by TinyERP \n\n \
- For more information, please visit our website \n \
- http://www.openerp.com \n\n \
- Contact Us :\n \
- sales@openerp.com \n\n \
- 2001-TODAY OpenERP s.a.. All rights reserved. \n"
- win32gui.SendMessage(self.GetControl(), win32con.WM_SETTEXT, 0, text)
-
- def GetPopupHelpText(self, cid):
- return "Displays details on this plugin"
-
-class TabProcessor(ControlProcessor):
- def __init__(self, window, control_ids, page_ids):
- ControlProcessor.__init__(self, window, control_ids)
- self.page_ids = page_ids.split()
-
- def Init(self):
- self.pages = {}
- self.currentPage = None
- self.currentPageIndex = -1
- self.currentPageHwnd = None
- for index, page_id in enumerate(self.page_ids):
- template = self.window.manager.dialog_parser.dialogs[page_id]
- self.addPage(index, page_id, template[0][0])
- server = self.window.manager.config['server']
- port = self.window.manager.config['port']
- setConnAttribs(server, port, self.window.manager)
- self.switchToPage(0)
-
- def Done(self):
- if self.currentPageHwnd is not None:
- if not self.currentPage.SaveAllControls():
- win32gui.SendMessage(self.GetControl(), commctrl.TCM_SETCURSEL, self.currentPageIndex,0)
- return False
- return True
-
- def OnNotify(self, nmhdr, wparam, lparam):
- selChangedCode = 5177342
- code = nmhdr[2]
- if code==selChangedCode:
- index = win32gui.SendMessage(self.GetControl(), commctrl.TCM_GETCURSEL, 0,0)
- if index!=self.currentPageIndex:
- self.switchToPage(index)
-
- def switchToPage(self, index):
- if self.currentPageHwnd is not None:
- if not self.currentPage.SaveAllControls():
- win32gui.SendMessage(self.GetControl(), commctrl.TCM_SETCURSEL, self.currentPageIndex,0)
- return 1
- win32gui.DestroyWindow(self.currentPageHwnd)
- self.currentPage = MakePropertyPage(self.GetControl(), self.window.manager, self.window.config, self.pages[index])
- self.currentPageHwnd = self.currentPage.CreateWindow()
- self.currentPageIndex = index
- return 0
-#
- def addPage(self, item, idName, label):
- format = "iiiiiii"
- lbuf = win32gui.PyMakeBuffer(len(label)+1)
- address,l = win32gui.PyGetBufferAddressAndLen(lbuf)
- win32gui.PySetString(address, label)
-
- buf = struct.pack(format,
- commctrl.TCIF_TEXT, # mask
- 0, # state
- 0, # state mask
- address,
- 0, #unused
- 0, #image
- item
- )
- item = win32gui.SendMessage(self.GetControl(),
- commctrl.TCM_INSERTITEM,
- item,
- buf)
- self.pages[item] = idName
-
-class DialogCommand(ButtonProcessor):
- def __init__(self, window, control_ids, idd, func=None, args=()):
- self.idd = idd
- self.func = func
- self.args = args
- ButtonProcessor.__init__(self, window, control_ids)
-
- def OnClicked(self, id):
- self.id = id
- if self.func:
- args = (self, ) + self.args
- self.func(*args)
- parent = self.window.hwnd
- self.window.SaveAllControls()
- ShowDialog(parent, self.window.manager, self.window.config, self.idd)
- self.window.LoadAllControls()
-
- def GetPopupHelpText(self, id):
- dd = self.window.manager.dialog_parser.dialogs[self.idd]
- return "Displays the %s dialog" % dd.caption
-
-def ReloadAllControls(btnProcessor,*args):
- server = NewConn.getitem('_server')
- port = NewConn.getitem('_port')
- btnProcessor.window.LoadAllControls()
- if str(NewConn.getitem('_running')) == 'False':
- win32ui.MessageBox("No server running on host "+ server+" at port "+str(port), "Server Connection", flag_excl)
- return
-
-def TestConnection(btnProcessor,*args):
- server = NewConn.getitem('_server')
- port = NewConn.getitem('_port')
- url = NewConn.getitem('_uri')
- NewConn.GetDBList()
- if str(NewConn.getitem('_running')) == 'False':
- btnProcessor.window.LoadAllControls()
- win32ui.MessageBox("No server running on host "+ server+" at port "+str(port), "OpenERP Connection", flag_excl)
- return
- try:
- dbname = win32gui.GetDlgItemText(btnProcessor.window.hwnd, 7000)
- if not dbname:
- win32ui.MessageBox("Authentication Error !\nBad Database Name !", "OpenERP Connection", flag_excl)
- return
- except Exception,e:
- print "Exception %s: %s"%(type(e),str(e))
- dbname = win32gui.GetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[0])
- if not dbname:
- win32ui.MessageBox("No database found on host "+ server+" at port "+str(port), "OpenERP Connection", flag_excl)
- return
-
- uname = win32gui.GetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[1])
- pwd = win32gui.GetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[2])
-
- if not uname:
- win32ui.MessageBox("Authentication Error !\nBad User Name !", "OpenERP Connection", flag_excl)
- return
- if not pwd:
- win32ui.MessageBox("Authentication Error !\nBad Password !", "OpenERP Connection", flag_excl)
- return
-
- #Establish Connection
- try:
- uid = NewConn.login(dbname, uname, pwd)
- if uid:
- msg = "Connection Successful"
- NewConn.setitem('_login', 'True')
- NewConn.setitem('_uname', uname)
- NewConn.setitem('_pwd', pwd)
- NewConn.setitem('_uid', uid)
- flag = flag_info
- if not NewConn.IsCRMInstalled():
- msg+= '\n\n'+" 'CRM' module is not installed. So CRM cases cannot be created."
- NewConn.setitem('_iscrm', 'False')
- else:
- NewConn.setitem('_iscrm', 'True')
- else:
- msg = "Authentication Error !\nBad UserName or Password"
- flag = flag_stop
- NewConn.setitem('_login', 'False')
- except Exception,e:
- msg = "Authentication Error !\n\n" + getMessage(e)
- flag = flag_error
- win32ui.MessageBox(msg, "OpenERP Connection", flag)
- return
-
-def BrowseCallbackProc(hwnd, msg, lp, data):
- from win32com.shell import shell, shellcon
- if msg== shellcon.BFFM_INITIALIZED:
- win32gui.SendMessage(hwnd, shellcon.BFFM_SETSELECTION, 1, data)
- win32gui.SendMessage(hwnd, shellcon.BFFM_ENABLEOK, 0, 0)
- elif msg == shellcon.BFFM_SELCHANGED:
- # Set the status text of the
- # For this message, 'lp' is the address of the PIDL.
- pidl = shell.AddressAsPIDL(lp)
- try:
- path = shell.SHGetPathFromIDList(pidl)
- if os.path.isdir(path):
- win32gui.SendMessage(hwnd, shellcon.BFFM_ENABLEOK, 0, 0)
- else:
- ext = path.split('.')[-1]
- if ext not in ['gif', 'bmp', 'jpg', 'tif', 'ico', 'png']:
- win32gui.SendMessage(hwnd, shellcon.BFFM_ENABLEOK, 0, 0)
-
- else:
- win32gui.SendMessage(hwnd, shellcon.BFFM_ENABLEOK, 0, 1)
- except shell.error:
- # No path for this PIDL
- pass
-
-def GetImagePath(btnProcessor,*args):
- from win32com.shell import shell, shellcon
- ulFlags = shellcon.BIF_BROWSEINCLUDEFILES | BIF_NEWDIALOGSTYLE | BIF_NONEWFOLDERBUTTON
- pidl, display_name, image_list=shell.SHBrowseForFolder(btnProcessor.window.hwnd, # parent HWND
- None, # root PIDL.
- "Get the image path", # title
- ulFlags, # flags
- BrowseCallbackProc, # callback function
- os.getcwd() # 'data' param for the callback
- )
- if (pidl, display_name, image_list) == (None, None, None):
- return
- else:
- path = shell.SHGetPathFromIDList (pidl)
- win32gui.SetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[0], path)
-
-def AddNewObject(btnProcessor,*args):
- #Check if server running or user logged in
- b = check()
- if not b:
- return
-
- #Check if title or object not specified
- obj_title = win32gui.GetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[0])
- obj_name = win32gui.GetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[1])
- if not obj_title:
- win32ui.MessageBox("No Title specified", "Documents Setting", flag_excl)
- return
- if not obj_name:
- win32ui.MessageBox("No Document specified", "Documents Setting", flag_excl)
- return
-
- #Check if object does not exist in the database or it already exist in the list
- try:
- all_obj_list = NewConn.GetAllObjects()
- curr_obj_list = [obj[1] for obj in NewConn.GetObjList()]
- curr_title_list = [obj[0] for obj in NewConn.GetObjList()]
- if obj_name not in all_obj_list:
- win32ui.MessageBox("No such Document exists", "Documents Setting", flag_excl)
- return
- elif obj_name in curr_obj_list:
- win32ui.MessageBox("Document already in the list", "Documents Setting", flag_info)
- return
- elif obj_title in curr_title_list:
- win32ui.MessageBox("Title already in the list. Please give different title", "Documents Setting", flag_excl)
- return
-
- #extract image path and load the image
- image_path=''
- image_path = os.path.join(btnProcessor.window.manager.application_directory, "dialogs\\resources\\openerp_logo1.bmp")
- path=win32gui.GetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[2])
- if path:
- image_path = path
- load_bmp_flags=win32con.LR_LOADFROMFILE | win32con.LR_LOADTRANSPARENT
- try:
- hicon = win32gui.LoadImage(0, image_path,win32con.IMAGE_BITMAP, 40, 40, load_bmp_flags)
- except Exception,e:
- msg=getMessage(e)
- hicon=None
- win32ui.MessageBox(msg, "Load Image", flag_error)
-
- #Add the object in the list
- win32gui.ImageList_Add(il,hicon,0)
- cnt = win32gui.ImageList_GetImageCount(il)
-
- hwndList = win32gui.GetDlgItem(btnProcessor.window.hwnd, btnProcessor.other_ids[3])
- num_items = win32gui.SendMessage(hwndList, commctrl.LVM_GETITEMCOUNT)
-
- item = LVITEM(text=obj_title, iImage=cnt-2, iItem = num_items)
- new_index = win32gui.SendMessage(hwndList, commctrl.LVM_INSERTITEM, 0, item.toparam())
-
- win32gui.SendMessage(hwndList, commctrl.LVM_SETIMAGELIST, commctrl.LVSIL_SMALL, il)
-
- item = LVITEM(text=obj_name, iItem = new_index, iSubItem = 1)
- win32gui.SendMessage(hwndList, commctrl.LVM_SETITEM, 0, item.toparam())
-
- NewConn.InsertObj(obj_title,obj_name,image_path)
- except Exception, e:
- msg = "Document not added\n\n" + getMessage(e)
- win32ui.MessageBox(msg,"Documents Setting",flag_excl)
- return
-
- #Empty all the text controls
- win32gui.SetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[0], '')
- win32gui.SetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[1], '')
- win32gui.SetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[2], '')
-
-def DeleteSelectedObjects(btnProcessor,*args):
- #Check if server running or user logged in
- b = check()
- if not b:
- return
-
- #Delete selected items
- hwndList = win32gui.GetDlgItem(btnProcessor.window.hwnd, btnProcessor.other_ids[0])
- sel_count = win32gui.SendMessage(hwndList, commctrl.LVM_GETSELECTEDCOUNT)
- for i in range(0,sel_count):
- sel = win32gui.SendMessage(hwndList, commctrl.LVM_GETNEXTITEM, -1, commctrl.LVNI_SELECTED)
- buf,extra = win32gui_struct.EmptyLVITEM(1, 0)
- r = win32gui.SendMessage(hwndList, commctrl.LVM_GETITEMTEXT, sel, buf)
- sel_text = ''
- for n in extra:
- nombre = n.tostring()
- sel_text = nombre[0:r]
- s = win32gui.SendMessage(hwndList, commctrl.LVM_DELETEITEM, sel)
- try:
- NewConn.DeleteObject(sel_text)
- except Exception,e:
- msg = "Documents '%s' not deleted\n\n"%sel_text + getMessage(e)
- win32ui.MessageBox(msg,"Documents Setting",flag_excl)
-
-def GetMail(processor):
- ex = processor.window.manager.outlook.ActiveExplorer()
- assert ex.Selection.Count == 1
- mail = ex.Selection.Item(1)
- return mail
-#get selected records from list
-def GetSelectedItems(hwndList):
- r=[]
- sel_count = win32gui.SendMessage(hwndList, commctrl.LVM_GETSELECTEDCOUNT)
- sel=-1
- for i in range(0,sel_count):
- sel = win32gui.SendMessage(hwndList, commctrl.LVM_GETNEXTITEM, sel, commctrl.LVNI_SELECTED)
- buf,extra = win32gui_struct.EmptyLVITEM(1, 0)
- size = win32gui.SendMessage(hwndList, commctrl.LVM_GETITEMTEXT, sel, buf)
- sel_text = ''
- for n in extra:
- nombre = n.tostring()
- sel_text = nombre[0:size]
- for item in objects_with_match:
- if item[2] == sel_text:
- r.append(item)
- return r
-
-def MakeAttachment(btnProcessor,*args):
- #Check if server running or user logged in
- b = check()
- if not b:
- return
- ex = btnProcessor.window.manager.outlook.ActiveExplorer()
- assert ex.Selection.Count == 1
- mail = ex.Selection.Item(1)
- mail = GetMail(btnProcessor)
-
- #get selected records
- hwndList = win32gui.GetDlgItem(btnProcessor.window.hwnd, btnProcessor.other_ids[0])
- r = GetSelectedItems(hwndList)
- if not r:
- win32ui.MessageBox("No records selected", "Make Attachment", flag_info)
- return
- try:
- flg = NewConn.ArchiveToOpenERP(r,mail)
- if flg:
- win32gui.EndDialog(btnProcessor.window.hwnd, btnProcessor.other_ids[1])
- return
- except Exception,e:
- msg = "Attachment not created \n\n" + getMessage(e)
- flag = flag_error
- win32ui.MessageBox(msg, "Make Attachment", flag)
- return
-
-def CreateCase(btnProcessor,*args):
- try:
- #Check if server running or user logged in
- b = check()
- if not b:
- return
-
- if str(NewConn.getitem('_iscrm')) == 'True':
- # Get the selected mail
- ex = btnProcessor.window.manager.outlook.ActiveExplorer()
- assert ex.Selection.Count == 1
- mail = ex.Selection.Item(1)
- section = win32gui.GetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[0])
- section = str(section)
- section=section.lower().replace(' ','.')
- if not section:
- win32ui.MessageBox("Documents can not be created.", "Documents Setting", flag_excl)
- return
-
- hwndList = win32gui.GetDlgItem(btnProcessor.window.hwnd, btnProcessor.other_ids[1])
- partner_ids=[]
- r = GetSelectedItems(hwndList)
- for rec in r:
- if rec[0] == 'res.partner':
- partner_ids.append(rec[1])
-
- #Create new case
- try:
-
-# if mail.Attachments.Count > 0:
-# msg="The mail contains attachments. Do you want to create case with attachments?"
-# r=win32ui.MessageBox(msg, "Create Case", win32con.MB_YESNOCANCEL | win32con.MB_ICONQUESTION)
-# if r == 2:
-# return
-# elif r == 7:
-# with_attachments=False
-
- NewConn.CreateCase(str(section), mail, partner_ids)
- msg="New Document created."
- flag=flag_info
- except Exception,e:
- msg="New Document not created \n\n"+str(e)
- flag=flag_error
- win32ui.MessageBox(msg, "Create Document", flag)
- return
- else:
- win32ui.MessageBox("Document can not be created. CRM not installed", "Create Object", flag_info)
- except Exception, e:
- win32ui.MessageBox(str(e), 'New Document')
-
-def GetSearchText(txtProcessor,*args):
- #Check if server running or user logged in
- b = check()
- if not b:
- return
-
- search_box = txtProcessor.GetControl()
- global search_text
- if txtProcessor.init_done:
- win32gui.SendMessage(search_box, win32con.WM_SETTEXT, 0,search_text)
- return
-
- # Get the selected mail and set the default value for search_text_control to mail.SenderEmailAddress
- ex = txtProcessor.window.manager.outlook.ActiveExplorer()
- assert ex.Selection.Count == 1
- mail = ex.Selection.Item(1)
- try:
- search_text = ustr(mail.SenderEmailAddress).encode('iso-8859-1')
- except Exception,e:
- pass
- win32gui.SendMessage(search_box, win32con.WM_SETTEXT, 0, search_text)
- txtProcessor.init_done=True
-
-def SetNameColumn(listProcessor,*args):
- hwndList = listProcessor.GetControl()
- child_ex_style = win32gui.SendMessage(hwndList, commctrl.LVM_GETEXTENDEDLISTVIEWSTYLE, 0, 0)
- child_ex_style |= commctrl.LVS_EX_FULLROWSELECT
- win32gui.SendMessage(hwndList, commctrl.LVM_SETEXTENDEDLISTVIEWSTYLE, 0, child_ex_style)
-
- # set header row
- lvc = LVCOLUMN(
- mask = commctrl.LVCF_FMT | commctrl.LVCF_WIDTH | \
- commctrl.LVCF_TEXT | commctrl.LVCF_SUBITEM
- )
- lvc.fmt = commctrl.LVCFMT_LEFT
- lvc.iSubItem = 1
- lvc.text = "Document Type"
- lvc.cx = 100
- win32gui.SendMessage(hwndList, commctrl.LVM_INSERTCOLUMN, 0, lvc.toparam())
- lvc.iSubItem = 0
- lvc.text = "Name"
- lvc.cx = 240
- win32gui.SendMessage(hwndList, commctrl.LVM_INSERTCOLUMN, 0, lvc.toparam())
- listProcessor.init_done = True
-
-def setList(list_hwnd):
- # Set default list of objects
- win32gui.SendMessage(list_hwnd, commctrl.LVM_DELETEALLITEMS)
- for obj in objects_with_match:
- num_items = win32gui.SendMessage(list_hwnd, commctrl.LVM_GETITEMCOUNT)
- item = LVITEM(text=obj[2],iItem = num_items)
- new = win32gui.SendMessage(list_hwnd, commctrl.LVM_INSERTITEM, 0, item.toparam())
- item = LVITEM(text=obj[3],iItem = new, iSubItem = 1)
- win32gui.SendMessage(list_hwnd, commctrl.LVM_SETITEM, 0, item.toparam())
-
-def SearchObjectsForText(btnProcessor,*args):
- #Check if server running or user logged in
- b = check()
- if not b:
- return
-
- search_txt = win32gui.GetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[0])
- if not search_txt:
- win32ui.MessageBox("Enter text to search for", "Archive to OpenERP", flag_info)
- return
- # Get titles from list
- obj_titles=[]
- for ch in hwndChk_list:
- id = ch[0]
- hwnd = ch[1]
- chk = win32gui.SendMessage(hwnd, win32con.BM_GETCHECK)
- if chk:
- txt = win32gui.GetDlgItemText(btnProcessor.window.hwnd,id)
- obj_titles.append(txt)
-
- # Prepare list of objects to search for the seach_keyword
- obj_list = btnProcessor.window.manager.config['objects']
- search_list = []
- try:
- all_obj_list = NewConn.GetAllObjects()
- for title in obj_titles:
- objname = [obj[1] for obj in obj_list if obj[0] == title]
- if objname:
- assert len(objname) == 1
- if objname[0] in all_obj_list:
- search_list.append(objname[0])
- else:
- win32ui.MessageBox("Module %s (%s) not installed. Please install it." \
- %(title,objname[0]), "Archive to OpenERP", flag_excl)
- return
-
- # Get the records by searching the objects in search_list for the search_keyword as objects_with_match
- global objects_with_match
- list_hwnd = win32gui.GetDlgItem(btnProcessor.window.hwnd, btnProcessor.other_ids[1])
- if search_list:
- objects_with_match = NewConn.GetObjectItems(search_list, search_txt)
- if not objects_with_match:
- win32ui.MessageBox("No matching records found in checked objects", "Archive to OpenERP", flag_info)
- else:
- win32ui.MessageBox("No object selected", "Archive to OpenERP", flag_info)
- objects_with_match=[]
- # Display the objects_with_match records in list
- setList(list_hwnd)
- except Exception,e:
- msg=getMessage(e)
- win32ui.MessageBox(msg, "Search Text", flag_error)
-
-def CreateContact(btnProcessor,*args):
- b = check()
- if not b:
- return
-
- partner = win32gui.GetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[9])
- combo = win32gui.GetDlgItem(btnProcessor.window.hwnd, btnProcessor.other_ids[9])
- sel = win32gui.SendMessage(combo, win32con.CB_GETCURSEL)
- state_combo = win32gui.GetDlgItem(btnProcessor.window.hwnd, btnProcessor.other_ids[10])
- state_sel = win32gui.SendMessage(state_combo, win32con.CB_GETCURSEL)
- coun_combo = win32gui.GetDlgItem(btnProcessor.window.hwnd, btnProcessor.other_ids[11])
- country_sel = win32gui.SendMessage(coun_combo, win32con.CB_GETCURSEL)
- name = win32gui.GetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[0])
- email = win32gui.GetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[1])
- office_no = win32gui.GetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[2])
- mobile_no = win32gui.GetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[3])
- fax = win32gui.GetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[4])
- street = win32gui.GetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[5])
- street2 = win32gui.GetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[6])
- city = win32gui.GetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[7])
- zip = win32gui.GetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[8])
- if not name:
- win32ui.MessageBox("Please enter name.", "Create Contact", flag_stop)
- return
-
- res = {
- 'name':ustr(name),
- 'email':ustr(email),
- 'phone':ustr(office_no),
- 'mobile':ustr(mobile_no),
- 'fax':ustr(fax),
- 'street':ustr(street),
- 'street2':ustr(street2),
- 'city':ustr(city),
- 'zip':ustr(zip)
- }
-
- fs_id = c_id = -1
- if not state_sel == -1 :
- try:
- temp = NewConn.GetAllState()
- i = -1
- for t in temp:
- i+=1
- if i == state_sel:
- fs_id = t[0]
- break;
- res ['state_id'] = fs_id
- except Exception, e:
- msg = getMessage(e)
- win32ui.MessageBox(msg, "New Partner", flag_error)
- pass
- if not country_sel == -1 :
- try:
- temp = NewConn.GetAllCountry()
- i = -1
- for t in temp:
- i+=1
- if i == country_sel:
- c_id = t[0]
- break;
- res ['country_id'] = c_id
- except Exception, e:
- msg = getMessage(e)
- win32ui.MessageBox(msg, "Open Contact", flag_error)
- pass
- try:
- id = NewConn.CreateContact(sel, str(res))
- if not partner:
- msg="New contact created."
- else:
- msg="New contact created for partner '%s'."%partner
- except Exception,e:
- msg="Contact not created \n\n" + getMessage(e)
- win32ui.MessageBox(msg, "Create Contact", flag_error)
- return
- win32ui.MessageBox(msg, "Create Contact", flag_info)
- for i in range(0,9):
- win32gui.SetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[i], '')
- win32gui.SendMessage(combo, win32con.CB_SETCURSEL, -1 )
- win32gui.SendMessage(state_combo, win32con.CB_SETCURSEL, -1 )
- win32gui.SendMessage(coun_combo, win32con.CB_SETCURSEL, -1 )
-
-def SetAllText(txtProcessor,*args):
- # Set values for url, uname, pwd from config file
- url = NewConn.getitem('_uri')
- tbox = txtProcessor.GetControl()
- win32gui.SendMessage(tbox, win32con.WM_SETTEXT, 0, str(url))
- k=win32gui.GetDlgItemText(txtProcessor.window.hwnd, txtProcessor.control_id)
- uname = NewConn.getitem('_uname')
- tbox = txtProcessor.GetControl(txtProcessor.other_ids[0])
- win32gui.SendMessage(tbox, win32con.WM_SETTEXT, 0, str(uname))
-
-def SetDefaultList(listProcessor,*args):
- import win32api
- hwndList = listProcessor.GetControl()
-
- # set full row select style
- child_ex_style = win32gui.SendMessage(hwndList, commctrl.LVM_GETEXTENDEDLISTVIEWSTYLE, 0, 0)
- child_ex_style |= commctrl.LVS_EX_FULLROWSELECT
- win32gui.SendMessage(hwndList, commctrl.LVM_SETEXTENDEDLISTVIEWSTYLE, 0, child_ex_style)
-
- # set header row
- lvc = LVCOLUMN(
- mask = commctrl.LVCF_FMT | commctrl.LVCF_WIDTH | \
- commctrl.LVCF_TEXT | commctrl.LVCF_SUBITEM
- )
- lvc.fmt = commctrl.LVCFMT_LEFT
- lvc.iSubItem = 1
- lvc.text = "Object Name"
- lvc.cx = 315
- win32gui.SendMessage(hwndList, commctrl.LVM_INSERTCOLUMN, 0, lvc.toparam())
- lvc.iSubItem = 0
- lvc.text = "Document Title"
- lvc.cx = 315
- win32gui.SendMessage(hwndList, commctrl.LVM_INSERTCOLUMN, 0, lvc.toparam())
-
- #create imagelist
- global il
- il = win32gui.ImageList_Create(
- win32api.GetSystemMetrics(win32con.SM_CXSMICON),
- win32api.GetSystemMetrics(win32con.SM_CYSMICON),
- commctrl.ILC_COLOR32 | commctrl.ILC_MASK,
- 1, # initial size
- 0) # cGrow
-
- win32gui.SendMessage(hwndList, commctrl.LVM_SETIMAGELIST,\
- commctrl.LVSIL_SMALL, il)
- # Set objects from config
- objs = eval(NewConn.getitem('_obj_list'))
- load_bmp_flags=win32con.LR_LOADFROMFILE | win32con.LR_LOADTRANSPARENT
- for obj in objs:
- image_path = os.path.join(listProcessor.window.manager.application_directory, "dialogs\\resources\\openerp_logo1.bmp")
- path=obj[2]
- if path:
- image_path = path
- try:
- hicon = win32gui.LoadImage(0, image_path,win32con.IMAGE_BITMAP, 40, 40, load_bmp_flags)
- except Exception, e:
- msg = "Problem loading the image \n\n" + getMessage(e)
- hicon = None
- win32ui.MessageBox(msg, "Load Image", flag_error)
-
- #Add the object in the list
- win32gui.ImageList_Add(il,hicon,0)
- cnt = win32gui.ImageList_GetImageCount(il)
- num_items = win32gui.SendMessage(hwndList, commctrl.LVM_GETITEMCOUNT)
- item = LVITEM(text=obj[0],iImage=cnt-2, iItem = num_items)
- new_index = win32gui.SendMessage(hwndList, commctrl.LVM_INSERTITEM, 0, item.toparam())
- item = LVITEM(text=obj[1], iItem = new_index, iSubItem = 1)
- win32gui.SendMessage(hwndList, commctrl.LVM_SETITEM, 0, item.toparam())
-
-def SetDefaultContact(txtProcessor,*args):
- # Acquiring the control of the text box
- txt_name = txtProcessor.GetControl()
- txt_email = txtProcessor.GetControl(txtProcessor.other_ids[0])
-
- global name
- global email
- if txtProcessor.init_done:
- win32gui.SetDlgItemText(txtProcessor.window.hwnd, txtProcessor.control_id,name)
- win32gui.SetDlgItemText(txtProcessor.window.hwnd, txtProcessor.other_ids[0],email)
- return
- #
- try:
- mail = GetMail(txtProcessor)
- name = ustr(mail.SenderName).encode('iso-8859-1')
- email = ustr(mail.SenderEmailAddress).encode('iso-8859-1')
- except Exception,e:
- pass
-
- fs_combo = win32gui.GetDlgItem(txtProcessor.window.hwnd, txtProcessor.other_ids[1])
- c_combo = win32gui.GetDlgItem(txtProcessor.window.hwnd, txtProcessor.other_ids[2])
- win32gui.SendMessage(fs_combo, win32con.CB_SETCURSEL, -1 )
- win32gui.SendMessage(c_combo, win32con.CB_SETCURSEL, -1 )
- win32gui.SetDlgItemText(txtProcessor.window.hwnd, txtProcessor.control_id,name)
- win32gui.SetDlgItemText(txtProcessor.window.hwnd, txtProcessor.other_ids[0],email)
- txtProcessor.init_done = True
-
-def setCheckList(groupProcessor,*args):
- try:
- child_style = win32con.BS_AUTOCHECKBOX | win32con.WS_TABSTOP
- hinst = win32gui.dllhandle
- objs = groupProcessor.window.manager.config['objects']
- ins_objs = NewConn.GetAllObjects()
- left = 20
- top = 60
- cnt=0
- id=4001
- id1=6001
- load_bmp_flags=win32con.LR_LOADFROMFILE | win32con.LR_LOADTRANSPARENT
- if groupProcessor.init_done:
- return
- else:
- for obj in objs:
- if obj[1] in ins_objs:
- groupProcessor.init_done = True
- #Add image
- hwndImg = win32gui.CreateWindowEx(0, "STATIC","",
- win32con.SS_CENTERIMAGE | win32con.SS_REALSIZEIMAGE | win32con.SS_BITMAP | win32con.WS_CHILD | win32con.WS_VISIBLE,
- left,top+3,13,13,
- groupProcessor.window.hwnd,
- id,
- 0,
- None
- );
- image_path = os.path.join(groupProcessor.window.manager.application_directory, "dialogs\\resources\\openerp_logo1.bmp")
- if obj[2]:
- image_path = obj[2]
- try:
- hicon = win32gui.LoadImage(0, image_path, win32con.IMAGE_BITMAP, 40, 40, load_bmp_flags)
- except Exception,e:
- msg="Problem loading the image \n\n" + getMessage(e)
- hicon = None
- win32ui.MessageBox(msg, "Load Image", flag_error)
-
- win32gui.SendMessage(hwndImg, win32con.STM_SETIMAGE, win32con.IMAGE_BITMAP, hicon);
- #Add Checkbox
- left+= 17
- hwndChk = win32gui.CreateWindowEx(
- 0,"BUTTON",obj[0],win32con.WS_VISIBLE | win32con.WS_CHILD | \
- win32con.BS_AUTOCHECKBOX | win32con.WS_TABSTOP | win32con.BST_CHECKED, \
- left, top, 130,20,groupProcessor.window.hwnd,id1,hinst,None
- )
- if obj[1] in ['res.partner','res.partner.address']:
- win32gui.SendMessage(hwndChk , win32con.BM_SETCHECK, 1, 0);
- hwndChk_list.append((id1,hwndChk))
-
- cnt=cnt+1
- id+=1
- id1+=1
- left+=17
- win32gui.UpdateWindow(hwndImg)
- left+=140
- if cnt > 1:
- left = 20
- top+=18
- cnt=0
- except Exception, e:
- win32ui.MessageBox(str(e), 'Document List')
-
-def CreatePartner(btnProcessor,*args):
- #Check if server running or user logged in
- b = check()
- if not b:
- return
-
- partner_name = win32gui.GetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[0])
- if not partner_name:
- win32ui.MessageBox("Please enter Partner name.", "Create Partner", flag_excl)
- return
- res = {'name':ustr(partner_name)}
- try:
- id = NewConn.CreatePartner(str(res))
- except Exception,e:
- msg="Partner not created \n\n" + getMessage(e)
- win32ui.MessageBox(msg, "Create Partner", flag_error)
- return
- if id:
- win32ui.MessageBox("New Partner '%s' created."%partner_name, "Create Partner", flag_info)
- win32gui.EndDialog(btnProcessor.window.hwnd, btnProcessor.id)
- else:
- win32ui.MessageBox("Partner '%s' already Exists."%partner_name, "Create Partner", flag_info)
- win32gui.SetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[0],'')
-
-def set_search_text(dialogProcessor,*args):
- global search_text
- search_text = win32gui.GetDlgItemText(dialogProcessor.window.hwnd, dialogProcessor.other_ids[0])
- return
-
-def set_name_email(dialogProcessor,*args):
- global name
- global email
- name = win32gui.GetDlgItemText(dialogProcessor.window.hwnd, dialogProcessor.other_ids[0])
- email = win32gui.GetDlgItemText(dialogProcessor.window.hwnd, dialogProcessor.other_ids[1])
-
-def GetDefaultEmail(txtProcessor,*args):
-
- from win32com.client import Dispatch
- import win32con
- b = check()
- if not b:
- return
- #Acquiring control of the text box
- search_partner_box = txtProcessor.GetControl()
- global search_partner_text
- if txtProcessor.init_done:
- win32gui.SendMessage(search_partner_box, win32con.WM_SETTEXT, 0,search_partner_text)
- return
- #Reading Current Selected Email.
- ex = txtProcessor.window.manager.outlook.ActiveExplorer()
- assert ex.Selection.Count == 1
- mail = ex.Selection.Item(1)
- #Fetching Sender MailID from Selected Mail
- try:
- search_partner_text = ustr(mail.SenderEmailAddress).encode('iso-8859-1')
- except Exception,e:
- win32ui.MessageBox("Error In reading email ID from Email ","Open Contact", flag_error)
- pass
- win32gui.SendMessage(search_partner_box, win32con.WM_SETTEXT, 0, search_partner_text)
-
- fs_combo = win32gui.GetDlgItem(txtProcessor.window.hwnd, txtProcessor.other_ids[10])
- c_combo = win32gui.GetDlgItem(txtProcessor.window.hwnd, txtProcessor.other_ids[11])
- partner_combo = win32gui.GetDlgItem(txtProcessor.window.hwnd, txtProcessor.other_ids[0])
- vals = []
- #Searching the res.partner.address for contact based on Sender Mail ID.
- vals = NewConn.SearchPartnerDetail(search_partner_text)
- #If no user Found.
- if vals == None:
- for i in range(1,10):
- win32gui.SetDlgItemText(txtProcessor.window.hwnd, txtProcessor.other_ids[i], "")
- win32gui.SendMessage(fs_combo, win32con.CB_SETCURSEL, -1 )
- win32gui.SendMessage(c_combo, win32con.CB_SETCURSEL, -1 )
- win32gui.SendMessage(partner_combo, win32con.CB_SETCURSEL, -1 )
- win32ui.MessageBox("No matching records found for : "+str(search_partner)+".","Open Contact", flag_excl)
- return
- else:
- #If user Found than Setting the Value for the contact in fields.
- for i in range(1,10):
- win32gui.SetDlgItemText(txtProcessor.window.hwnd, txtProcessor.other_ids[i], "")
- win32gui.SendMessage(fs_combo, win32con.CB_SETCURSEL, -1 )
- win32gui.SendMessage(c_combo, win32con.CB_SETCURSEL, -1 )
- win32gui.SendMessage(partner_combo, win32con.CB_SETCURSEL, -1 )
-
- for val in vals:
-
- if val[0] == 'partner_id':
- temp = list (NewConn.GetPartners())
- i = -1
- for t in temp:
- i+=1
- if t[1] == val[1][1] :
- win32gui.SendMessage(partner_combo, win32con.CB_SETCURSEL, i )
- if val[0] == 'name' and val[1] != False :
- win32gui.SetDlgItemText(txtProcessor.window.hwnd, txtProcessor.other_ids[1], str(val[1]))
-
- if val[0] == 'street' and val[1] != False :
- win32gui.SetDlgItemText(txtProcessor.window.hwnd, txtProcessor.other_ids[2], str(val[1]))
-
- if val[0] == 'street2' and val[1] != False :
- win32gui.SetDlgItemText(txtProcessor.window.hwnd, txtProcessor.other_ids[3], str(val[1]))
-
- if val[0] == 'zip' and val[1] != False :
- win32gui.SetDlgItemText(txtProcessor.window.hwnd, txtProcessor.other_ids[9], str(val[1]))
-
- if val[0] == 'city' and val[1] != False :
- win32gui.SetDlgItemText(txtProcessor.window.hwnd, txtProcessor.other_ids[4], str(val[1]))
-
- if val[0] == 'state_id' and val[1] != False :
- id = i = -1
- temp = list(NewConn.GetAllState())
- for t in temp:
- i+=1
- if str(t[1]) == str(val[1][1]):
- id = i
- break;
- sel = win32gui.SendMessage(fs_combo, win32con.CB_SETCURSEL, id )
-
- if val[0] == 'country_id' and val[1] != False :
- id = i = -1
- temp = list(NewConn.GetAllCountry())
- for t in temp:
- i+=1
- if str(t[1]) == str(val[1][1]):
- id = i
- break;
- sel = win32gui.SendMessage(c_combo, win32con.CB_SETCURSEL, id )
-
- if val[0] == 'phone' and val[1] != False :
- win32gui.SetDlgItemText(txtProcessor.window.hwnd, txtProcessor.other_ids[5], str(val[1]))
-
- if val[0] == 'mobile' and val[1] != False :
- win32gui.SetDlgItemText(txtProcessor.window.hwnd, txtProcessor.other_ids[6], str(val[1]))
-
- if val[0] == 'fax' and val[1] != False :
- win32gui.SetDlgItemText(txtProcessor.window.hwnd, txtProcessor.other_ids[7], str(val[1]))
-
- if val[0] == 'email' and val[1] != False :
- win32gui.SetDlgItemText(txtProcessor.window.hwnd, txtProcessor.other_ids[8], str(val[1]))
-
- txtProcessor.init_done=True
-
-def SearchPartner(btnProcessor,*args):
- b = check()
- if not b:
- return
- #hwnd For the List box
- fs_combo = win32gui.GetDlgItem(btnProcessor.window.hwnd, btnProcessor.other_ids[11])
- c_combo = win32gui.GetDlgItem(btnProcessor.window.hwnd, btnProcessor.other_ids[12])
- partner_combo = win32gui.GetDlgItem(btnProcessor.window.hwnd, btnProcessor.other_ids[1])
- try :
- search_partner = win32gui.GetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[0])
- if not search_partner:
- win32ui.MessageBox("Please enter email id to search for.", "Open Contact", flag_excl)
- return
- vals = []
- #Searching the contact.
- vals = NewConn.SearchPartnerDetail(search_partner)
- #if contact not found resetting all field to blank
- if vals == None:
- for i in range(2,11):
- win32gui.SetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[i], "")
- win32gui.SendMessage(fs_combo, win32con.CB_SETCURSEL, -1 )
- win32gui.SendMessage(c_combo, win32con.CB_SETCURSEL, -1 )
- win32gui.SendMessage(partner_combo, win32con.CB_SETCURSEL, -1 )
- win32ui.MessageBox("No matching records found for : "+str(search_partner)+".","Open Contact", flag_excl)
- win32gui.SetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[0], "<enter new search>")
- return
- #if contact found than setting the values for the contact.
- else:
- for i in range(2,11):
- win32gui.SetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[i], "")
- win32gui.SendMessage(fs_combo, win32con.CB_SETCURSEL, -1 )
- win32gui.SendMessage(c_combo, win32con.CB_SETCURSEL, -1 )
- win32gui.SendMessage(partner_combo, win32con.CB_SETCURSEL, -1 )
- for val in vals:
- if val[0] == 'partner_id':
- #Finding the partner index in list and setting it.
- temp = list (NewConn.GetPartners())
- i = -1
- for t in temp:
- i+=1
- if t[1] == val[1][1] :
- win32gui.SendMessage(partner_combo, win32con.CB_SETCURSEL, i )
-
- if val[0] == 'name' and val[1] != False :
- win32gui.SetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[2], str(val[1]))
-
- if val[0] == 'street' and val[1] != False :
- win32gui.SetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[3], str(val[1]))
-
- if val[0] == 'street2' and val[1] != False :
- win32gui.SetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[4], str(val[1]))
-
- if val[0] == 'zip' and val[1] != False :
- win32gui.SetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[10], str(val[1]))
-
- if val[0] == 'city' and val[1] != False :
- win32gui.SetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[5], str(val[1]))
-
- if val[0] == 'state_id' and val[1] != False :
- #Finding the state index in list and setting it.
- id = i = -1
- temp = list(NewConn.GetAllState())
- for t in temp:
- i+=1
- if str(t[1]) == str(val[1][1]):
- id = i
- break;
- sel = win32gui.SendMessage(fs_combo, win32con.CB_SETCURSEL, id )
-
- if val[0] == 'country_id' and val[1] != False :
- #Finding the country index in list and setting it.
- id = i = -1
- temp = list(NewConn.GetAllCountry())
- for t in temp:
- i+=1
- if str(t[1]) == str(val[1][1]):
- id = i
- break;
- sel = win32gui.SendMessage(c_combo, win32con.CB_SETCURSEL, id )
-
- if val[0] == 'phone' and val[1] != False :
- win32gui.SetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[6], str(val[1]))
-
- if val[0] == 'mobile' and val[1] != False :
- win32gui.SetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[7], str(val[1]))
-
- if val[0] == 'fax' and val[1] != False :
- win32gui.SetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[8], str(val[1]))
-
- if val[0] == 'email' and val[1] != False :
- win32gui.SetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[9], str(val[1]))
-
- win32gui.SetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[0], "<Enter new search>")
- except Exception,e:
- msg = getMessage(e)
- win32ui.MessageBox(msg, "Open Contact", flag_error)
- pass
-
-def WritePartner(btnProcessor,*args):
- new_vals=[]
- #Reading new value of the fields.
- contect_name = win32gui.GetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[1])
- street = win32gui.GetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[2])
- street2 = win32gui.GetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[3])
- city = win32gui.GetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[4])
- phone = win32gui.GetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[7])
- mobile = win32gui.GetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[8])
- fax = win32gui.GetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[9])
- email = win32gui.GetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[10])
- zip = win32gui.GetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[11])
- country_combo = win32gui.GetDlgItem(btnProcessor.window.hwnd, btnProcessor.other_ids[6])
- country_sel = win32gui.SendMessage(country_combo, win32con.CB_GETCURSEL)
- state_combo = win32gui.GetDlgItem(btnProcessor.window.hwnd, btnProcessor.other_ids[5])
- state_sel = win32gui.SendMessage(state_combo, win32con.CB_GETCURSEL)
- partner_combo = win32gui.GetDlgItem(btnProcessor.window.hwnd, btnProcessor.other_ids[0])
- partner_sel = win32gui.SendMessage(partner_combo, win32con.CB_GETCURSEL)
- #Checking that record not being saved without name or Partner
- if contect_name.strip() == "":
- win32ui.MessageBox("Please enter partner Contact Name name.", "Open Contact", flag_excl)
- return
- if partner_sel < 1:
- win32ui.MessageBox("Please Select Partner From list.", "Open Contact", flag_excl)
- return
- fs_id = c_id = p_id = -1
- #Finding the partner index in list finding it record ID.
- if not partner_sel < 0 :
- try:
- temp = NewConn.GetPartners()
- i = -1
- for t in temp:
- i+=1
- if i == partner_sel:
- p_id = t[0]
- break;
- except Exception, e:
- msg = getMessage(e)
- win32ui.MessageBox(msg, "Open Contact", flag_error)
- pass
- #Finding the State index in list finding it record ID.
- if not state_sel == -1 :
- try:
- temp = NewConn.GetAllState()
- i = -1
- for t in temp:
- i+=1
- if i == state_sel:
- fs_id = t[0]
- break;
- except Exception, e:
- msg = getMessage(e)
- win32ui.MessageBox(msg, "Open Contact", flag_error)
- pass
- #Finding the country index in list finding it record ID.
- if not country_sel == -1 :
- try:
- temp = NewConn.GetAllCountry()
- i = -1
- for t in temp:
- i+=1
- if i == country_sel:
- c_id = t[0]
- break;
- except Exception, e:
- msg = getMessage(e)
- win32ui.MessageBox(msg, "Open Contact", flag_error)
- pass
- # Creating a list to write the values to the OpenERP
- new_vals.append(['partner_id',p_id])
- new_vals.append(['name',contect_name])
- new_vals.append(['street',street])
- new_vals.append(['street2',street2])
- new_vals.append(['city',city])
- new_vals.append(['state_id',fs_id])
- new_vals.append(['country_id',c_id])
- new_vals.append(['phone',phone])
- new_vals.append(['mobile',mobile])
- new_vals.append(['email',email])
- new_vals.append(['fax',fax])
- new_vals.append(['zip',zip])
- flag = 0
- try:
- #writing the updated values to the Server.
- flag = NewConn.WritePartnerValues(new_vals)
- except Exception,e:
- msg = getMessage(e)
- win32ui.MessageBox(msg, "Open Contact", flag_error)
- pass
- if flag == 1:
- win32ui.MessageBox("Changes have been Updated Successfully.", "Open Contact", flag_info)
- elif flag == 0:
- win32ui.MessageBox("Error in Updating the Changes.\n Please check the Database Connection.", "Open Contact", flag_error)
- elif flag == -1:
- win32ui.MessageBox("Contact can not be Save.\nFirst select contact using Search.","Open Contact", flag_info)
-
-
-
-dialog_map = {
- "IDD_MANAGER" : (
- (CancelButtonProcessor, "IDCANCEL", resetConnAttribs, ()),
- (TabProcessor, "IDC_TAB IDC_LIST",
- """IDD_GENERAL IDD_OBJECT_SETTINGS IDD_ABOUT"""),
- (DoneButtonProcessor, "ID_DONE"),
- ),
-
- "IDD_GENERAL": (
- (DBComboProcessor, "ID_DB_DROPDOWNLIST", GetConn, ()),
- (TextProcessor, "ID_SERVER_PORT ID_USERNAME ID_PASSWORD", SetAllText, ()),
- (CommandButtonProcessor, "ID_BUT_TESTCONNECTION ID_DB_DROPDOWNLIST ID_USERNAME \
- ID_PASSWORD", TestConnection, ()),
- (CommandButtonProcessor, "IDC_RELOAD", ReloadAllControls, ()),
- (DialogCommand, "IDC_BUT_SET_SERVER_PORT", "IDD_SERVER_PORT_DIALOG"),
- ),
-
- "IDD_OBJECT_SETTINGS" : (
- (CommandButtonProcessor, "IDC_BUT_LOAD_IMAGE IDC_IMAGE_PATH", GetImagePath, ()),
- (CommandButtonProcessor, "IDC_BUT_SAVE_OBJECT IDC_OBJECT_TITLE IDC_OBJECT_NAME \
- IDC_IMAGE_PATH IDC_LIST", AddNewObject, ()),
- (CommandButtonProcessor, "IDC_BUT_DEL_OBJECT IDC_LIST", DeleteSelectedObjects, ()),
- (ListBoxProcessor, "IDC_LIST", SetDefaultList, ())
- ),
-
- "IDD_ABOUT" : (
- (ImageProcessor, "IDB_OPENERPLOGO"),
- (MessageProcessor, "IDC_ABOUT"),
- ),
-
- "IDD_SERVER_PORT_DIALOG" : (
- (CloseButtonProcessor, "IDCANCEL"),
- (OKButtonProcessor, "IDOK ID_SERVER ID_PORT IDR_XML_PROTOCOL"),
- (RadioButtonProcessor, "IDR_XML_PROTOCOL", GetConn, ()),
- (RadioButtonProcessor, "IDR_XMLS_PROTOCOL", GetConn, ()),
- (RadioButtonProcessor, "IDR_NETRPC_PROTOCOL", GetConn, ()),
- ),
-
- "IDD_SYNC" : (
- (CommandButtonProcessor, "ID_SEARCH ID_SEARCH_TEXT IDC_NAME_LIST", SearchObjectsForText,()),
- (GroupProcessor, "IDC_STATIC_GROUP", setCheckList, ()),
- (CSComboProcessor, "ID_ATT_METHOD_DROPDOWNLIST", GetConn,()),
- (TextProcessor, "ID_SEARCH_TEXT", GetSearchText, ()),
- (DialogCommand, "ID_CREATE_CONTACT ID_SEARCH_TEXT", "IDD_NEW_CONTACT_DIALOG", set_search_text, ()),
- (CloseButtonProcessor, "IDCANCEL"),
- (CommandButtonProcessor, "ID_MAKE_ATTACHMENT IDC_NAME_LIST IDD_SYNC", MakeAttachment, ()),
- (CommandButtonProcessor, "ID_CREATE_CASE ID_ATT_METHOD_DROPDOWNLIST IDC_NAME_LIST", CreateCase, ()),
- (ListBoxProcessor, "IDC_NAME_LIST", SetNameColumn, ())
- ),
-
- "IDD_NEW_CONTACT_DIALOG" : (
- (PartnersComboProcessor, "ID_PARTNER_DROPDOWNLIST", GetConn, ()),
- (CountryComboProcessor, "ID_COUNTRY_DROPLIST", GetConn, ()),
- (StateComboProcessor, "ID_FED_STATE_DROPLIST", GetConn, ()),
- (CloseButtonProcessor, "IDCANCEL"),
- (CommandButtonProcessor, "ID_CONTACT_SAVE_BUTTON ID_CONTACT_NAME_TEXT ID_CONTACT_EMAIL_TEXT ID_CONTACT_OFFICE_TEXT ID_CONTACT_MOBILE_TEXT ID_FAX_TEXT ID_STREET_TEXT ID_STREET2_TEXT ID_PARTNER_CITY_TEXT ID_ZIP_TEXT ID_PARTNER_DROPDOWNLIST ID_FED_STATE_DROPLIST ID_COUNTRY_DROPLIST", CreateContact, ()),
- (TextProcessor, "ID_CONTACT_NAME_TEXT ID_CONTACT_EMAIL_TEXT ID_FED_STATE_DROPLIST ID_COUNTRY_DROPLIST" , SetDefaultContact, ()),
- (DialogCommand, "ID_NEW_PARTNER_BUTTON ID_CONTACT_NAME_TEXT ID_CONTACT_EMAIL_TEXT", "IDD_NEW_PARTNER_DIALOG", set_name_email, ()),
- ),
-
- "IDD_NEW_PARTNER_DIALOG" : (
- (CloseButtonProcessor, "IDCANCEL"),
- (CommandButtonProcessor, "ID_SAVE_PARTNER_BUTTON ID_PARTNER_NAME_TEXT", CreatePartner, ()),
- ),
-
- "IDD_VIEW_PARTNER_DIALOG" : (
- (PartnersComboProcessor, "ID_PARTNER_DROPLIST", GetConn, ()),
- (StateComboProcessor, "ID_ALL_STATE_DROPDOWNLIST", GetConn, ()),
- (CountryComboProcessor, "ID_ALL_COUNTRY_DROPDOWNLIST", GetConn, ()),
- (TextProcessor, "IDET_SEARCH_PARTNER ID_PARTNER_DROPLIST IDET_PARTNER_CONTACT_NAME IDET_PARTNER_STREET IDET_PARTNER_STREET2 IDET_PARTNER_CITY IDET_PARTNER_OFFICENO IDET_PARTNER_MOBILENO IDET_PARTNER_EMAIL IDET_PARTNER_FAX IDET_ZIP ID_ALL_STATE_DROPDOWNLIST ID_ALL_COUNTRY_DROPDOWNLIST", GetDefaultEmail, ()),
- (CommandButtonProcessor, "IDPB_SEARCH_PARTNER IDET_SEARCH_PARTNER ID_PARTNER_DROPLIST IDET_PARTNER_CONTACT_NAME IDET_PARTNER_STREET IDET_PARTNER_STREET2 IDET_PARTNER_CITY IDET_PARTNER_OFFICENO IDET_PARTNER_MOBILENO IDET_PARTNER_EMAIL IDET_PARTNER_FAX IDET_ZIP ID_ALL_STATE_DROPDOWNLIST ID_ALL_COUNTRY_DROPDOWNLIST", SearchPartner, ()),
- (CommandButtonProcessor, "IDPB_WRITE_CHANGES ID_PARTNER_DROPLIST IDET_PARTNER_CONTACT_NAME IDET_PARTNER_STREET IDET_PARTNER_STREET2 IDET_PARTNER_CITY ID_ALL_STATE_DROPDOWNLIST ID_ALL_COUNTRY_DROPDOWNLIST IDET_PARTNER_OFFICENO IDET_PARTNER_MOBILENO IDET_PARTNER_EMAIL IDET_PARTNER_FAX IDET_ZIP", WritePartner, ()),
- (CloseButtonProcessor, "IDCANCEL"),
- (DialogCommand, "ID_NEW_PART_BUTTON", "IDD_NEW_PARTNER_DIALOG" ),
- (DialogCommand, "IDPB_NEWPARTNER_BUTTON" , "IDD_NEW_CONTACT_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/>.
+#
+##############################################################################
+
+from processors import *
+from opt_processors import *
+import sys
+import os
+import addin
+from dialogs import ShowDialog, MakePropertyPage
+
+import win32ui
+
+import commctrl
+import win32con
+import win32gui
+
+import win32gui_struct
+import xmlrpclib
+
+from manager import ustr
+
+try:
+ enumerate
+except NameError: # enumerate new in 2.3
+ def enumerate(seq):
+ return [(i, seq[i]) for i in xrange(len(seq))]
+
+BIF_NEWDIALOGSTYLE = 0x00000040
+BIF_NONEWFOLDERBUTTON = 0x0000200
+CSIDL_COMMONMYPICTURES = 0x00000036
+
+class _WIN32MASKEDSTRUCT:
+ def __init__(self, **kw):
+ full_fmt = ""
+ for name, fmt, default, mask in self._struct_items_:
+ self.__dict__[name] = None
+ if fmt == "z":
+ full_fmt += "pi"
+ else:
+ full_fmt += fmt
+ for name, val in kw.iteritems():
+ if name not in self.__dict__:
+ raise ValueError("LVITEM structures do not have an item '%s'" % (name,))
+ self.__dict__[name] = val
+
+ def __setattr__(self, attr, val):
+ if not attr.startswith("_") and attr not in self.__dict__:
+ raise AttributeError(attr)
+ self.__dict__[attr] = val
+
+ def toparam(self):
+ self._buffs = []
+ full_fmt = ""
+ vals = []
+ mask = 0
+ # calc the mask
+ for name, fmt, default, this_mask in self._struct_items_:
+ if this_mask is not None and self.__dict__.get(name) is not None:
+ mask |= this_mask
+ self.mask = mask
+ for name, fmt, default, this_mask in self._struct_items_:
+ val = self.__dict__[name]
+ if fmt == "z":
+ fmt = "Pi"
+ if val is None:
+ vals.append(0)
+ vals.append(0)
+ else:
+ # Note this demo still works with byte strings. An
+ # alternate strategy would be to use unicode natively
+ # and use the 'W' version of the messages - eg,
+ # LVM_SETITEMW etc.
+ val = val + "\0"
+ if isinstance(val, unicode):
+ val = val.encode("mbcs")
+ str_buf = array.array("b", val)
+ vals.append(str_buf.buffer_info()[0])
+ vals.append(len(val))
+ self._buffs.append(str_buf) # keep alive during the call.
+ else:
+ if val is None:
+ val = default
+ vals.append(val)
+ full_fmt += fmt
+ return struct.pack(*(full_fmt,) + tuple(vals))
+
+
+# NOTE: See the win32gui_struct module for an alternative way of dealing
+# with these structures
+class LVITEM(_WIN32MASKEDSTRUCT):
+ _struct_items_ = [
+ ("mask", "I", 0, None),
+ ("iItem", "i", 0, None),
+ ("iSubItem", "i", 0, None),
+ ("state", "I", 0, commctrl.LVIF_STATE),
+ ("stateMask", "I", 0, None),
+ ("text", "z", None, commctrl.LVIF_TEXT),
+ ("iImage", "i", 0, commctrl.LVIF_IMAGE),
+ ("lParam", "i", 0, commctrl.LVIF_PARAM),
+ ("iIdent", "i", 0, None),
+ ("cchTextMax", "i", 0, 255),
+ ("pszText", "i", 0, None),
+ ("flags", "i", 0, None),
+ ]
+
+class LVCOLUMN(_WIN32MASKEDSTRUCT):
+ _struct_items_ = [
+ ("mask", "I", 0, None),
+ ("fmt", "i", 0, commctrl.LVCF_FMT),
+ ("cx", "i", 0, commctrl.LVCF_WIDTH),
+ ("text", "z", None, commctrl.LVCF_TEXT),
+ ("iSubItem", "i", 0, commctrl.LVCF_SUBITEM),
+ ("iImage", "i", 0, commctrl.LVCF_IMAGE),
+ ("iOrder", "i", 0, commctrl.LVCF_ORDER),
+ ]
+
+global flag_stop
+flag_stop=win32con.MB_ICONSTOP
+
+global flag_error
+flag_error=win32con.MB_ICONERROR
+
+global flag_info
+flag_info=win32con.MB_ICONINFORMATION
+
+global flag_excl
+flag_excl=win32con.MB_ICONEXCLAMATION
+
+#global NewConn
+NewConn=addin.GetConn()
+## Retrieves current registered XMLRPC connection
+def GetConn():
+ return NewConn
+
+global objects_with_match
+objects_with_match=[]
+
+global hwndChk_list
+hwndChk_list=[]
+
+global search_text
+search_text='search_text'
+
+global name
+name=''
+global email
+email=''
+
+def check():
+ server = NewConn.getitem('_server')
+ port = NewConn.getitem('_port')
+ NewConn.GetDBList()
+ if str(NewConn.getitem('_running')) == 'False':
+ win32ui.MessageBox("No server running on host "+ server+" at port "+str(port), "OpenERP Connection", flag_excl)
+ return False
+ if str(NewConn.getitem('_login')) == 'False':
+ win32ui.MessageBox("Please login to the database first", "OpenERP Connection", flag_excl)
+ return False
+ return True
+
+def resetConnAttribs(window):
+ config = window.manager.LoadConfig()
+ NewConn.setitem('_server', config['server'])
+ NewConn.setitem('_port', config['port'])
+# NewConn.setitem('protocol', config['protocol'])
+ NewConn.setitem('_uri', "http://" + config['server'] + ":" + str(config['port']))
+ NewConn.setitem('_obj_list', config['objects'])
+ NewConn.setitem('_dbname', config['database'])
+ NewConn.setitem('_uname', config['uname'])
+ NewConn.setitem('_pwd', config['pwd'])
+ NewConn.setitem('_login', str(config['login']))
+ return
+
+def setConnAttribs(server, port, manager):
+ protocol = NewConn.getitem('protocol')
+ if protocol=='XML-RPCS':
+ protocol='https://'
+ else:
+ protocol='http://'
+ uri = protocol + server + ":" + str(port)
+ NewConn.setitem('_server',server)
+ NewConn.setitem('_port',port)
+ NewConn.setitem('_uri',uri)
+ NewConn.GetDBList()
+ manager.config = manager.LoadConfig()
+ NewConn.setitem('_dbname',manager.config['database'])
+ NewConn.setitem('_uname', manager.config['uname'])
+ NewConn.setitem('_pwd', manager.config['pwd'])
+ NewConn.setitem('_login', str(manager.config['login']))
+ NewConn.setitem('_obj_list', manager.config['objects'])
+ return
+
+def getConnAttributes(manager):
+ manager.config['server'] = NewConn.getitem('_server')
+ manager.config['port'] = NewConn.getitem('_port')
+ manager.config['protocol'] = NewConn.getitem('protocol')
+ manager.config['objects'] = eval(NewConn.getitem('_obj_list'))
+ manager.config['database'] = NewConn.getitem('_dbname')
+ manager.config['uname'] = NewConn.getitem('_uname')
+ manager.config['pwd'] = NewConn.getitem('_pwd')
+ manager.config['login'] = NewConn.getitem('_login')
+ return
+
+def getMessage(e):
+ import pywintypes
+ print "Exception %s: %s"%(type(e),str(e))
+ msg = str(e)
+ if type(e) == pywintypes.com_error:
+ msg=str(e)
+ elif type(e) == xmlrpclib.Fault:
+ msg = str(e.faultCode) or e.faultString or e.message or str(e)
+ else:
+ if hasattr(e, 'faultCode') and e.faultCode:
+ msg = str(e.faultCode)
+ elif hasattr(e, 'faultString') and e.faultString:
+ msg = e.faultString
+ elif hasattr(e, 'message') and e.message:
+ msg = e.message
+ return msg
+
+class OKButtonProcessor(ButtonProcessor):
+ def __init__(self, window, control_ids):
+ self.mngr = window.manager
+ ControlProcessor.__init__(self, window, control_ids)
+
+ def OnClicked(self, id):
+ server = win32gui.GetDlgItemText(self.window.hwnd, self.other_ids[0])
+ try:
+ port = int(win32gui.GetDlgItemText(self.window.hwnd, self.other_ids[1]))
+ except ValueError, e:
+ print "Exception : %s"%str(e)
+ win32ui.MessageBox("Port should be an integer", "OpenERP Connection", flag_excl)
+ return
+ except Exception,e:
+ msg = getMessage(e)
+ win32ui.MessageBox(msg, "OpenERP Connection", flag_excl)
+ return
+ setConnAttribs(server, port, self.mngr)
+ if str(NewConn.getitem('_running')) == 'False':
+ msg = "No server running on host '%s' at port '%d'. Press ignore to still continue with this configuration?"%(server,port)
+ r=win32ui.MessageBox(msg, "OpenERP Connection", win32con.MB_ABORTRETRYIGNORE | win32con.MB_ICONQUESTION)
+ if r==3:
+ resetConnAttribs(self.window)
+ return
+ elif r==4:
+ self.OnClicked(id)
+ elif r==5:
+ setConnAttribs(server, port, self.mngr)
+ win32gui.EndDialog(self.window.hwnd, id)
+
+class DoneButtonProcessor(ButtonProcessor):
+ def OnClicked(self, id):
+ getConnAttributes(self.window.manager)
+ self.window.manager.SaveConfig()
+ win32gui.EndDialog(self.window.hwnd, id)
+
+class MessageProcessor(ControlProcessor):
+ def Init(self):
+ text = " This Outlook Plugin for OpenERP has been developed by OpenERP s.a.\n\n \
+ For more information, please visit our website \n\n \
+ http://www.openerp.com \n\n\n \
+ Copyright @ 2005-Today. All rights reserved.\n\n\
+OpenERP is a trademark of OpenERP s.a. The software is released under AGPL."
+ win32gui.SendMessage(self.GetControl(), win32con.WM_SETTEXT, 0, text)
+
+ def GetPopupHelpText(self, cid):
+ return "Displays details on this plugin"
+
+class TabProcessor(ControlProcessor):
+ def __init__(self, window, control_ids, page_ids):
+ ControlProcessor.__init__(self, window, control_ids)
+ self.page_ids = page_ids.split()
+
+ def Init(self):
+ self.pages = {}
+ self.currentPage = None
+ self.currentPageIndex = -1
+ self.currentPageHwnd = None
+ for index, page_id in enumerate(self.page_ids):
+ template = self.window.manager.dialog_parser.dialogs[page_id]
+ self.addPage(index, page_id, template[0][0])
+ server = self.window.manager.config['server']
+ port = self.window.manager.config['port']
+ setConnAttribs(server, port, self.window.manager)
+ self.switchToPage(0)
+
+ def Done(self):
+ if self.currentPageHwnd is not None:
+ if not self.currentPage.SaveAllControls():
+ win32gui.SendMessage(self.GetControl(), commctrl.TCM_SETCURSEL, self.currentPageIndex,0)
+ return False
+ return True
+
+ def OnNotify(self, nmhdr, wparam, lparam):
+ selChangedCode = 5177342
+ code = nmhdr[2]
+ if code==selChangedCode:
+ index = win32gui.SendMessage(self.GetControl(), commctrl.TCM_GETCURSEL, 0,0)
+ if index!=self.currentPageIndex:
+ self.switchToPage(index)
+
+ def switchToPage(self, index):
+ if self.currentPageHwnd is not None:
+ if not self.currentPage.SaveAllControls():
+ win32gui.SendMessage(self.GetControl(), commctrl.TCM_SETCURSEL, self.currentPageIndex,0)
+ return 1
+ win32gui.DestroyWindow(self.currentPageHwnd)
+ self.currentPage = MakePropertyPage(self.GetControl(), self.window.manager, self.window.config, self.pages[index])
+ self.currentPageHwnd = self.currentPage.CreateWindow()
+ self.currentPageIndex = index
+ return 0
+#
+ def addPage(self, item, idName, label):
+ format = "iiiiiii"
+ lbuf = win32gui.PyMakeBuffer(len(label)+1)
+ address,l = win32gui.PyGetBufferAddressAndLen(lbuf)
+ win32gui.PySetString(address, label)
+
+ buf = struct.pack(format,
+ commctrl.TCIF_TEXT, # mask
+ 0, # state
+ 0, # state mask
+ address,
+ 0, #unused
+ 0, #image
+ item
+ )
+ item = win32gui.SendMessage(self.GetControl(),
+ commctrl.TCM_INSERTITEM,
+ item,
+ buf)
+ self.pages[item] = idName
+
+class DialogCommand(ButtonProcessor):
+ def __init__(self, window, control_ids, idd, func=None, args=()):
+ self.idd = idd
+ self.func = func
+ self.args = args
+ ButtonProcessor.__init__(self, window, control_ids)
+
+ def OnClicked(self, id):
+ self.id = id
+ if self.func:
+ args = (self, ) + self.args
+ self.func(*args)
+ parent = self.window.hwnd
+ self.window.SaveAllControls()
+ ShowDialog(parent, self.window.manager, self.window.config, self.idd)
+ self.window.LoadAllControls()
+
+ def GetPopupHelpText(self, id):
+ dd = self.window.manager.dialog_parser.dialogs[self.idd]
+ return "Displays the %s dialog" % dd.caption
+
+def ReloadAllControls(btnProcessor,*args):
+ server = NewConn.getitem('_server')
+ port = NewConn.getitem('_port')
+ btnProcessor.window.LoadAllControls()
+ if str(NewConn.getitem('_running')) == 'False':
+ win32ui.MessageBox("No server running on host "+ server+" at port "+str(port), "OpenERP Connection", flag_excl)
+ return
+
+def TestConnection(btnProcessor,*args):
+ server = NewConn.getitem('_server')
+ port = NewConn.getitem('_port')
+ url = NewConn.getitem('_uri')
+ NewConn.GetDBList()
+ if str(NewConn.getitem('_running')) == 'False':
+ btnProcessor.window.LoadAllControls()
+ win32ui.MessageBox("No server running on host "+ server+" at port "+str(port), "OpenERP Connection", flag_excl)
+ return
+ try:
+ dbname = win32gui.GetDlgItemText(btnProcessor.window.hwnd, 7000)
+ if not dbname:
+ win32ui.MessageBox("Authentication Error !\nBad Database Name !", "OpenERP Connection", flag_excl)
+ return
+ except Exception,e:
+ print "Exception %s: %s"%(type(e),str(e))
+ dbname = win32gui.GetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[0])
+ if not dbname:
+ win32ui.MessageBox("No database found on host "+ server+" at port "+str(port), "OpenERP Connection", flag_excl)
+ return
+
+ uname = win32gui.GetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[1])
+ pwd = win32gui.GetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[2])
+
+ if not uname:
+ win32ui.MessageBox("Authentication Error !\nBad User Name !", "OpenERP Connection", flag_excl)
+ return
+ if not pwd:
+ win32ui.MessageBox("Authentication Error !\nBad Password !", "OpenERP Connection", flag_excl)
+ return
+
+ #Establish Connection
+ try:
+ uid = NewConn.login(dbname, uname, pwd)
+ if uid:
+ msg = "Connection Successful"
+ NewConn.setitem('_login', 'True')
+ NewConn.setitem('_uname', uname)
+ NewConn.setitem('_pwd', pwd)
+ NewConn.setitem('_uid', uid)
+ flag = flag_info
+ if not NewConn.IsCRMInstalled():
+ msg+= '\n\n'+" 'CRM' module is not installed. So CRM cases cannot be created."
+ NewConn.setitem('_iscrm', False)
+ else:
+ NewConn.setitem('_iscrm', True)
+ else:
+ msg = "Authentication Error !\nBad UserName or Password"
+ flag = flag_stop
+ NewConn.setitem('_login', 'False')
+ except Exception,e:
+ msg = "Authentication Error !\n\n" + getMessage(e)
+ flag = flag_error
+ win32ui.MessageBox(msg, "OpenERP Connection", flag)
+ return
+
+def BrowseCallbackProc(hwnd, msg, lp, data):
+ from win32com.shell import shell, shellcon
+ if msg== shellcon.BFFM_INITIALIZED:
+ win32gui.SendMessage(hwnd, shellcon.BFFM_SETSELECTION, 1, data)
+ win32gui.SendMessage(hwnd, shellcon.BFFM_ENABLEOK, 0, 0)
+ elif msg == shellcon.BFFM_SELCHANGED:
+ # Set the status text of the
+ # For this message, 'lp' is the address of the PIDL.
+ pidl = shell.AddressAsPIDL(lp)
+ try:
+ path = shell.SHGetPathFromIDList(pidl)
+ if os.path.isdir(path):
+ win32gui.SendMessage(hwnd, shellcon.BFFM_ENABLEOK, 0, 0)
+ else:
+ ext = path.split('.')[-1]
+ if ext not in ['gif', 'bmp', 'jpg', 'tif', 'ico', 'png']:
+ win32gui.SendMessage(hwnd, shellcon.BFFM_ENABLEOK, 0, 0)
+ else:
+ win32gui.SendMessage(hwnd, shellcon.BFFM_ENABLEOK, 0, 1)
+ except shell.error:
+ # No path for this PIDL
+ pass
+
+def GetImagePath(btnProcessor,*args):
+ from win32com.shell import shell, shellcon
+ ulFlags = shellcon.BIF_BROWSEINCLUDEFILES | BIF_NEWDIALOGSTYLE | BIF_NONEWFOLDERBUTTON
+ pidl, display_name, image_list=shell.SHBrowseForFolder(btnProcessor.window.hwnd, # parent HWND
+ None, # root PIDL.
+ "Get the image path", # title
+ ulFlags, # flags
+ BrowseCallbackProc, # callback function
+ os.getcwd() # 'data' param for the callback
+ )
+ if (pidl, display_name, image_list) == (None, None, None):
+ return
+ else:
+ path = shell.SHGetPathFromIDList (pidl)
+ win32gui.SetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[0], path)
+
+def AddNewObject(btnProcessor,*args):
+ #Check if server running or user logged in
+ b = check()
+ if not b:
+ return
+
+ #Check if title or object not specified
+ obj_title = win32gui.GetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[0])
+ obj_name = win32gui.GetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[1])
+ if not obj_title:
+ win32ui.MessageBox("No Title specified", "Documents Setting", flag_excl)
+ return
+ if not obj_name:
+ win32ui.MessageBox("No Document specified", "Documents Setting", flag_excl)
+ return
+
+ #Check if object does not exist in the database or it already exist in the list
+ try:
+ all_obj_list = NewConn.GetAllObjects()
+ curr_obj_list = [obj[1] for obj in NewConn.GetObjList()]
+ curr_title_list = [obj[0] for obj in NewConn.GetObjList()]
+ if obj_name not in all_obj_list:
+ win32ui.MessageBox("No such Document exists", "Documents Setting", flag_excl)
+ return
+ elif obj_name in curr_obj_list:
+ win32ui.MessageBox("Document already in the list", "Documents Setting", flag_info)
+ return
+ elif obj_title in curr_title_list:
+ win32ui.MessageBox("Title already in the list. Please give different title", "Documents Setting", flag_excl)
+ return
+
+ #extract image path and load the image
+ image_path=''
+ image_path = os.path.join(btnProcessor.window.manager.application_directory, "dialogs\\resources\\openerp_logo1.bmp")
+ path=win32gui.GetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[2])
+ if path:
+ image_path = path
+ load_bmp_flags=win32con.LR_LOADFROMFILE | win32con.LR_LOADTRANSPARENT
+ try:
+ hicon = win32gui.LoadImage(0, image_path,win32con.IMAGE_BITMAP, 40, 40, load_bmp_flags)
+ except Exception,e:
+ msg=getMessage(e)
+ hicon=None
+ win32ui.MessageBox(msg, "Load Image", flag_error)
+
+ #Add the object in the list
+ win32gui.ImageList_Add(il,hicon,0)
+ cnt = win32gui.ImageList_GetImageCount(il)
+
+ hwndList = win32gui.GetDlgItem(btnProcessor.window.hwnd, btnProcessor.other_ids[3])
+ num_items = win32gui.SendMessage(hwndList, commctrl.LVM_GETITEMCOUNT)
+
+ item = LVITEM(text=obj_title, iImage=cnt-2, iItem = num_items)
+ new_index = win32gui.SendMessage(hwndList, commctrl.LVM_INSERTITEM, 0, item.toparam())
+ win32gui.SendMessage(hwndList, commctrl.LVM_SETIMAGELIST, commctrl.LVSIL_SMALL, il)
+ item = LVITEM(text=obj_name, iItem = new_index, iSubItem = 1)
+ win32gui.SendMessage(hwndList, commctrl.LVM_SETITEM, 0, item.toparam())
+
+ NewConn.InsertObj(obj_title,obj_name,image_path)
+ except Exception, e:
+ msg = "Object not added\n\n" + getMessage(e)
+ win32ui.MessageBox(msg,"",flag_excl)
+ return
+
+ #Empty all the text controls
+ win32gui.SetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[0], '')
+ win32gui.SetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[1], '')
+ win32gui.SetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[2], '')
+
+def DeleteSelectedObjects(btnProcessor,*args):
+ #Check if server running or user logged in
+ b = check()
+ if not b:
+ return
+
+ #Delete selected items
+ hwndList = win32gui.GetDlgItem(btnProcessor.window.hwnd, btnProcessor.other_ids[0])
+ sel_count = win32gui.SendMessage(hwndList, commctrl.LVM_GETSELECTEDCOUNT)
+ for i in range(0,sel_count):
+ sel = win32gui.SendMessage(hwndList, commctrl.LVM_GETNEXTITEM, -1, commctrl.LVNI_SELECTED)
+ buf,extra = win32gui_struct.EmptyLVITEM(1, 0)
+ r = win32gui.SendMessage(hwndList, commctrl.LVM_GETITEMTEXT, sel, buf)
+ sel_text = ''
+ for n in extra:
+ nombre = n.tostring()
+ sel_text = nombre[0:r]
+ s = win32gui.SendMessage(hwndList, commctrl.LVM_DELETEITEM, sel)
+ try:
+ NewConn.DeleteObject(sel_text)
+ except Exception,e:
+ msg = "Documents '%s' not deleted\n\n"%sel_text + getMessage(e)
+ win32ui.MessageBox(msg,"Documents Setting",flag_excl)
+
+def GetMail(processor):
+ ex = processor.window.manager.outlook.ActiveExplorer()
+ assert ex.Selection.Count == 1
+ mail = ex.Selection.Item(1)
+ return mail
+#get selected records from list
+def GetSelectedItems(hwndList):
+ r=[]
+ sel_count = win32gui.SendMessage(hwndList, commctrl.LVM_GETSELECTEDCOUNT)
+ sel=-1
+ for i in range(0,sel_count):
+ sel = win32gui.SendMessage(hwndList, commctrl.LVM_GETNEXTITEM, sel, commctrl.LVNI_SELECTED)
+ buf,extra = win32gui_struct.EmptyLVITEM(1, 0)
+ size = win32gui.SendMessage(hwndList, commctrl.LVM_GETITEMTEXT, sel, buf)
+ sel_text = ''
+ for n in extra:
+ nombre = n.tostring()
+ sel_text = nombre[0:size]
+ for item in objects_with_match:
+ if item[2] == sel_text:
+ r.append(item)
+ return r
+
+def MakeAttachment(btnProcessor,*args):
+ #Check if server running or user logged in
+ b = check()
+ if not b:
+ return
+ ex = btnProcessor.window.manager.outlook.ActiveExplorer()
+ assert ex.Selection.Count == 1
+ mail = ex.Selection.Item(1)
+ mail = GetMail(btnProcessor)
+
+ #get selected records
+ hwndList = win32gui.GetDlgItem(btnProcessor.window.hwnd, btnProcessor.other_ids[0])
+ r = GetSelectedItems(hwndList)
+ if not r:
+ win32ui.MessageBox("No records selected", "Push to OpenERP", flag_info)
+ return
+ try:
+ flg = NewConn.ArchiveToOpenERP(r,mail)
+ if flg:
+ win32gui.EndDialog(btnProcessor.window.hwnd, btnProcessor.other_ids[1])
+ return
+ except Exception,e:
+ msg = "Attachment not created \n\n" + getMessage(e)
+ flag = flag_error
+ win32ui.MessageBox(msg, "Push to OpenERP", flag)
+ return
+
+def CreateCase(btnProcessor,*args):
+ try:
+ #Check if server running or user logged in
+ b = check()
+ if not b:
+ return
+
+ if str(NewConn.getitem('_iscrm')) == 'True':
+ # Get the selected mail
+ ex = btnProcessor.window.manager.outlook.ActiveExplorer()
+ assert ex.Selection.Count == 1
+ mail = ex.Selection.Item(1)
+ section = win32gui.GetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[0])
+ section = str(section)
+ section=section.lower().replace(' ','.')
+ if not section:
+ win32ui.MessageBox("Documents can not be created.", "Documents Setting", flag_excl)
+ return
+
+ hwndList = win32gui.GetDlgItem(btnProcessor.window.hwnd, btnProcessor.other_ids[1])
+ partner_ids=[]
+ r = GetSelectedItems(hwndList)
+ for rec in r:
+ if rec[0] == 'res.partner':
+ partner_ids.append(rec[1])
+
+ #Create new case
+ try:
+ NewConn.CreateCase(str(section), mail, partner_ids)
+ msg="New Document created."
+ flag=flag_info
+ except Exception,e:
+ msg="New Document not created \n\n"+str(e)
+ flag=flag_error
+ win32ui.MessageBox(msg, "Create Document", flag)
+ return
+ else:
+ win32ui.MessageBox("Document can not be created. CRM not installed", "Create Object", flag_info)
+ except Exception, e:
+ win32ui.MessageBox(str(e), 'New Document')
+
+def GetSearchText(txtProcessor,*args):
+ #Check if server running or user logged in
+ b = check()
+ if not b:
+ return
+
+ search_box = txtProcessor.GetControl()
+ global search_text
+ if txtProcessor.init_done:
+ win32gui.SendMessage(search_box, win32con.WM_SETTEXT, 0,search_text)
+ return
+
+ # Get the selected mail and set the default value for search_text_control to mail.SenderEmailAddress
+ ex = txtProcessor.window.manager.outlook.ActiveExplorer()
+ assert ex.Selection.Count == 1
+ mail = ex.Selection.Item(1)
+ try:
+ search_text = ustr(mail.SenderEmailAddress).encode('iso-8859-1')
+ except Exception,e:
+ pass
+ win32gui.SendMessage(search_box, win32con.WM_SETTEXT, 0, search_text)
+ txtProcessor.init_done=True
+
+def SetNameColumn(listProcessor,*args):
+ hwndList = listProcessor.GetControl()
+ child_ex_style = win32gui.SendMessage(hwndList, commctrl.LVM_GETEXTENDEDLISTVIEWSTYLE, 0, 0)
+ child_ex_style |= commctrl.LVS_EX_FULLROWSELECT
+ win32gui.SendMessage(hwndList, commctrl.LVM_SETEXTENDEDLISTVIEWSTYLE, 0, child_ex_style)
+
+ # set header row
+ lvc = LVCOLUMN(
+ mask = commctrl.LVCF_FMT | commctrl.LVCF_WIDTH | \
+ commctrl.LVCF_TEXT | commctrl.LVCF_SUBITEM
+ )
+ lvc.fmt = commctrl.LVCFMT_LEFT
+ lvc.iSubItem = 1
+ lvc.text = "Document Type"
+ lvc.cx = 100
+ win32gui.SendMessage(hwndList, commctrl.LVM_INSERTCOLUMN, 0, lvc.toparam())
+ lvc.iSubItem = 0
+ lvc.text = "Name"
+ lvc.cx = 240
+ win32gui.SendMessage(hwndList, commctrl.LVM_INSERTCOLUMN, 0, lvc.toparam())
+ listProcessor.init_done = True
+
+def setList(list_hwnd):
+ # Set default list of objects
+ win32gui.SendMessage(list_hwnd, commctrl.LVM_DELETEALLITEMS)
+ for obj in objects_with_match:
+ num_items = win32gui.SendMessage(list_hwnd, commctrl.LVM_GETITEMCOUNT)
+ item = LVITEM(text=obj[2],iItem = num_items)
+ new = win32gui.SendMessage(list_hwnd, commctrl.LVM_INSERTITEM, 0, item.toparam())
+ item = LVITEM(text=obj[3],iItem = new, iSubItem = 1)
+ win32gui.SendMessage(list_hwnd, commctrl.LVM_SETITEM, 0, item.toparam())
+
+def SearchObjectsForText(btnProcessor,*args):
+ #Check if server running or user logged in
+ b = check()
+ if not b:
+ return
+
+ search_txt = win32gui.GetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[0])
+ if not search_txt:
+ win32ui.MessageBox("Enter text to search for", "Push to OpenERP", flag_info)
+ return
+ # Get titles from list
+ obj_titles=[]
+ for ch in hwndChk_list:
+ id = ch[0]
+ hwnd = ch[1]
+ chk = win32gui.SendMessage(hwnd, win32con.BM_GETCHECK)
+ if chk:
+ txt = win32gui.GetDlgItemText(btnProcessor.window.hwnd,id)
+ obj_titles.append(txt)
+
+ # Prepare list of objects to search for the seach_keyword
+ obj_list = btnProcessor.window.manager.config['objects']
+ search_list = []
+ try:
+ all_obj_list = NewConn.GetAllObjects()
+ for title in obj_titles:
+ objname = [obj[1] for obj in obj_list if obj[0] == title]
+ if objname:
+ assert len(objname) == 1
+ if objname[0] in all_obj_list:
+ search_list.append(objname[0])
+ else:
+ win32ui.MessageBox("Module %s (%s) not installed. Please install it." \
+ %(title,objname[0]), "Push to OpenERP", flag_excl)
+ return
+
+ # Get the records by searching the objects in search_list for the search_keyword as objects_with_match
+ global objects_with_match
+ list_hwnd = win32gui.GetDlgItem(btnProcessor.window.hwnd, btnProcessor.other_ids[1])
+ if search_list:
+ objects_with_match = NewConn.GetObjectItems(search_list, search_txt)
+ if not objects_with_match:
+ win32ui.MessageBox("No matching records found in checked objects", "Push to OpenERP", flag_info)
+ else:
+ win32ui.MessageBox("No object selected", "Push to OpenERP", flag_info)
+ objects_with_match=[]
+ # Display the objects_with_match records in list
+ setList(list_hwnd)
+ except Exception,e:
+ msg=getMessage(e)
+ win32ui.MessageBox(msg, "Search Text", flag_error)
+
+def CreateContact(btnProcessor,*args):
+ b = check()
+ if not b:
+ return
+
+ partner = win32gui.GetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[9])
+ combo = win32gui.GetDlgItem(btnProcessor.window.hwnd, btnProcessor.other_ids[9])
+ sel = win32gui.SendMessage(combo, win32con.CB_GETCURSEL)
+
+ state_combo = win32gui.GetDlgItem(btnProcessor.window.hwnd, btnProcessor.other_ids[10])
+ state_sel = win32gui.SendMessage(state_combo, win32con.CB_GETCURSEL)
+ coun_combo = win32gui.GetDlgItem(btnProcessor.window.hwnd, btnProcessor.other_ids[11])
+ country_sel = win32gui.SendMessage(coun_combo, win32con.CB_GETCURSEL)
+ name = win32gui.GetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[0])
+ email = win32gui.GetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[1])
+ office_no = win32gui.GetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[2])
+ mobile_no = win32gui.GetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[3])
+ fax = win32gui.GetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[4])
+ street = win32gui.GetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[5])
+ street2 = win32gui.GetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[6])
+ city = win32gui.GetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[7])
+ zip = win32gui.GetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[8])
+ if not name:
+ win32ui.MessageBox("Please enter name.", "Create Contact", flag_stop)
+ return
+
+ res = {
+ 'name':ustr(name),
+ 'email':ustr(email),
+ 'phone':ustr(office_no),
+ 'mobile':ustr(mobile_no),
+ 'fax':ustr(fax),
+ 'street':ustr(street),
+ 'street2':ustr(street2),
+ 'city':ustr(city),
+ 'zip':ustr(zip)
+ }
+
+ fs_id = c_id = -1
+ if not state_sel == -1 :
+ try:
+ temp = NewConn.GetAllState()
+ i = -1
+ for t in temp:
+ i+=1
+ if i == state_sel:
+ fs_id = t[0]
+ break;
+ res ['state_id'] = fs_id
+ except Exception, e:
+ msg = getMessage(e)
+ win32ui.MessageBox(msg, "New Partner", flag_error)
+ pass
+ if not country_sel == -1 :
+ try:
+ temp = NewConn.GetAllCountry()
+ i = -1
+ for t in temp:
+ i+=1
+ if i == country_sel:
+ c_id = t[0]
+ break;
+ res ['country_id'] = c_id
+ except Exception, e:
+ msg = getMessage(e)
+ win32ui.MessageBox(msg, "Open Contact", flag_error)
+ pass
+ try:
+ id = NewConn.CreateContact(sel, str(res))
+ if not partner:
+ msg="New contact created."
+ else:
+ msg="New contact created for partner '%s'."%partner
+ except Exception,e:
+ msg="Contact not created \n\n" + getMessage(e)
+ win32ui.MessageBox(msg, "Create Contact", flag_error)
+ return
+ win32ui.MessageBox(msg, "Create Contact", flag_info)
+ for i in range(0,9):
+ win32gui.SetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[i], '')
+ win32gui.SendMessage(combo, win32con.CB_SETCURSEL, -1 )
+ win32gui.SendMessage(state_combo, win32con.CB_SETCURSEL, -1 )
+ win32gui.SendMessage(coun_combo, win32con.CB_SETCURSEL, -1 )
+ win32gui.EndDialog(btnProcessor.window.hwnd, btnProcessor.id)
+
+def SetAllText(txtProcessor,*args):
+ # Set values for url, uname, pwd from config file
+ url = NewConn.getitem('_uri')
+ tbox = txtProcessor.GetControl()
+ win32gui.SendMessage(tbox, win32con.WM_SETTEXT, 0, str(url))
+ k=win32gui.GetDlgItemText(txtProcessor.window.hwnd, txtProcessor.control_id)
+ uname = NewConn.getitem('_uname')
+ tbox = txtProcessor.GetControl(txtProcessor.other_ids[0])
+ win32gui.SendMessage(tbox, win32con.WM_SETTEXT, 0, str(uname))
+
+def SetDefaultList(listProcessor,*args):
+ import win32api
+ hwndList = listProcessor.GetControl()
+
+ # set full row select style
+ child_ex_style = win32gui.SendMessage(hwndList, commctrl.LVM_GETEXTENDEDLISTVIEWSTYLE, 0, 0)
+ child_ex_style |= commctrl.LVS_EX_FULLROWSELECT
+ win32gui.SendMessage(hwndList, commctrl.LVM_SETEXTENDEDLISTVIEWSTYLE, 0, child_ex_style)
+
+ # set header row
+ lvc = LVCOLUMN(
+ mask = commctrl.LVCF_FMT | commctrl.LVCF_WIDTH | \
+ commctrl.LVCF_TEXT | commctrl.LVCF_SUBITEM
+ )
+ lvc.fmt = commctrl.LVCFMT_LEFT
+ lvc.iSubItem = 1
+ lvc.text = "Object Name"
+ lvc.cx = 315
+ win32gui.SendMessage(hwndList, commctrl.LVM_INSERTCOLUMN, 0, lvc.toparam())
+ lvc.iSubItem = 0
+ lvc.text = "Document Title"
+ lvc.cx = 315
+ win32gui.SendMessage(hwndList, commctrl.LVM_INSERTCOLUMN, 0, lvc.toparam())
+
+ #create imagelist
+ global il
+ il = win32gui.ImageList_Create(
+ win32api.GetSystemMetrics(win32con.SM_CXSMICON),
+ win32api.GetSystemMetrics(win32con.SM_CYSMICON),
+ commctrl.ILC_COLOR32 | commctrl.ILC_MASK,
+ 1, # initial size
+ 0) # cGrow
+
+ win32gui.SendMessage(hwndList, commctrl.LVM_SETIMAGELIST,\
+ commctrl.LVSIL_SMALL, il)
+ # Set objects from config
+ objs = eval(NewConn.getitem('_obj_list'))
+ load_bmp_flags=win32con.LR_LOADFROMFILE | win32con.LR_LOADTRANSPARENT
+ for obj in objs:
+ image_path = os.path.join(listProcessor.window.manager.application_directory, "dialogs\\resources\\openerp_logo1.bmp")
+ path=obj[2]
+ if path:
+ image_path = path
+ try:
+ hicon = win32gui.LoadImage(0, image_path,win32con.IMAGE_BITMAP, 40, 40, load_bmp_flags)
+ except Exception, e:
+ msg = "Problem loading the image \n\n" + getMessage(e)
+ hicon = None
+ win32ui.MessageBox(msg, "Load Image", flag_error)
+
+ #Add the object in the list
+ win32gui.ImageList_Add(il,hicon,0)
+ cnt = win32gui.ImageList_GetImageCount(il)
+ num_items = win32gui.SendMessage(hwndList, commctrl.LVM_GETITEMCOUNT)
+ item = LVITEM(text=obj[0],iImage=cnt-2, iItem = num_items)
+ new_index = win32gui.SendMessage(hwndList, commctrl.LVM_INSERTITEM, 0, item.toparam())
+ item = LVITEM(text=obj[1], iItem = new_index, iSubItem = 1)
+ win32gui.SendMessage(hwndList, commctrl.LVM_SETITEM, 0, item.toparam())
+
+def SetDefaultContact(txtProcessor,*args):
+ # Acquiring the control of the text box
+ txt_name = txtProcessor.GetControl()
+ txt_email = txtProcessor.GetControl(txtProcessor.other_ids[0])
+
+ global name
+ global email
+ if txtProcessor.init_done:
+ win32gui.SetDlgItemText(txtProcessor.window.hwnd, txtProcessor.control_id,name)
+ win32gui.SetDlgItemText(txtProcessor.window.hwnd, txtProcessor.other_ids[0],email)
+ return
+ #
+ try:
+ mail = GetMail(txtProcessor)
+ name = ustr(mail.SenderName).encode('iso-8859-1')
+ email = ustr(mail.SenderEmailAddress).encode('iso-8859-1')
+ except Exception,e:
+ pass
+
+ fs_combo = win32gui.GetDlgItem(txtProcessor.window.hwnd, txtProcessor.other_ids[1])
+ c_combo = win32gui.GetDlgItem(txtProcessor.window.hwnd, txtProcessor.other_ids[2])
+ win32gui.SendMessage(fs_combo, win32con.CB_SETCURSEL, -1 )
+ win32gui.SendMessage(c_combo, win32con.CB_SETCURSEL, -1 )
+ win32gui.SetDlgItemText(txtProcessor.window.hwnd, txtProcessor.control_id,name)
+ win32gui.SetDlgItemText(txtProcessor.window.hwnd, txtProcessor.other_ids[0],email)
+ txtProcessor.init_done = True
+
+def setCheckList(groupProcessor,*args):
+ try:
+ child_style = win32con.BS_AUTOCHECKBOX | win32con.WS_TABSTOP
+ hinst = win32gui.dllhandle
+ objs = groupProcessor.window.manager.config['objects']
+ ins_objs = NewConn.GetAllObjects()
+ left = 20
+ top = 60
+ cnt=0
+ id=4001
+ id1=6001
+ load_bmp_flags=win32con.LR_LOADFROMFILE | win32con.LR_LOADTRANSPARENT
+ if groupProcessor.init_done:
+ return
+ else:
+ for obj in objs:
+ if obj[1] in ins_objs:
+ groupProcessor.init_done = True
+ #Add image
+ hwndImg = win32gui.CreateWindowEx(0, "STATIC","",
+ win32con.SS_CENTERIMAGE | win32con.SS_REALSIZEIMAGE | win32con.SS_BITMAP | win32con.WS_CHILD | win32con.WS_VISIBLE,
+ left,top+3,13,13,
+ groupProcessor.window.hwnd,
+ id,
+ 0,
+ None
+ );
+ image_path = os.path.join(groupProcessor.window.manager.application_directory, "dialogs\\resources\\openerp_logo1.bmp")
+ if obj[2]:
+ image_path = obj[2]
+ try:
+ hicon = win32gui.LoadImage(0, image_path, win32con.IMAGE_BITMAP, 40, 40, load_bmp_flags)
+ except Exception,e:
+ msg="Problem loading the image \n\n" + getMessage(e)
+ hicon = None
+ win32ui.MessageBox(msg, "Load Image", flag_error)
+
+ win32gui.SendMessage(hwndImg, win32con.STM_SETIMAGE, win32con.IMAGE_BITMAP, hicon);
+ #Add Checkbox
+ left+= 17
+ hwndChk = win32gui.CreateWindowEx(
+ 0,"BUTTON",obj[0],win32con.WS_VISIBLE | win32con.WS_CHILD | \
+ win32con.BS_AUTOCHECKBOX | win32con.WS_TABSTOP | win32con.BST_CHECKED, \
+ left, top, 130,20,groupProcessor.window.hwnd,id1,hinst,None
+ )
+ if obj[1] in ['res.partner','res.partner.address']:
+ win32gui.SendMessage(hwndChk , win32con.BM_SETCHECK, 1, 0);
+ hwndChk_list.append((id1,hwndChk))
+
+ cnt=cnt+1
+ id+=1
+ id1+=1
+ left+=17
+ win32gui.UpdateWindow(hwndImg)
+ left+=140
+ if cnt > 1:
+ left = 20
+ top+=18
+ cnt=0
+ except Exception, e:
+ win32ui.MessageBox(str(e), 'Push to OpenERP')
+
+def CreatePartner(btnProcessor,*args):
+ #Check if server running or user logged in
+ b = check()
+ if not b:
+ return
+
+ partner_name = win32gui.GetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[0])
+ if not partner_name:
+ win32ui.MessageBox("Please enter Partner name.", "Create Partner", flag_excl)
+ return
+ res = {'name':ustr(partner_name)}
+ try:
+ id = NewConn.CreatePartner(str(res))
+ except Exception,e:
+ msg="Partner not created \n\n" + getMessage(e)
+ win32ui.MessageBox(msg, "Create Partner", flag_error)
+ return
+ if id:
+ win32ui.MessageBox("New Partner '%s' created."%partner_name, "Create Partner", flag_info)
+ win32gui.EndDialog(btnProcessor.window.hwnd, btnProcessor.id)
+ else:
+ win32ui.MessageBox("Partner '%s' already Exists."%partner_name, "Create Partner", flag_info)
+ win32gui.SetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[0],'')
+
+def set_search_text(dialogProcessor,*args):
+ global search_text
+ search_text = win32gui.GetDlgItemText(dialogProcessor.window.hwnd, dialogProcessor.other_ids[0])
+ return
+
+def set_name_email(dialogProcessor,*args):
+ global name
+ global email
+ name = win32gui.GetDlgItemText(dialogProcessor.window.hwnd, dialogProcessor.other_ids[0])
+ email = win32gui.GetDlgItemText(dialogProcessor.window.hwnd, dialogProcessor.other_ids[1])
+
+def GetDefaultEmail(txtProcessor,*args):
+
+ from win32com.client import Dispatch
+ import win32con
+ b = check()
+ if not b:
+ return
+ #Acquiring control of the text box
+ search_partner_box = txtProcessor.GetControl()
+ global search_partner_text
+ if txtProcessor.init_done:
+ win32gui.SendMessage(search_partner_box, win32con.WM_SETTEXT, 0,search_partner_text)
+ return
+ #Reading Current Selected Email.
+ ex = txtProcessor.window.manager.outlook.ActiveExplorer()
+ assert ex.Selection.Count == 1
+ mail = ex.Selection.Item(1)
+ #Fetching Sender MailID from Selected Mail
+ try:
+ search_partner_text = ustr(mail.SenderEmailAddress).encode('iso-8859-1')
+ except Exception,e:
+ win32ui.MessageBox("Error In reading email ID from Email ","Open Contact", flag_error)
+ pass
+ win32gui.SendMessage(search_partner_box, win32con.WM_SETTEXT, 0, search_partner_text)
+
+ fs_combo = win32gui.GetDlgItem(txtProcessor.window.hwnd, txtProcessor.other_ids[10])
+ c_combo = win32gui.GetDlgItem(txtProcessor.window.hwnd, txtProcessor.other_ids[11])
+ partner_combo = win32gui.GetDlgItem(txtProcessor.window.hwnd, txtProcessor.other_ids[0])
+ vals = []
+ #Searching the res.partner.address for contact based on Sender Mail ID.
+ vals = NewConn.SearchPartnerDetail(search_partner_text)
+ #If no user Found.
+ if vals == None:
+ for i in range(1,10):
+ win32gui.SetDlgItemText(txtProcessor.window.hwnd, txtProcessor.other_ids[i], "")
+ win32gui.SendMessage(fs_combo, win32con.CB_SETCURSEL, -1 )
+ win32gui.SendMessage(c_combo, win32con.CB_SETCURSEL, -1 )
+ win32gui.SendMessage(partner_combo, win32con.CB_SETCURSEL, -1 )
+ win32ui.MessageBox("No matching records found for : "+str(search_partner)+".","Open Contact", flag_excl)
+ return
+ else:
+ #If user Found than Setting the Value for the contact in fields.
+ for i in range(1,10):
+ win32gui.SetDlgItemText(txtProcessor.window.hwnd, txtProcessor.other_ids[i], "")
+ win32gui.SendMessage(fs_combo, win32con.CB_SETCURSEL, -1 )
+ win32gui.SendMessage(c_combo, win32con.CB_SETCURSEL, -1 )
+ win32gui.SendMessage(partner_combo, win32con.CB_SETCURSEL, -1 )
+
+ for val in vals:
+
+ if val[0] == 'partner_id':
+ temp = list (NewConn.GetPartners())
+ i = -1
+ for t in temp:
+ i+=1
+ if t[1] == val[1][1] :
+ win32gui.SendMessage(partner_combo, win32con.CB_SETCURSEL, i )
+ if val[0] == 'name' and val[1] != False :
+ win32gui.SetDlgItemText(txtProcessor.window.hwnd, txtProcessor.other_ids[1], str(val[1]))
+
+ if val[0] == 'street' and val[1] != False :
+ win32gui.SetDlgItemText(txtProcessor.window.hwnd, txtProcessor.other_ids[2], str(val[1]))
+
+ if val[0] == 'street2' and val[1] != False :
+ win32gui.SetDlgItemText(txtProcessor.window.hwnd, txtProcessor.other_ids[3], str(val[1]))
+
+ if val[0] == 'zip' and val[1] != False :
+ win32gui.SetDlgItemText(txtProcessor.window.hwnd, txtProcessor.other_ids[9], str(val[1]))
+
+ if val[0] == 'city' and val[1] != False :
+ win32gui.SetDlgItemText(txtProcessor.window.hwnd, txtProcessor.other_ids[4], str(val[1]))
+
+ if val[0] == 'state_id' and val[1] != False :
+ id = i = -1
+ temp = list(NewConn.GetAllState())
+ for t in temp:
+ i+=1
+ if str(t[1]) == str(val[1][1]):
+ id = i
+ break;
+ sel = win32gui.SendMessage(fs_combo, win32con.CB_SETCURSEL, id )
+
+ if val[0] == 'country_id' and val[1] != False :
+ id = i = -1
+ temp = list(NewConn.GetAllCountry())
+ for t in temp:
+ i+=1
+ if str(t[1]) == str(val[1][1]):
+ id = i
+ break;
+ sel = win32gui.SendMessage(c_combo, win32con.CB_SETCURSEL, id )
+
+ if val[0] == 'phone' and val[1] != False :
+ win32gui.SetDlgItemText(txtProcessor.window.hwnd, txtProcessor.other_ids[5], str(val[1]))
+
+ if val[0] == 'mobile' and val[1] != False :
+ win32gui.SetDlgItemText(txtProcessor.window.hwnd, txtProcessor.other_ids[6], str(val[1]))
+
+ if val[0] == 'fax' and val[1] != False :
+ win32gui.SetDlgItemText(txtProcessor.window.hwnd, txtProcessor.other_ids[7], str(val[1]))
+
+ if val[0] == 'email' and val[1] != False :
+ win32gui.SetDlgItemText(txtProcessor.window.hwnd, txtProcessor.other_ids[8], str(val[1]))
+
+ txtProcessor.init_done=True
+
+def SearchPartner(btnProcessor,*args):
+ b = check()
+ if not b:
+ return
+ #hwnd For the List box
+ fs_combo = win32gui.GetDlgItem(btnProcessor.window.hwnd, btnProcessor.other_ids[11])
+ c_combo = win32gui.GetDlgItem(btnProcessor.window.hwnd, btnProcessor.other_ids[12])
+ partner_combo = win32gui.GetDlgItem(btnProcessor.window.hwnd, btnProcessor.other_ids[1])
+ try :
+ search_partner = win32gui.GetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[0])
+ if not search_partner:
+ win32ui.MessageBox("Please enter email id to search for.", "Open Contact", flag_excl)
+ return
+ vals = []
+ #Searching the contact.
+ vals = NewConn.SearchPartnerDetail(search_partner)
+ #if contact not found resetting all field to blank
+ if vals == None:
+ for i in range(2,11):
+ win32gui.SetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[i], "")
+ win32gui.SendMessage(fs_combo, win32con.CB_SETCURSEL, -1 )
+ win32gui.SendMessage(c_combo, win32con.CB_SETCURSEL, -1 )
+ win32gui.SendMessage(partner_combo, win32con.CB_SETCURSEL, -1 )
+ win32ui.MessageBox("No matching records found for : "+str(search_partner)+".","Open Contact", flag_excl)
+ win32gui.SetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[0], "<enter new search>")
+ return
+ #if contact found than setting the values for the contact.
+ else:
+ for i in range(2,11):
+ win32gui.SetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[i], "")
+ win32gui.SendMessage(fs_combo, win32con.CB_SETCURSEL, -1 )
+ win32gui.SendMessage(c_combo, win32con.CB_SETCURSEL, -1 )
+ win32gui.SendMessage(partner_combo, win32con.CB_SETCURSEL, -1 )
+ for val in vals:
+ if val[0] == 'partner_id':
+ #Finding the partner index in list and setting it.
+ temp = list (NewConn.GetPartners())
+ i = -1
+ for t in temp:
+ i+=1
+ if t[1] == val[1][1] :
+ win32gui.SendMessage(partner_combo, win32con.CB_SETCURSEL, i )
+
+ if val[0] == 'name' and val[1] != False :
+ win32gui.SetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[2], str(val[1]))
+
+ if val[0] == 'street' and val[1] != False :
+ win32gui.SetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[3], str(val[1]))
+
+ if val[0] == 'street2' and val[1] != False :
+ win32gui.SetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[4], str(val[1]))
+
+ if val[0] == 'zip' and val[1] != False :
+ win32gui.SetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[10], str(val[1]))
+
+ if val[0] == 'city' and val[1] != False :
+ win32gui.SetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[5], str(val[1]))
+
+ if val[0] == 'state_id' and val[1] != False :
+ #Finding the state index in list and setting it.
+ id = i = -1
+ temp = list(NewConn.GetAllState())
+ for t in temp:
+ i+=1
+ if str(t[1]) == str(val[1][1]):
+ id = i
+ break;
+ sel = win32gui.SendMessage(fs_combo, win32con.CB_SETCURSEL, id )
+
+ if val[0] == 'country_id' and val[1] != False :
+ #Finding the country index in list and setting it.
+ id = i = -1
+ temp = list(NewConn.GetAllCountry())
+ for t in temp:
+ i+=1
+ if str(t[1]) == str(val[1][1]):
+ id = i
+ break;
+ sel = win32gui.SendMessage(c_combo, win32con.CB_SETCURSEL, id )
+
+ if val[0] == 'phone' and val[1] != False :
+ win32gui.SetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[6], str(val[1]))
+
+ if val[0] == 'mobile' and val[1] != False :
+ win32gui.SetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[7], str(val[1]))
+
+ if val[0] == 'fax' and val[1] != False :
+ win32gui.SetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[8], str(val[1]))
+
+ if val[0] == 'email' and val[1] != False :
+ win32gui.SetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[9], str(val[1]))
+
+ win32gui.SetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[0], "<Enter new search>")
+ except Exception,e:
+ msg = getMessage(e)
+ win32ui.MessageBox(msg, "Open Contact", flag_error)
+ pass
+
+def WritePartner(btnProcessor,*args):
+ new_vals=[]
+ #Reading new value of the fields.
+ contect_name = win32gui.GetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[1])
+ street = win32gui.GetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[2])
+ street2 = win32gui.GetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[3])
+ city = win32gui.GetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[4])
+ phone = win32gui.GetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[7])
+ mobile = win32gui.GetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[8])
+ fax = win32gui.GetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[9])
+ email = win32gui.GetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[10])
+ zip = win32gui.GetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[11])
+ country_combo = win32gui.GetDlgItem(btnProcessor.window.hwnd, btnProcessor.other_ids[6])
+ country_sel = win32gui.SendMessage(country_combo, win32con.CB_GETCURSEL)
+ state_combo = win32gui.GetDlgItem(btnProcessor.window.hwnd, btnProcessor.other_ids[5])
+ state_sel = win32gui.SendMessage(state_combo, win32con.CB_GETCURSEL)
+ partner_combo = win32gui.GetDlgItem(btnProcessor.window.hwnd, btnProcessor.other_ids[0])
+ partner_sel = win32gui.SendMessage(partner_combo, win32con.CB_GETCURSEL)
+ #Checking that record not being saved without name or Partner
+ if contect_name.strip() == "":
+ win32ui.MessageBox("Please enter partner Contact Name name.", "Open Contact", flag_excl)
+ return
+ if partner_sel < 1:
+ win32ui.MessageBox("Please Select Partner From list.", "Open Contact", flag_excl)
+ return
+ fs_id = c_id = p_id = -1
+ #Finding the partner index in list finding it record ID.
+ if not partner_sel < 0 :
+ try:
+ temp = NewConn.GetPartners()
+ i = -1
+ for t in temp:
+ i+=1
+ if i == partner_sel:
+ p_id = t[0]
+ break;
+ except Exception, e:
+ msg = getMessage(e)
+ win32ui.MessageBox(msg, "Open Contact", flag_error)
+ pass
+ #Finding the State index in list finding it record ID.
+ if not state_sel == -1 :
+ try:
+ temp = NewConn.GetAllState()
+ i = -1
+ for t in temp:
+ i+=1
+ if i == state_sel:
+ fs_id = t[0]
+ break;
+ except Exception, e:
+ msg = getMessage(e)
+ win32ui.MessageBox(msg, "Open Contact", flag_error)
+ pass
+ #Finding the country index in list finding it record ID.
+ if not country_sel == -1 :
+ try:
+ temp = NewConn.GetAllCountry()
+ i = -1
+ for t in temp:
+ i+=1
+ if i == country_sel:
+ c_id = t[0]
+ break;
+ except Exception, e:
+ msg = getMessage(e)
+ win32ui.MessageBox(msg, "Open Contact", flag_error)
+ pass
+ # Creating a list to write the values to the OpenERP
+ new_vals.append(['partner_id',p_id])
+ new_vals.append(['name',contect_name])
+ new_vals.append(['street',street])
+ new_vals.append(['street2',street2])
+ new_vals.append(['city',city])
+ new_vals.append(['state_id',fs_id])
+ new_vals.append(['country_id',c_id])
+ new_vals.append(['phone',phone])
+ new_vals.append(['mobile',mobile])
+ new_vals.append(['email',email])
+ new_vals.append(['fax',fax])
+ new_vals.append(['zip',zip])
+ flag = 0
+ try:
+ #writing the updated values to the Server.
+ flag = NewConn.WritePartnerValues(new_vals)
+ except Exception,e:
+ msg = getMessage(e)
+ win32ui.MessageBox(msg, "Open Contact", flag_error)
+ pass
+ if flag == 1:
+ win32ui.MessageBox("Changes have been Updated Successfully.", "Open Contact", flag_info)
+ elif flag == 0:
+ win32ui.MessageBox("Error in Updating the Changes.\n Please check the Database Connection.", "Open Contact", flag_error)
+ elif flag == -1:
+ win32ui.MessageBox("Contact can not be Save.\nFirst select contact using Search.","Open Contact", flag_info)
+
+
+
+dialog_map = {
+ "IDD_MANAGER" : (
+ (CancelButtonProcessor, "IDCANCEL", resetConnAttribs, ()),
+ (TabProcessor, "IDC_TAB IDC_LIST",
+ """IDD_GENERAL IDD_OBJECT_SETTINGS IDD_ABOUT"""),
+ (DoneButtonProcessor, "ID_DONE"),
+ ),
+
+ "IDD_GENERAL": (
+ (DBComboProcessor, "ID_DB_DROPDOWNLIST", GetConn, ()),
+ (TextProcessor, "ID_SERVER_PORT ID_USERNAME ID_PASSWORD", SetAllText, ()),
+ (CommandButtonProcessor, "ID_BUT_TESTCONNECTION ID_DB_DROPDOWNLIST ID_USERNAME \
+ ID_PASSWORD", TestConnection, ()),
+ (CommandButtonProcessor, "IDC_RELOAD", ReloadAllControls, ()),
+ (DialogCommand, "IDC_BUT_SET_SERVER_PORT", "IDD_SERVER_PORT_DIALOG"),
+ ),
+
+ "IDD_OBJECT_SETTINGS" : (
+ (CommandButtonProcessor, "IDC_BUT_LOAD_IMAGE IDC_IMAGE_PATH", GetImagePath, ()),
+ (CommandButtonProcessor, "IDC_BUT_SAVE_OBJECT IDC_OBJECT_TITLE IDC_OBJECT_NAME \
+ IDC_IMAGE_PATH IDC_LIST", AddNewObject, ()),
+ (CommandButtonProcessor, "IDC_BUT_DEL_OBJECT IDC_LIST", DeleteSelectedObjects, ()),
+ (ListBoxProcessor, "IDC_LIST", SetDefaultList, ())
+ ),
+
+ "IDD_ABOUT" : (
+ (ImageProcessor, "IDB_OPENERPLOGO"),
+ (MessageProcessor, "IDC_ABOUT"),
+ ),
+
+ "IDD_SERVER_PORT_DIALOG" : (
+ (CloseButtonProcessor, "IDCANCEL"),
+ (OKButtonProcessor, "IDOK ID_SERVER ID_PORT IDR_XML_PROTOCOL"),
+ (RadioButtonProcessor, "IDR_XML_PROTOCOL", GetConn, ()),
+ (RadioButtonProcessor, "IDR_XMLS_PROTOCOL", GetConn, ()),
+ (RadioButtonProcessor, "IDR_NETRPC_PROTOCOL", GetConn, ()),
+ ),
+
+ "IDD_SYNC" : (
+ (CommandButtonProcessor, "ID_SEARCH ID_SEARCH_TEXT IDC_NAME_LIST", SearchObjectsForText,()),
+ (GroupProcessor, "IDC_STATIC_GROUP", setCheckList, ()),
+ (CSComboProcessor, "ID_ATT_METHOD_DROPDOWNLIST", GetConn,()),
+ (TextProcessor, "ID_SEARCH_TEXT", GetSearchText, ()),
+ (DialogCommand, "ID_CREATE_CONTACT ID_SEARCH_TEXT", "IDD_NEW_CONTACT_DIALOG", set_search_text, ()),
+ (CloseButtonProcessor, "IDCANCEL"),
+ (CommandButtonProcessor, "ID_MAKE_ATTACHMENT IDC_NAME_LIST IDD_SYNC", MakeAttachment, ()),
+ (CommandButtonProcessor, "ID_CREATE_CASE ID_ATT_METHOD_DROPDOWNLIST IDC_NAME_LIST", CreateCase, ()),
+ (ListBoxProcessor, "IDC_NAME_LIST", SetNameColumn, ())
+ ),
+
+ "IDD_NEW_CONTACT_DIALOG" : (
+ (PartnersComboProcessor, "ID_PARTNER_DROPDOWNLIST", GetConn, ()),
+ (CountryComboProcessor, "ID_COUNTRY_DROPLIST", GetConn, ()),
+ (StateComboProcessor, "ID_FED_STATE_DROPLIST", GetConn, ()),
+ (CloseButtonProcessor, "IDCANCEL"),
+ (CommandButtonProcessor, "ID_CONTACT_SAVE_BUTTON ID_CONTACT_NAME_TEXT ID_CONTACT_EMAIL_TEXT ID_CONTACT_OFFICE_TEXT ID_CONTACT_MOBILE_TEXT ID_FAX_TEXT ID_STREET_TEXT ID_STREET2_TEXT ID_PARTNER_CITY_TEXT ID_ZIP_TEXT ID_PARTNER_DROPDOWNLIST ID_FED_STATE_DROPLIST ID_COUNTRY_DROPLIST", CreateContact, ()),
+ (TextProcessor, "ID_CONTACT_NAME_TEXT ID_CONTACT_EMAIL_TEXT ID_FED_STATE_DROPLIST ID_COUNTRY_DROPLIST" , SetDefaultContact, ()),
+ (DialogCommand, "ID_NEW_PARTNER_BUTTON ID_CONTACT_NAME_TEXT ID_CONTACT_EMAIL_TEXT", "IDD_NEW_PARTNER_DIALOG", set_name_email, ()),
+ ),
+
+ "IDD_NEW_PARTNER_DIALOG" : (
+ (CloseButtonProcessor, "IDCANCEL"),
+ (CommandButtonProcessor, "ID_SAVE_PARTNER_BUTTON ID_PARTNER_NAME_TEXT", CreatePartner, ()),
+ ),
+
+ "IDD_VIEW_PARTNER_DIALOG" : (
+ (PartnersComboProcessor, "ID_PARTNER_DROPLIST", GetConn, ()),
+ (StateComboProcessor, "ID_ALL_STATE_DROPDOWNLIST", GetConn, ()),
+ (CountryComboProcessor, "ID_ALL_COUNTRY_DROPDOWNLIST", GetConn, ()),
+ (TextProcessor, "IDET_SEARCH_PARTNER ID_PARTNER_DROPLIST IDET_PARTNER_CONTACT_NAME IDET_PARTNER_STREET IDET_PARTNER_STREET2 IDET_PARTNER_CITY IDET_PARTNER_OFFICENO IDET_PARTNER_MOBILENO IDET_PARTNER_EMAIL IDET_PARTNER_FAX IDET_ZIP ID_ALL_STATE_DROPDOWNLIST ID_ALL_COUNTRY_DROPDOWNLIST", GetDefaultEmail, ()),
+ (CommandButtonProcessor, "IDPB_SEARCH_PARTNER IDET_SEARCH_PARTNER ID_PARTNER_DROPLIST IDET_PARTNER_CONTACT_NAME IDET_PARTNER_STREET IDET_PARTNER_STREET2 IDET_PARTNER_CITY IDET_PARTNER_OFFICENO IDET_PARTNER_MOBILENO IDET_PARTNER_EMAIL IDET_PARTNER_FAX IDET_ZIP ID_ALL_STATE_DROPDOWNLIST ID_ALL_COUNTRY_DROPDOWNLIST", SearchPartner, ()),
+ (CommandButtonProcessor, "IDPB_WRITE_CHANGES ID_PARTNER_DROPLIST IDET_PARTNER_CONTACT_NAME IDET_PARTNER_STREET IDET_PARTNER_STREET2 IDET_PARTNER_CITY ID_ALL_STATE_DROPDOWNLIST ID_ALL_COUNTRY_DROPDOWNLIST IDET_PARTNER_OFFICENO IDET_PARTNER_MOBILENO IDET_PARTNER_EMAIL IDET_PARTNER_FAX IDET_ZIP", WritePartner, ()),
+ (CloseButtonProcessor, "IDCANCEL"),
+ (DialogCommand, "ID_NEW_PART_BUTTON", "IDD_NEW_PARTNER_DIALOG" ),
+ (DialogCommand, "IDPB_NEWPARTNER_BUTTON" , "IDD_NEW_CONTACT_DIALOG")
+ ),
+}
diff --git a/addons/outlook/plugin/openerp-outlook-plugin/dialogs/dlgcore.py b/addons/outlook/plugin/openerp-outlook-plugin/dialogs/dlgcore.py
index 40603d9d60a..efccf4f494e 100755
--- a/addons/outlook/plugin/openerp-outlook-plugin/dialogs/dlgcore.py
+++ b/addons/outlook/plugin/openerp-outlook-plugin/dialogs/dlgcore.py
@@ -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
diff --git a/addons/outlook/plugin/openerp-outlook-plugin/dialogs/dlgutils.py b/addons/outlook/plugin/openerp-outlook-plugin/dialogs/dlgutils.py
index 44d83f2d88d..8ffc4e62d22 100755
--- a/addons/outlook/plugin/openerp-outlook-plugin/dialogs/dlgutils.py
+++ b/addons/outlook/plugin/openerp-outlook-plugin/dialogs/dlgutils.py
@@ -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)
diff --git a/addons/outlook/plugin/openerp-outlook-plugin/dialogs/opt_processors.py b/addons/outlook/plugin/openerp-outlook-plugin/dialogs/opt_processors.py
index 4397f27a609..ae21ba1c538 100755
--- a/addons/outlook/plugin/openerp-outlook-plugin/dialogs/opt_processors.py
+++ b/addons/outlook/plugin/openerp-outlook-plugin/dialogs/opt_processors.py
@@ -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 \ No newline at end of file
diff --git a/addons/outlook/plugin/openerp-outlook-plugin/dialogs/processors.py b/addons/outlook/plugin/openerp-outlook-plugin/dialogs/processors.py
index 6c17fb51c41..0b427852c89 100755
--- a/addons/outlook/plugin/openerp-outlook-plugin/dialogs/processors.py
+++ b/addons/outlook/plugin/openerp-outlook-plugin/dialogs/processors.py
@@ -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)
diff --git a/addons/outlook/plugin/openerp-outlook-plugin/dialogs/resources/__init__.py b/addons/outlook/plugin/openerp-outlook-plugin/dialogs/resources/__init__.py
index cf0b8ec9340..abeff9ae69b 100755
--- a/addons/outlook/plugin/openerp-outlook-plugin/dialogs/resources/__init__.py
+++ b/addons/outlook/plugin/openerp-outlook-plugin/dialogs/resources/__init__.py
@@ -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):
diff --git a/addons/outlook/plugin/openerp-outlook-plugin/dialogs/resources/dialogs.py b/addons/outlook/plugin/openerp-outlook-plugin/dialogs/resources/dialogs.py
index 6e277297356..81bf5d8b1e6 100755
--- a/addons/outlook/plugin/openerp-outlook-plugin/dialogs/resources/dialogs.py
+++ b/addons/outlook/plugin/openerp-outlook-plugin/dialogs/resources/dialogs.py
@@ -1,9 +1,9 @@
-#C:\Python26\openerp-outlook-plugin\plugin_trunk\dialogs\resources\dialogs.py
-#This is a generated file. Please edit C:\Python26\openerp-outlook-plugin\plugin_trunk\dialogs\resources\dialogs.rc instead.
-_rc_size_=11427
-_rc_mtime_=1280992064
+#C:\Documents and Settings\TinyERP\Desktop\OpenERP-Outlook-PlugIn\openerp-outlook-plugin\dialogs\resources\dialogs.py
+#This is a generated file. Please edit C:\Documents and Settings\TinyERP\Desktop\OpenERP-Outlook-PlugIn\openerp-outlook-plugin\dialogs\resources\dialogs.rc instead.
+_rc_size_=11409
+_rc_mtime_=1285078254
class FakeParser:
- dialogs = {'IDD_VIEW_PARTNER_DIALOG': [['Open Contact', (0, 0, 350, 215), -1865940928, 1024, (8, 'Tahoma')], [130, 'Email ID : ', -1, (32, 17, 40, 12), 1342177280], [129, '', 2051, (70, 15, 200, 12), 1350631552], [128, 'Search Partner ', 2052, (280, 15, 60, 14), 1342242816], [130, 'Partner Name : ', -1, (13, 42, 50, 17), 1342177280], [133, '', 2069, (70, 42, 200, 80), 1344339971], [128, 'New Partner', 2070, (280, 41, 60, 14), 1342242816], [128, 'Postal Address ', 2024, (10, 65, 175, 125), 1342177287], [130, 'Contact Name : ', -1, (18, 83, 50, 17), 1342177280], [129, '', 2046, (76, 82, 100, 12), 1350631552], [130, 'Street : ', -1, (18, 97, 50, 17), 1342177280], [129, '', 2053, (76, 96, 100, 12), 1350631552], [130, 'Street2 : ', -1, (18, 112, 50, 17), 1342177280], [129, '', 2054, (76, 111, 100, 12), 1350631552], [130, 'Zip : ', -1, (18, 126, 50, 14), 1342177280], [129, '', 40010, (76, 125, 100, 12), 1350631552], [130, 'City : ', -1, (18, 140, 50, 17), 1342177280], [129, '', 40011, (76, 139, 100, 12), 1350631552], [130, 'Fed. State : ', -1, (18, 154, 50, 17), 1342177280], [133, '', 2060, (76, 153, 100, 50), 1344339971], [130, 'Country :', -1, (18, 169, 35, 17), 1342177280], [133, '', 2061, (76, 168, 100, 50), 1344339971], [128, 'Communication ', 2024, (188, 65, 152, 125), 1342177287], [130, 'Phone : ', -1, (194, 83, 30, 17), 1342177280], [129, '', 2048, (224, 82, 100, 12), 1350631552], [130, 'Mobile : ', -1, (194, 97, 30, 17), 1342177280], [129, '', 2050, (224, 96, 100, 12), 1350631552], [130, 'Email : ', -1, (194, 111, 30, 17), 1342177280], [129, '', 2058, (224, 110, 100, 12), 1350568064], [130, 'Fax : ', -1, (194, 125, 30, 17), 1342177280], [129, '', 2047, (224, 124, 100, 12), 1350631552], [128, 'Create a New Contact', 2071, (124, 195, 82, 14), 1342242816], [128, 'Save', 2059, (213, 195, 60, 14), 1342242816], [128, 'Cancel', 2, (281, 195, 60, 14), 1342242816]], 'IDD_GENERAL': [['Connection Parameters', (0, 0, 430, 210), 1355284544, None, (8, 'Tahoma')], [128, '', 2024, (10, 10, 250, 130), 1342177287], [130, 'Server : ', -1, (30, 30, 100, 17), 1342177280], [129, '', 2003, (85, 30, 120, 12), 1350633472], [128, 'Change', 2021, (210, 30, 30, 13), 1342242816], [130, 'Database : ', -1, (30, 50, 100, 17), 1342177280], [133, '', 2004, (85, 50, 120, 40), 1344339971], [128, 'Reload', 2038, (210, 50, 30, 13), 1342242816], [130, 'Username : ', -1, (30, 70, 100, 17), 1342177280], [129, '', 2005, (85, 70, 154, 12), 1350631552], [130, 'Password : ', -1, (30, 90, 100, 17), 1342177280], [129, '', 2006, (85, 90, 154, 12), 1350631584], [128, 'Connect', 2007, (179, 110, 60, 13), 1342242816]], 'IDD_OBJECT_SETTINGS': [['Documents Setting', (0, 0, 430, 210), 1355284672, 1024, (8, 'Tahoma')], [128, 'Document Attributes', 2024, (2, 2, 340, 32), 1342177287], [130, 'Title', -1, (6, 15, 30, 17), 1342177280], [129, '', 2013, (20, 14, 57, 12), 1350631552], [130, 'Document Name', -1, (83, 15, 60, 17), 1342177280], [129, '', 2014, (138, 14, 57, 12), 1350631552], [130, 'Image', -1, (200, 15, 20, 17), 1342177280], [129, '', 2015, (220, 14, 57, 12), 1350631552], [128, 'Load Image', 2010, (286, 13, 50, 15), 1342242816], [128, 'Add', 2011, (347, 13, 38, 15), 1342242816], [128, 'Remove', 2012, (391, 13, 38, 15), 1342242816], ['SysListView32', 'List1', 2016, (8, 40, 535, 160), 1353711657]], 'IDD_NEW_PARTNER_DIALOG': [['Create a New Partner', (0, 0, 140, 40), -1865940928, 1024, (8, 'Tahoma')], [130, 'Name : ', -1, (5, 3, 100, 17), 1342177280], [129, '', 2036, (40, 3, 94, 12), 1350631552], [128, 'Cancel', 2, (90, 22, 45, 14), 1342242816], [128, 'Save', 2035, (40, 22, 45, 14), 1342242817]], 'IDD_MANAGER': [['OpenERP Configuarion', (0, 0, 460, 260), -1865940800, None, (8, 'Tahoma')], [128, 'Cancel', 2008, (400, 239, 50, 14), 1342177281], ['SysTabControl32', '', 1068, (8, 7, 440, 228), 1342177280], ['SysListView32', '', 2016, (0, 0, 0, 0), 1353711657]], 'IDD_ABOUT': [['About', (0, 0, 430, 210), 1355284672, 1024, (8, 'Tahoma')], [128, 'About Plugin', -1, (7, 3, 422, 200), 1342177287], [130, '1062', 1062, (60, 30, 20, 20), 1342179342], [130, '', 2028, (80, 90, 250, 100), 1342177280]], 'IDD_NEW_CONTACT_DIALOG': [['Create a New Contact', (0, 0, 350, 190), -1865940928, 1024, (8, 'Tahoma')], [130, 'Select Partner : ', -1, (13, 20, 50, 17), 1342177280], [133, '', 2032, (70, 18, 200, 80), 1344339971], [128, 'New Partner', 2033, (280, 17, 55, 14), 1342242816], [128, 'Postal Address ', 2024, (10, 35, 175, 125), 1342177287], [130, 'Contact Name : ', -1, (18, 53, 100, 17), 1342177280], [129, '', 40005, (76, 52, 100, 12), 1350631552], [130, 'Street : ', -1, (18, 67, 40, 17), 1342177280], [129, '', 2062, (76, 66, 100, 12), 1350631552], [130, 'Street2 : ', -1, (18, 81, 40, 17), 1342177280], [129, '', 2063, (76, 80, 100, 12), 1350631552], [130, 'Zip : ', -1, (18, 94, 50, 17), 1342177280], [129, '', 2068, (76, 93, 100, 12), 1350631552], [130, 'City : ', -1, (18, 108, 50, 17), 1342177280], [129, '', 2067, (76, 107, 100, 12), 1350631552], [130, 'Fed. State : ', -1, (18, 123, 40, 17), 1342177280], [133, '', 2064, (76, 122, 100, 80), 1344339971], [130, 'Country : ', -1, (18, 137, 40, 17), 1342177280], [133, '', 2065, (76, 136, 100, 80), 1344339971], [128, 'Communication ', 2024, (188, 35, 150, 125), 1342177287], [130, 'Office : ', -1, (194, 53, 30, 17), 1342177280], [129, '', 40006, (224, 52, 100, 12), 1350631552], [130, 'Mobile : ', -1, (194, 67, 30, 17), 1342177280], [129, '', 40007, (224, 66, 100, 12), 1350631552], [130, 'Fax : ', -1, (194, 81, 30, 17), 1342177280], [129, '', 2066, (224, 80, 100, 12), 1350631552], [130, 'Email : ', -1, (194, 95, 30, 17), 1342177280], [129, '', 40008, (224, 94, 100, 12), 1350631552], [128, 'Cancel', 2, (290, 170, 45, 14), 1342242816], [128, 'Save', 40009, (240, 170, 45, 14), 1342242816]], 'IDD_SERVER_PORT_DIALOG': [['OpenERP Connection', (0, 0, 160, 55), -1865940928, 1024, (8, 'Tahoma')], [130, 'Server : ', -1, (5, 3, 150, 17), 1342177280], [129, '', 2001, (40, 3, 100, 12), 1350631552], [130, 'Port : ', -1, (5, 18, 100, 17), 1342177280], [129, '', 2002, (40, 18, 100, 12), 1350631552], [128, 'Close', 2, (110, 35, 45, 14), 1342242816], [128, 'OK', 1, (60, 35, 45, 14), 1342242817]], 'IDD_SYNC': [['Archive to OpenERP', (0, 0, 470, 320), -1865940928, 1024, (8, 'Tahoma')], [128, ' Link to an Existing Documents ', 2024, (8, 5, 250, 290), 1342242823], [130, 'Search for : ', -1, (15, 17, 40, 12), 1342177280], [129, '', 40003, (60, 15, 120, 12), 1350631552], [128, 'Search', 40004, (187, 15, 40, 14), 1342242816], [130, 'Documents : ', -1, (15, 140, 100, 14), 1342177280], ['SysListView32', 'List1', 2026, (15, 150, 234, 110), 1350631433], [128, 'Archive to OpenERP', 2019, (160, 270, 85, 14), 1342242816], [128, ' Create a Document ', 2024, (263, 5, 202, 100), 1342242823], [130, 'Type of Document : ', -1, (266, 25, 100, 12), 1342177280], [133, '', 2025, (332, 24, 75, 45), 1344339971], [128, 'Create', 2020, (412, 23, 50, 14), 1342242816], [128, ' Create a Contact ', 2024, (263, 110, 202, 185), 1342242823], [130, 'Create a New Contact : ', -1, (280, 140, 100, 12), 1342177280], [128, 'Create Contact', 2018, (360, 138, 60, 14), 1342242816], [128, 'Close', 2, (385, 300, 60, 14), 1342242816]]}
+ dialogs = {'IDD_VIEW_PARTNER_DIALOG': [['Open Contact', (0, 0, 350, 215), -1865940928, 1024, (8, 'Tahoma')], [130, 'Email ID : ', -1, (32, 17, 40, 12), 1342177280], [129, '', 2051, (70, 15, 200, 12), 1350631552], [128, 'Search Partner ', 2052, (280, 15, 60, 14), 1342242816], [130, 'Partner Name : ', -1, (13, 42, 50, 17), 1342177280], [133, '', 2069, (70, 42, 200, 80), 1344339971], [128, 'New Partner', 2070, (280, 41, 60, 14), 1342242816], [128, 'Postal Address ', 2024, (10, 65, 175, 125), 1342177287], [130, 'Contact Name : ', -1, (18, 83, 50, 17), 1342177280], [129, '', 2046, (76, 82, 100, 12), 1350631552], [130, 'Street : ', -1, (18, 97, 50, 17), 1342177280], [129, '', 2053, (76, 96, 100, 12), 1350631552], [130, 'Street2 : ', -1, (18, 112, 50, 17), 1342177280], [129, '', 2054, (76, 111, 100, 12), 1350631552], [130, 'Zip : ', -1, (18, 126, 50, 14), 1342177280], [129, '', 40010, (76, 125, 100, 12), 1350631552], [130, 'City : ', -1, (18, 140, 50, 17), 1342177280], [129, '', 40011, (76, 139, 100, 12), 1350631552], [130, 'Fed. State : ', -1, (18, 154, 50, 17), 1342177280], [133, '', 2060, (76, 153, 100, 50), 1344339971], [130, 'Country :', -1, (18, 169, 35, 17), 1342177280], [133, '', 2061, (76, 168, 100, 50), 1344339971], [128, 'Communication ', 2024, (188, 65, 152, 125), 1342177287], [130, 'Phone : ', -1, (194, 83, 30, 17), 1342177280], [129, '', 2048, (224, 82, 100, 12), 1350631552], [130, 'Mobile : ', -1, (194, 97, 30, 17), 1342177280], [129, '', 2050, (224, 96, 100, 12), 1350631552], [130, 'Email : ', -1, (194, 111, 30, 17), 1342177280], [129, '', 2058, (224, 110, 100, 12), 1350568064], [130, 'Fax : ', -1, (194, 125, 30, 17), 1342177280], [129, '', 2047, (224, 124, 100, 12), 1350631552], [128, 'Create a New Contact', 2071, (124, 195, 82, 14), 1342242816], [128, 'Save', 2059, (213, 195, 60, 14), 1342242816], [128, 'Cancel', 2, (281, 195, 60, 14), 1342242816]], 'IDD_GENERAL': [['Connection Parameters', (0, 0, 430, 210), 1355284544, None, (8, 'Tahoma')], [128, '', 2024, (10, 10, 250, 130), 1342177287], [130, 'Server : ', -1, (30, 30, 100, 17), 1342177280], [129, '', 2003, (85, 30, 120, 12), 1350633472], [128, 'Change', 2021, (210, 30, 30, 13), 1342242816], [130, 'Database : ', -1, (30, 50, 100, 17), 1342177280], [133, '', 2004, (85, 50, 120, 40), 1344339971], [128, 'Reload', 2038, (210, 50, 30, 13), 1342242816], [130, 'Username : ', -1, (30, 70, 100, 17), 1342177280], [129, '', 2005, (85, 70, 154, 12), 1350631552], [130, 'Password : ', -1, (30, 90, 100, 17), 1342177280], [129, '', 2006, (85, 90, 154, 12), 1350631584], [128, 'Connect', 2007, (179, 110, 60, 13), 1342242816]], 'IDD_OBJECT_SETTINGS': [['Documents Setting', (0, 0, 430, 210), 1355284672, 1024, (8, 'Tahoma')], [128, 'Document Attributes', 2024, (2, 2, 340, 32), 1342177287], [130, 'Title', -1, (6, 15, 30, 17), 1342177280], [129, '', 2013, (20, 14, 57, 12), 1350631552], [130, 'Document Name', -1, (83, 15, 60, 17), 1342177280], [129, '', 2014, (138, 14, 57, 12), 1350631552], [130, 'Image', -1, (200, 15, 20, 17), 1342177280], [129, '', 2015, (220, 14, 57, 12), 1350631552], [128, 'Load Image', 2010, (286, 13, 50, 15), 1342242816], [128, 'Add', 2011, (347, 13, 38, 15), 1342242816], [128, 'Remove', 2012, (391, 13, 38, 15), 1342242816], ['SysListView32', 'List1', 2016, (8, 40, 535, 160), 1353711657]], 'IDD_NEW_PARTNER_DIALOG': [['Create a New Partner', (0, 0, 140, 40), -1865940928, 1024, (8, 'Tahoma')], [130, 'Name : ', -1, (5, 3, 100, 17), 1342177280], [129, '', 2036, (40, 3, 94, 12), 1350631552], [128, 'Cancel', 2, (90, 22, 45, 14), 1342242816], [128, 'Save', 2035, (40, 22, 45, 14), 1342242817]], 'IDD_MANAGER': [['OpenERP Configuarion', (0, 0, 460, 260), -1865940800, None, (8, 'Tahoma')], [128, 'Close', 2008, (400, 239, 50, 14), 1342177281], ['SysTabControl32', '', 1068, (8, 7, 440, 228), 1342177280], ['SysListView32', '', 2016, (0, 0, 0, 0), 1353711657]], 'IDD_ABOUT': [['About', (0, 0, 430, 210), 1355284672, 1024, (8, 'Tahoma')], [128, 'About Plugin', -1, (7, 3, 422, 200), 1342177287], [130, '1062', 1062, (60, 30, 20, 20), 1342179342], [130, '', 2028, (80, 90, 300, 100), 1342177280]], 'IDD_NEW_CONTACT_DIALOG': [['Create a New Contact', (0, 0, 350, 190), -1865940928, 1024, (8, 'Tahoma')], [130, 'Select Partner : ', -1, (13, 20, 50, 17), 1342177280], [133, '', 2032, (70, 18, 200, 80), 1344339971], [128, 'New Partner', 2033, (280, 17, 55, 14), 1342242816], [128, 'Postal Address ', 2024, (10, 35, 175, 125), 1342177287], [130, 'Contact Name : ', -1, (18, 53, 100, 17), 1342177280], [129, '', 40005, (76, 52, 100, 12), 1350631552], [130, 'Street : ', -1, (18, 67, 40, 17), 1342177280], [129, '', 2062, (76, 66, 100, 12), 1350631552], [130, 'Street2 : ', -1, (18, 81, 40, 17), 1342177280], [129, '', 2063, (76, 80, 100, 12), 1350631552], [130, 'Zip : ', -1, (18, 94, 50, 17), 1342177280], [129, '', 2068, (76, 93, 100, 12), 1350631552], [130, 'City : ', -1, (18, 108, 50, 17), 1342177280], [129, '', 2067, (76, 107, 100, 12), 1350631552], [130, 'Fed. State : ', -1, (18, 123, 40, 17), 1342177280], [133, '', 2064, (76, 122, 100, 80), 1344339971], [130, 'Country : ', -1, (18, 137, 40, 17), 1342177280], [133, '', 2065, (76, 136, 100, 80), 1344339971], [128, 'Communication ', 2024, (188, 35, 150, 125), 1342177287], [130, 'Office : ', -1, (194, 53, 30, 17), 1342177280], [129, '', 40006, (224, 52, 100, 12), 1350631552], [130, 'Mobile : ', -1, (194, 67, 30, 17), 1342177280], [129, '', 40007, (224, 66, 100, 12), 1350631552], [130, 'Fax : ', -1, (194, 81, 30, 17), 1342177280], [129, '', 2066, (224, 80, 100, 12), 1350631552], [130, 'Email : ', -1, (194, 95, 30, 17), 1342177280], [129, '', 40008, (224, 94, 100, 12), 1350631552], [128, 'Cancel', 2, (290, 170, 45, 14), 1342242816], [128, 'Save', 40009, (240, 170, 45, 14), 1342242816]], 'IDD_SERVER_PORT_DIALOG': [['OpenERP Connection', (0, 0, 160, 55), -1865940928, 1024, (8, 'Tahoma')], [130, 'Server : ', -1, (5, 3, 150, 17), 1342177280], [129, '', 2001, (40, 3, 100, 12), 1350631552], [130, 'Port : ', -1, (5, 18, 100, 17), 1342177280], [129, '', 2002, (40, 18, 100, 12), 1350631552], [128, 'Close', 2, (110, 35, 45, 14), 1342242816], [128, 'OK', 1, (60, 35, 45, 14), 1342242817]], 'IDD_SYNC': [['Push to OpenERP', (0, 0, 470, 320), -1865940928, 1024, (8, 'Tahoma')], [128, ' Link to an Existing Documents ', 2024, (8, 5, 250, 290), 1342242823], [130, 'Search for : ', -1, (15, 17, 40, 12), 1342177280], [129, '', 40003, (60, 15, 120, 12), 1350631552], [128, 'Search', 40004, (187, 15, 40, 14), 1342242816], [130, 'Documents : ', -1, (15, 140, 100, 14), 1342177280], ['SysListView32', 'List1', 2026, (15, 150, 234, 110), 1350631433], [128, 'Push', 2019, (160, 270, 85, 14), 1342242816], [128, ' Create a Document ', 2024, (263, 5, 202, 100), 1342242823], [130, 'Type of Document : ', -1, (266, 25, 100, 12), 1342177280], [133, '', 2025, (332, 24, 75, 45), 1344339971], [128, 'Create', 2020, (412, 23, 50, 14), 1342242816], [128, ' Create a Contact ', 2024, (263, 110, 202, 185), 1342242823], [130, 'Create a New Contact : ', -1, (280, 140, 100, 12), 1342177280], [128, 'Create Contact', 2018, (360, 138, 60, 14), 1342242816], [128, 'Close', 2, (385, 300, 60, 14), 1342242816]]}
ids = {'IDC_BUT_DEL_OBJECT': 2012, 'IDC_DELAY1_SLIDER': 1056, 'IDC_PROGRESS': 1000, 'IDD_MANAGER': 101, 'IDC_ABOUT': 2028, 'IDD_DIAGNOSTIC': 113, 'IDET_PARTNER_COUNTRY': 2057, 'IDD_TRAINING': 102, 'ID_CONTACT_EMAIL_TEXT': 40008, 'IDC_DELAY2_TEXT': 1059, 'IDC_DELAY1_TEXT': 1057, 'IDD_WIZARD': 114, 'IDC_CHKBX': 2023, 'IDC_STATIC_HAM': 1002, 'IDC_PROGRESS_TEXT': 1001, 'IDR_XMLS_PROTOCOL': 2042, 'IDD_GENERAL': 108, 'IDD_ABOUT': 2027, 'IDC_TAB': 1068, 'IDC_FOLDER_UNSURE': 1033, 'IDC_VERBOSE_LOG': 1061, 'IDC_EDIT1': 1094, 'IDC_BROWSE': 1037, 'ID_DB_DROPDOWNLIST': 2004, 'IDC_BACK_BTN': 1069, 'IDD_WIZARD_FINISHED_UNCONFIGURED': 119, 'IDC_ACTION_CERTAIN': 1025, 'IDC_BUT_ACT_ALL': 1019, 'IDD_FILTER_NOW': 104, 'ID_PROTOCOL_GRP': 2040, 'IDC_HEADER': 2017, 'IDC_MARK_SPAM_AS_READ': 1047, 'ID_PARTNER_NAME_TEXT': 2036, 'IDC_RECOVER_RS': 1075, 'IDC_NAME_LIST1': 2037, 'ID_CONTACT_OFFICE_TEXT': 40006, 'IDC_STATIC': -1, 'IDC_PAGE_PLACEHOLDER': 1078, 'IDC_BROWSE_WATCH': 1039, 'IDET_ZIP': 40010, 'IDET_PARTNER_CITY': 40011, 'IDC_FOLDER_HAM': 1083, 'IDD_WIZARD_FOLDERS_REST': 117, 'IDC_SHOW_DATA_FOLDER': 1071, 'IDC_BUT_ACT_SCORE': 1018, '_APS_NEXT_RESOURCE_VALUE': 128, '_APS_NEXT_SYMED_VALUE': 101, 'IDC_CONTACT_LIST': 2029, 'IDC_SLIDER_CERTAIN': 1023, 'IDET_PARTNER_STREET': 2053, 'IDC_BUT_UNREAD': 1020, 'ID_PARTNER_DROPDOWNLIST': 2032, 'ID_COUNTRY_DROPLIST': 2065, 'IDC_BUT_ABOUT': 1017, 'IDC_BUT_RESCORE': 1008, 'IDC_BUT_SEARCHSUB': 1041, 'IDC_BUT_TRAIN_FROM_SPAM_FOLDER': 1010, 'IDET_PARTNER_MOBILENO': 2050, 'IDD_VIEW_PARTNER_DIALOG': 2044, 'IDD_WIZARD_FOLDERS_TRAIN': 120, 'IDC_BUT_FILTER_ENABLE': 1013, 'IDC_ABOUT_BTN': 1072, 'IDD_WIZARD_FINISHED_TRAINED': 122, 'ID_SERVER': 2001, 'IDD_FOLDER_SELECTOR': 105, 'IDC_BUT_SET_SERVER_PORT': 2021, 'ID_DONE': 2008, 'IDC_LIST_FOLDERS': 1040, 'IDC_IMAGE_PATH': 2015, 'IDB_SBWIZLOGO': 125, 'IDB_OPENERPLOGO': 1062, 'ID_ZIP_TEXT': 2068, 'IDD_NEW_PARTNER_DIALOG': 2034, 'ID_PARTNER_DROPLIST': 2069, 'IDC_BUT_VIEW_LOG': 1093, 'IDC_STATUS2': 1044, 'IDC_STATUS1': 1043, 'IDCANCEL': 2, 'IDC_BROWSE_HAM': 1004, 'ID_BUT_TESTCONNECTION': 2007, 'IDR_NETRPC_PROTOCOL': 2043, 'IDC_BROWSE_SPAM': 1005, 'IDD_WIZARD_FINISHED_UNTRAINED': 116, 'IDC_MARK_UNSURE_AS_READ': 1051, 'ID_PARTNER_CITY_TEXT': 2067, 'IDC_BUT_WIZARD': 1070, 'IDC_VERSION': 1009, 'ID_NEW_PARTNER_BUTTON': 2033, 'IDC_FOLDER_NAMES': 1036, 'ID_ATT_METHOD_DROPDOWNLIST': 2025, 'IDC_BUT_TIMER_ENABLED': 1091, 'IDPB_WRITE_CHANGES': 2059, 'IDC_SLIDER_UNSURE': 1029, 'IDC_BUT_NEW': 1046, 'IDC_FOLDER_WATCH': 1038, 'IDC_BUT_UNTRAINED': 1088, 'IDC_STATIC_SPAM': 1003, 'IDD_NEW_CONTACT_DIALOG': 2031, 'IDC_EDIT_UNSURE': 1030, 'IDC_BUT_CLEARALL': 1042, 'IDC_BUT_UNSEEN': 1021, 'IDC_OBJECT_NAME': 2014, 'IDD_WIZARD_FOLDERS_WATCH': 118, 'IDC_BUT_SAVE_OBJECT': 2011, 'ID_FED_STATE_DROPLIST': 2064, 'ID_ALL_COUNTRY_DROPDOWNLIST': 2061, 'IDC_EDIT_CERTAIN': 1024, 'IDC_BUT_FILTER_DEFINE': 1016, 'ID_NEW_PART_BUTTON': 2070, 'ID_FAX_TEXT': 2066, 'IDD_WIZARD_TRAINING_IS_IMPORTANT': 123, 'ID_ALL_STATE_DROPDOWNLIST': 2060, 'IDC_INBOX_TIMER_ONLY': 1060, 'IDPB_SEARCH_PARTNER': 2052, 'ID_USERNAME': 2005, '_APS_NEXT_CONTROL_VALUE': 1096, 'IDC_WIZ_GRAPHIC': 1092, 'IDD_OBJECT_SETTINGS': 2009, 'IDD_FILTER_UNSURE': 111, 'IDC_DEL_SPAM_RS': 1074, 'ID_SERVER_PORT': 2003, 'IDR_XML_PROTOCOL': 2041, 'IDET_PARTNER_OFFICENO': 2048, 'IDB_FOLDERS': 127, 'IDC_BUT_PREPARATION': 1081, 'ID_STREET2_TEXT': 2063, 'IDC_DELAY2_SLIDER': 1058, 'IDC_SAVE_SPAM_SCORE': 1048, 'IDC_OBJECT_TITLE': 2013, 'IDC_FOLDER_CERTAIN': 1027, 'IDC_BROWSE_UNSURE': 1034, 'IDC_STATISTICS': 1095, 'ID_MAKE_ATTACHMENT': 2019, 'IDC_BUT_LOAD_IMAGE': 2010, 'IDC_NAME_LIST': 2026, 'IDC_BUT_TRAIN_TO_SPAM_FOLDER': 1011, 'IDC_BUT_RESET': 1073, 'IDET_PARTNER_CONTACT_NAME': 2046, 'ID_CONTACT_MOBILE_TEXT': 40007, 'IDC_ACTION_UNSURE': 1031, 'IDD_WIZARD_TRAIN': 121, 'IDC_STATIC_GROUP': 2024, 'IDPB_NEWPARTNER_BUTTON': 2071, 'IDD_SYNC': 40002, 'IDD_WIZARD_FINISHED_TRAIN_LATER': 124, 'IDET_PARTNER_NAME': 2045, 'ID_CONTACT_NAME_TEXT': 40005, 'IDC_BUT_REBUILD': 1007, 'IDET_PARTNER_STREET2': 2054, 'ID_SAVE_PARTNER_BUTTON': 2035, 'ID_STREET_TEXT': 2062, '_APS_NEXT_COMMAND_VALUE': 40001, 'IDET_SEARCH_PARTNER': 2051, 'ID_PORT': 2002, 'IDD_SERVER_PORT_DIALOG': 2022, 'ID_SEARCH_TEXT': 40003, 'ID_SEARCH': 40004, 'ID_CREATE_CONTACT': 2018, 'IDC_FORWARD_BTN': 1077, 'IDC_TRAINING_STATUS': 1035, 'IDD_WIZARD_WELCOME': 115, 'IDET_PARTNER_FAX': 2058, 'IDC_BUT_TRAIN': 1089, 'IDC_LIST': 2016, 'ID_CREATE_CASE': 2020, 'IDET_PARTNER_EMAIL': 2047, 'IDC_START': 1006, 'IDD_FILTER': 103, 'IDC_RELOAD': 2038, 'ID_PASSWORD': 2006, 'ID_NAME_TEXT': 2030, 'IDC_FILTER_STATUS': 1014, 'ID_CONTACT_SAVE_BUTTON': 40009, 'IDOK': 1, 'IDC_BROWSE_CERTAIN': 1028, 'IDC_BUT_SHOW_DIAGNOSTICS': 1080, 'IDC_BUT_TRAIN_NOW': 1012}
names = {1024: 'IDC_EDIT_CERTAIN', 1: 'IDOK', 2: 'IDCANCEL', 1027: 'IDC_FOLDER_CERTAIN', 1028: 'IDC_BROWSE_CERTAIN', 1029: 'IDC_SLIDER_UNSURE', 1030: 'IDC_EDIT_UNSURE', 1031: 'IDC_ACTION_UNSURE', 1033: 'IDC_FOLDER_UNSURE', 1034: 'IDC_BROWSE_UNSURE', 1035: 'IDC_TRAINING_STATUS', 1036: 'IDC_FOLDER_NAMES', 1037: 'IDC_BROWSE', 1038: 'IDC_FOLDER_WATCH', 1039: 'IDC_BROWSE_WATCH', 1040: 'IDC_LIST_FOLDERS', 1041: 'IDC_BUT_SEARCHSUB', 1042: 'IDC_BUT_CLEARALL', 1043: 'IDC_STATUS1', 1044: 'IDC_STATUS2', 2069: 'ID_PARTNER_DROPLIST', 1046: 'IDC_BUT_NEW', 1047: 'IDC_MARK_SPAM_AS_READ', 1048: 'IDC_SAVE_SPAM_SCORE', 2052: 'IDPB_SEARCH_PARTNER', 1051: 'IDC_MARK_UNSURE_AS_READ', 2053: 'IDET_PARTNER_STREET', 1056: 'IDC_DELAY1_SLIDER', 1057: 'IDC_DELAY1_TEXT', 1058: 'IDC_DELAY2_SLIDER', 1059: 'IDC_DELAY2_TEXT', 1060: 'IDC_INBOX_TIMER_ONLY', 1061: 'IDC_VERBOSE_LOG', 1062: 'IDB_OPENERPLOGO', 2047: 'IDET_PARTNER_EMAIL', 1068: 'IDC_TAB', 1069: 'IDC_BACK_BTN', 1070: 'IDC_BUT_WIZARD', 1071: 'IDC_SHOW_DATA_FOLDER', 1072: 'IDC_ABOUT_BTN', 1073: 'IDC_BUT_RESET', 1074: 'IDC_DEL_SPAM_RS', 1075: 'IDC_RECOVER_RS', 1077: 'IDC_FORWARD_BTN', 1078: 'IDC_PAGE_PLACEHOLDER', 2057: 'IDET_PARTNER_COUNTRY', 1080: 'IDC_BUT_SHOW_DIAGNOSTICS', 1081: 'IDC_BUT_PREPARATION', 1083: 'IDC_FOLDER_HAM', 2058: 'IDET_PARTNER_FAX', 1088: 'IDC_BUT_UNTRAINED', 1089: 'IDC_BUT_TRAIN', 40002: 'IDD_SYNC', 1091: 'IDC_BUT_TIMER_ENABLED', 1025: 'IDC_ACTION_CERTAIN', 1093: 'IDC_BUT_VIEW_LOG', 1094: 'IDC_EDIT1', 1095: 'IDC_STATISTICS', 1096: '_APS_NEXT_CONTROL_VALUE', 2060: 'ID_ALL_STATE_DROPDOWNLIST', 40010: 'IDET_ZIP', 40011: 'IDET_PARTNER_CITY', 2061: 'ID_ALL_COUNTRY_DROPDOWNLIST', 2062: 'ID_STREET_TEXT', 2063: 'ID_STREET2_TEXT', 2064: 'ID_FED_STATE_DROPLIST', 101: 'IDD_MANAGER', 102: 'IDD_TRAINING', 103: 'IDD_FILTER', 104: 'IDD_FILTER_NOW', 105: 'IDD_FOLDER_SELECTOR', 106: 'IDD_ABOUT', 108: 'IDD_GENERAL', 2066: 'ID_FAX_TEXT', 111: 'IDD_FILTER_UNSURE', 113: 'IDD_DIAGNOSTIC', 114: 'IDD_WIZARD', 115: 'IDD_WIZARD_WELCOME', 116: 'IDD_WIZARD_FINISHED_UNTRAINED', 117: 'IDD_WIZARD_FOLDERS_REST', 118: 'IDD_WIZARD_FOLDERS_WATCH', 119: 'IDD_WIZARD_FINISHED_UNCONFIGURED', 120: 'IDD_WIZARD_FOLDERS_TRAIN', 121: 'IDD_WIZARD_TRAIN', 122: 'IDD_WIZARD_FINISHED_TRAINED', 123: 'IDD_WIZARD_TRAINING_IS_IMPORTANT', 124: 'IDD_WIZARD_FINISHED_TRAIN_LATER', 125: 'IDB_SBWIZLOGO', 127: 'IDB_FOLDERS', 2067: 'ID_PARTNER_CITY_TEXT', 2050: 'IDET_PARTNER_MOBILENO', 2070: 'ID_NEW_PART_BUTTON', 2071: 'IDPB_NEWPARTNER_BUTTON', 2068: 'ID_ZIP_TEXT', 2051: 'IDET_SEARCH_PARTNER', 40004: 'ID_SEARCH', 2046: 'IDET_PARTNER_CONTACT_NAME', 2054: 'IDET_PARTNER_STREET2', 128: '_APS_NEXT_RESOURCE_VALUE', 2040: 'ID_PROTOCOL_GRP', 2065: 'ID_COUNTRY_DROPLIST', 2048: 'IDET_PARTNER_OFFICENO', 2024: 'IDC_STATIC_GROUP', 2041: 'IDR_XML_PROTOCOL', 2025: 'ID_ATT_METHOD_DROPDOWNLIST', 2026: 'IDC_NAME_LIST', 2027: 'IDD_ABOUT', 40001: '_APS_NEXT_COMMAND_VALUE', 2028: 'IDC_ABOUT', 2029: 'IDC_CONTACT_LIST', 2059: 'IDPB_WRITE_CHANGES', 2042: 'IDR_XMLS_PROTOCOL', 40003: 'ID_SEARCH_TEXT', 2030: 'ID_NAME_TEXT', 1092: 'IDC_WIZ_GRAPHIC', 2031: 'IDD_NEW_CONTACT_DIALOG', 40005: 'ID_CONTACT_NAME_TEXT', 2032: 'ID_PARTNER_DROPDOWNLIST', 40006: 'ID_CONTACT_OFFICE_TEXT', 2033: 'ID_NEW_PARTNER_BUTTON', 40007: 'ID_CONTACT_MOBILE_TEXT', 2034: 'IDD_NEW_PARTNER_DIALOG', 2043: 'IDR_NETRPC_PROTOCOL', 40008: 'ID_CONTACT_EMAIL_TEXT', 2035: 'ID_SAVE_PARTNER_BUTTON', 40009: 'ID_CONTACT_SAVE_BUTTON', 2036: 'ID_PARTNER_NAME_TEXT', 2037: 'IDC_NAME_LIST1', 2038: 'IDC_RELOAD', 2044: 'IDD_VIEW_PARTNER_DIALOG', 2001: 'ID_SERVER', 2002: 'ID_PORT', 2003: 'ID_SERVER_PORT', 2004: 'ID_DB_DROPDOWNLIST', 2005: 'ID_USERNAME', 2006: 'ID_PASSWORD', 2007: 'ID_BUT_TESTCONNECTION', 2008: 'ID_DONE', 2009: 'IDD_OBJECT_SETTINGS', 2010: 'IDC_BUT_LOAD_IMAGE', 2011: 'IDC_BUT_SAVE_OBJECT', 2012: 'IDC_BUT_DEL_OBJECT', 2013: 'IDC_OBJECT_TITLE', 2014: 'IDC_OBJECT_NAME', 2015: 'IDC_IMAGE_PATH', 2016: 'IDC_LIST', 2017: 'IDC_HEADER', 2018: 'ID_CREATE_CONTACT', 2019: 'ID_MAKE_ATTACHMENT', 2020: 'ID_CREATE_CASE', 2021: 'IDC_BUT_SET_SERVER_PORT', 2022: 'IDD_SERVER_PORT_DIALOG', 2023: 'IDC_CHKBX', 1000: 'IDC_PROGRESS', 1001: 'IDC_PROGRESS_TEXT', 1002: 'IDC_STATIC_HAM', 1003: 'IDC_STATIC_SPAM', 1004: 'IDC_BROWSE_HAM', 1005: 'IDC_BROWSE_SPAM', 1006: 'IDC_START', 1007: 'IDC_BUT_REBUILD', 1008: 'IDC_BUT_RESCORE', 1009: 'IDC_VERSION', 1010: 'IDC_BUT_TRAIN_FROM_SPAM_FOLDER', 1011: 'IDC_BUT_TRAIN_TO_SPAM_FOLDER', 1012: 'IDC_BUT_TRAIN_NOW', 1013: 'IDC_BUT_FILTER_ENABLE', 1014: 'IDC_FILTER_STATUS', 2045: 'IDET_PARTNER_NAME', 1016: 'IDC_BUT_FILTER_DEFINE', 1017: 'IDC_BUT_ABOUT', 1018: 'IDC_BUT_ACT_SCORE', 1019: 'IDC_BUT_ACT_ALL', 1020: 'IDC_BUT_UNREAD', 1021: 'IDC_BUT_UNSEEN', -1: 'IDC_STATIC', 1023: 'IDC_SLIDER_CERTAIN'}
bitmaps = {'IDB_OPENERPLOGO': 'OpenERP_Logo.bmp'}
diff --git a/addons/outlook/plugin/openerp-outlook-plugin/dialogs/resources/dialogs.rc b/addons/outlook/plugin/openerp-outlook-plugin/dialogs/resources/dialogs.rc
index bef1c0ef516..cc9844807c6 100755
--- a/addons/outlook/plugin/openerp-outlook-plugin/dialogs/resources/dialogs.rc
+++ b/addons/outlook/plugin/openerp-outlook-plugin/dialogs/resources/dialogs.rc
@@ -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
diff --git a/addons/outlook/plugin/openerp-outlook-plugin/eml.py b/addons/outlook/plugin/openerp-outlook-plugin/eml.py
index 03d2328a980..14d674aef3a 100755
--- a/addons/outlook/plugin/openerp-outlook-plugin/eml.py
+++ b/addons/outlook/plugin/openerp-outlook-plugin/eml.py
@@ -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 \ No newline at end of file
diff --git a/addons/outlook/plugin/openerp-outlook-plugin/manager.py b/addons/outlook/plugin/openerp-outlook-plugin/manager.py
index aa8a9334713..783da92bb2a 100755
--- a/addons/outlook/plugin/openerp-outlook-plugin/manager.py
+++ b/addons/outlook/plugin/openerp-outlook-plugin/manager.py
@@ -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):
diff --git a/addons/outlook/plugin/openerp-outlook-plugin/tiny_xmlrpc.py b/addons/outlook/plugin/openerp-outlook-plugin/tiny_xmlrpc.py
index d5dbe9b757a..9a3efc6fa7f 100755
--- a/addons/outlook/plugin/openerp-outlook-plugin/tiny_xmlrpc.py
+++ b/addons/outlook/plugin/openerp-outlook-plugin/tiny_xmlrpc.py
@@ -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
diff --git a/addons/thunderbird/plugin/openerp_plugin.xpi b/addons/thunderbird/plugin/openerp_plugin.xpi
index 05b4ea55c97..e928318e313 100644
--- a/addons/thunderbird/plugin/openerp_plugin.xpi
+++ b/addons/thunderbird/plugin/openerp_plugin.xpi
Binary files differ
diff --git a/addons/thunderbird/plugin/openerp_plugin/chrome/openerp_plugin.jar b/addons/thunderbird/plugin/openerp_plugin/chrome/openerp_plugin.jar
index 79759155f4a..2ee7837623f 100644
--- a/addons/thunderbird/plugin/openerp_plugin/chrome/openerp_plugin.jar
+++ b/addons/thunderbird/plugin/openerp_plugin/chrome/openerp_plugin.jar
Binary files differ
diff --git a/addons/thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/content/createpartner.xul b/addons/thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/content/createpartner.xul
index abc23a5b430..ba511be6257 100644
--- a/addons/thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/content/createpartner.xul
+++ b/addons/thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/content/createpartner.xul
@@ -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>
diff --git a/addons/thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/content/overlay.xul b/addons/thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/content/overlay.xul
index 15626e54f49..6e2af251052 100755
--- a/addons/thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/content/overlay.xul
+++ b/addons/thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/content/overlay.xul
@@ -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>
diff --git a/addons/thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/content/tiny_xmlrpc.js b/addons/thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/content/tiny_xmlrpc.js
index fadc29222fe..0736e39b3ed 100755
--- a/addons/thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/content/tiny_xmlrpc.js
+++ b/addons/thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/content/tiny_xmlrpc.js
@@ -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);
}
diff --git a/addons/thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/locale/en-US/overlay.dtd b/addons/thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/locale/en-US/overlay.dtd
index a2345f0aaaf..48bec840d1a 100755
--- a/addons/thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/locale/en-US/overlay.dtd
+++ b/addons/thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/locale/en-US/overlay.dtd
@@ -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">
diff --git a/addons/thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/locale/en-US/plugin.dtd b/addons/thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/locale/en-US/plugin.dtd
index 5015ccbcfa9..2f1a06ed341 100644
--- a/addons/thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/locale/en-US/plugin.dtd
+++ b/addons/thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/locale/en-US/plugin.dtd
@@ -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">