diff --git a/addons/outlook/plugin/openerp-outlook-plugin/addin.py b/addons/outlook/plugin/openerp-outlook-plugin/addin.py index e680f9682a0..8b376a5fd93 100644 --- a/addons/outlook/plugin/openerp-outlook-plugin/addin.py +++ b/addons/outlook/plugin/openerp-outlook-plugin/addin.py @@ -205,7 +205,7 @@ class OutlookAddin: item = toolbarweb.Controls.Add(Type = constants.msoControlButton, Temporary = True) item = self.toolbarButtonOpenDocument = DispatchWithEvents(item, OpenDocument) item.Caption = "Open Document" - item.TooltipText = "Click to Open Document that ha been pushed to server." + item.TooltipText = "Click to Open Document that has been pushed to server." item.Enabled = True # Hook events for the item @@ -230,6 +230,13 @@ class OutlookAddin: item.TooltipText = "Click to Open Partner detail" item.Enabled = True + item = tools_menu.Controls.Add(Type=constants.msoControlButton, Temporary=True) + # Hook events for the item + item = self.menu_bar_opendocument_Button = DispatchWithEvents(item, OpenDocument) + item.Caption = "Open Document" + item.TooltipText = "Click to Open Document that has been pushed to server." + item.Enabled = True + def OnDisconnection(self, mode, custom): mngr = manager.GetManager() 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 17bbefac572..f5e603634d8 100644 --- a/addons/outlook/plugin/openerp-outlook-plugin/dialogs/dialog_map.py +++ b/addons/outlook/plugin/openerp-outlook-plugin/dialogs/dialog_map.py @@ -409,14 +409,6 @@ class DialogCommand(ButtonProcessor): 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') @@ -992,26 +984,6 @@ def setCheckList(groupProcessor,*args): 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( @@ -1027,7 +999,6 @@ def setCheckList(groupProcessor,*args): id+=1 id1+=1 left+=17 - win32gui.UpdateWindow(hwndImg) left+=140 if cnt > 1: left = 20 @@ -1686,7 +1657,6 @@ dialog_map = { (TextProcessor, "ID_SERVER_PORT ID_USERNAME ID_PASSWORD IDET_WED_SERVER", 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"), (DialogCommand, "ID_SET_WEB_CONNECTION", "IDD_WEB_SERVER_PORT_DIALOG" ), (CommandButtonProcessor, "IDPB_WEB_CONNECTION IDET_WED_SERVER", ConnectWebServer, ()), 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 8ef0bfb7dc2..f63d66274af 100644 --- 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:\workspace\openerp-outlook-plugin\dialogs\resources\dialogs.py #This is a generated file. Please edit C:\workspace\openerp-outlook-plugin\dialogs\resources\dialogs.rc instead. -_rc_size_=16066 -_rc_mtime_=1288418073 +_rc_size_=15985 +_rc_mtime_=1288860503 class FakeParser: - dialogs = {'IDD_OPEN_DOCUEMNT_DIALOG': [['Open Document', (0, 0, 200, 65), -1865940928, 1024, (8, 'Tahoma')], [130, 'Link to Document : (If this link does not opens directly in web browser then copy an the link and paste in web browser.) ', -1, (5, 3, 190, 25), 1342177280], [129, '', 2086, (5, 31, 190, 12), 1350631552], [128, 'Ok', 2, (150, 45, 45, 14), 1342242816]], '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 Contact ', 2052, (280, 15, 60, 14), 1342242816], [130, 'Partner Name : ', -1, (13, 42, 50, 17), 1342177280], [129, '', 2064, (70, 42, 150, 12), 1350568064], [128, 'Search Partner', 2070, (225, 41, 60, 14), 1342242816], [128, 'New Partner', 2093, (290, 41, 50, 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], [129, '', 2062, (76, 153, 54, 12), 1350568064], [128, 'Search', 2104, (135, 153, 40, 12), 1342242816], [130, 'Country :', -1, (18, 169, 35, 17), 1342177280], [129, '', 2063, (76, 168, 54, 12), 1350568064], [128, 'Search', 2105, (135, 168, 40, 12), 1342242816], [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_OPEN_PARTNER_DIALOG': [['Open Partner', (0, 0, 200, 65), -1865940928, 1024, (8, 'Tahoma')], [130, 'Link to Partner : (If this link does not opens directly in web browser then copy an the link and paste in web browser.) ', -1, (5, 3, 190, 25), 1342177280], [129, '', 2085, (5, 31, 190, 12), 1350631552], [128, 'Ok', 2, (150, 45, 45, 13), 1342242816]], 'IDD_SELECT_STATE': [['Search Fed. State', (0, 0, 220, 250), -1865940928, 1024, (8, 'Tahoma')], [130, 'Enter Name : ', -1, (8, 12, 80, 17), 1342177280], [129, '', 2100, (55, 10, 100, 12), 1350631552], [128, 'Search', 40012, (160, 10, 50, 14), 1342242816], ['SysListView32', 'List1', 2101, (8, 40, 200, 185), 1353711657], [128, 'Select', 2102, (170, 230, 40, 14), 1342242816]], 'IDD_GENERAL': [['Connection Parameters', (0, 0, 430, 210), 1355284544, None, (8, 'Tahoma')], [128, 'Connection Parameters', 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], [128, 'WebServer Parameters', 2024, (270, 10, 150, 130), 1342177287], [130, 'Server : ', -1, (280, 30, 50, 15), 1342177280], [129, '', 2080, (310, 29, 90, 12), 1350568064], [128, 'Change', 2082, (295, 50, 50, 12), 1342242816], [128, 'Connect', 2083, (350, 50, 50, 12), 1342242816]], 'IDD_OBJECT_SETTINGS': [['Documents Setting', (0, 0, 430, 210), 1355284672, 1024, (8, 'Tahoma')], [128, 'Document Attributes', 2024, (2, 2, 343, 32), 1342177287], [130, 'Title:', -1, (5, 16, 30, 17), 1342177280], [129, '', 2013, (22, 14, 57, 12), 1350631552], [130, 'Document Name:', -1, (83, 16, 60, 17), 1342177280], [129, '', 2014, (138, 14, 57, 12), 1350631552], [130, 'Image:', -1, (200, 16, 22, 17), 1342177280], [129, '', 2015, (223, 14, 57, 12), 1350631552], [128, 'Load Image', 2010, (289, 13, 50, 15), 1342242816], [128, 'Add', 2011, (350, 13, 38, 15), 1342242816], [128, 'Delete', 2012, (392, 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 Configuration', (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_WEB_SERVER_PORT_DIALOG': [['OpenERP Connection', (0, 0, 160, 55), -1865940928, 1024, (8, 'Tahoma')], [130, 'Server : ', -1, (5, 3, 150, 17), 1342177280], [129, '', 2089, (40, 3, 100, 12), 1350631552], [130, 'Port : ', -1, (5, 18, 100, 17), 1342177280], [129, '', 2090, (40, 18, 100, 12), 1350631552], [128, 'Close', 2, (110, 35, 45, 14), 1342242816], [128, 'OK', 2091, (60, 35, 45, 14), 1342242817]], '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, 180), -1865940928, 1024, (8, 'Tahoma')], [130, 'Select Partner : ', -1, (13, 20, 50, 17), 1342177280], [129, '', 2079, (70, 18, 150, 12), 1350568064], [128, 'Search Partner', 2033, (225, 17, 60, 14), 1342242816], [128, 'New Partner', 2092, (290, 17, 50, 14), 1342242816], [128, 'Postal Address ', 2024, (10, 35, 175, 123), 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, 106, 50, 17), 1342177280], [129, '', 2067, (76, 107, 100, 12), 1350631552], [130, 'Fed. State : ', -1, (18, 134, 50, 15), 1342177280], [129, '', 2106, (76, 135, 54, 12), 1350568064], [128, 'Search', 2107, (135, 136, 40, 12), 1342242816], [130, 'Country :', -1, (18, 121, 35, 15), 1342177280], [129, '', 2108, (76, 122, 54, 12), 1350568064], [128, 'Search', 2109, (135, 121, 40, 12), 1342242816], [128, 'Communication ', 2024, (188, 35, 150, 123), 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, 162, 45, 13), 1342242816], [128, 'Save', 40009, (240, 162, 45, 13), 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_SELECT_PARTNER': [['Search Partner', (0, 0, 220, 250), -1865940928, 1024, (8, 'Tahoma')], [130, 'Enter Name : ', -1, (8, 12, 80, 17), 1342177280], [129, '', 2076, (55, 10, 100, 12), 1350631552], [128, 'Search', 2077, (160, 10, 50, 14), 1342242816], ['SysListView32', 'List1', 2072, (8, 40, 200, 185), 1353711657], [128, 'Create New Partner', 2078, (10, 230, 100, 14), 1342242816], [128, 'Select', 2075, (170, 230, 40, 14), 1342242816]], '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 New 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 New 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]], 'IDD_SELECT_COUNTRY': [['Search Country', (0, 0, 220, 250), -1865940928, 1024, (8, 'Tahoma')], [130, 'Enter Name : ', -1, (8, 12, 80, 17), 1342177280], [129, '', 2095, (55, 10, 100, 12), 1350631552], [128, 'Search', 2098, (160, 10, 50, 14), 1342242816], ['SysListView32', 'List1', 2096, (8, 40, 200, 185), 1353711657], [128, 'Select', 2097, (170, 230, 40, 14), 1342242816]]} + dialogs = {'IDD_OPEN_DOCUEMNT_DIALOG': [['Open Document', (0, 0, 200, 65), -1865940928, 1024, (8, 'Tahoma')], [130, 'Link to Document : (If this link does not opens directly in web browser then copy an the link and paste in web browser.) ', -1, (5, 3, 190, 25), 1342177280], [129, '', 2086, (5, 31, 190, 12), 1350631552], [128, 'Ok', 2, (150, 45, 45, 14), 1342242816]], '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 Contact ', 2052, (280, 15, 60, 14), 1342242816], [130, 'Partner Name : ', -1, (13, 42, 50, 17), 1342177280], [129, '', 2064, (70, 42, 150, 12), 1350568064], [128, 'Search Partner', 2070, (225, 41, 60, 14), 1342242816], [128, 'New Partner', 2093, (290, 41, 50, 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], [129, '', 2062, (76, 153, 54, 12), 1350568064], [128, 'Search', 2104, (135, 153, 40, 12), 1342242816], [130, 'Country :', -1, (18, 169, 35, 17), 1342177280], [129, '', 2063, (76, 168, 54, 12), 1350568064], [128, 'Search', 2105, (135, 168, 40, 12), 1342242816], [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_OPEN_PARTNER_DIALOG': [['Open Partner', (0, 0, 200, 65), -1865940928, 1024, (8, 'Tahoma')], [130, 'Link to Partner : (If this link does not opens directly in web browser then copy an the link and paste in web browser.) ', -1, (5, 3, 190, 25), 1342177280], [129, '', 2085, (5, 31, 190, 12), 1350631552], [128, 'Ok', 2, (150, 45, 45, 13), 1342242816]], 'IDD_SELECT_STATE': [['Search Fed. State', (0, 0, 220, 250), -1865940928, 1024, (8, 'Tahoma')], [130, 'Enter Name : ', -1, (8, 12, 80, 17), 1342177280], [129, '', 2100, (55, 10, 100, 12), 1350631552], [128, 'Search', 40012, (160, 10, 50, 14), 1342242816], ['SysListView32', 'List1', 2101, (8, 40, 200, 185), 1353711657], [128, 'Select', 2102, (170, 230, 40, 14), 1342242816]], 'IDD_GENERAL': [['Connection Parameters', (0, 0, 430, 210), 1355284544, None, (8, 'Tahoma')], [128, 'Connection Parameters', 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, 154, 40), 1344339971], [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], [128, 'WebServer Parameters', 2024, (270, 10, 150, 130), 1342177287], [130, 'Server : ', -1, (280, 30, 50, 15), 1342177280], [129, '', 2080, (310, 29, 90, 12), 1350568064], [128, 'Change', 2082, (295, 50, 50, 12), 1342242816], [128, 'Connect', 2083, (350, 50, 50, 12), 1342242816]], 'IDD_OBJECT_SETTINGS': [['Documents Setting', (0, 0, 430, 210), 1355284672, 1024, (8, 'Tahoma')], [128, 'Document Attributes', 2024, (2, 2, 343, 32), 1342177287], [130, 'Title:', -1, (5, 16, 30, 17), 1342177280], [129, '', 2013, (22, 14, 57, 12), 1350631552], [130, 'Document Name:', -1, (83, 16, 60, 17), 1342177280], [129, '', 2014, (138, 14, 57, 12), 1350631552], [130, 'Image:', -1, (200, 16, 22, 17), 1342177280], [129, '', 2015, (223, 14, 57, 12), 1350631552], [128, 'Load Image', 2010, (289, 13, 50, 15), 1342242816], [128, 'Add', 2011, (350, 13, 38, 15), 1342242816], [128, 'Delete', 2012, (392, 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 Configuration', (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_WEB_SERVER_PORT_DIALOG': [['OpenERP Connection', (0, 0, 160, 55), -1865940928, 1024, (8, 'Tahoma')], [130, 'Server : ', -1, (5, 3, 150, 17), 1342177280], [129, '', 2089, (40, 3, 100, 12), 1350631552], [130, 'Port : ', -1, (5, 18, 100, 17), 1342177280], [129, '', 2090, (40, 18, 100, 12), 1350631552], [128, 'Close', 2, (110, 35, 45, 14), 1342242816], [128, 'OK', 2091, (60, 35, 45, 14), 1342242817]], '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, 180), -1865940928, 1024, (8, 'Tahoma')], [130, 'Select Partner : ', -1, (13, 20, 50, 17), 1342177280], [129, '', 2079, (70, 18, 150, 12), 1350568064], [128, 'Search Partner', 2033, (225, 17, 60, 14), 1342242816], [128, 'New Partner', 2092, (290, 17, 50, 14), 1342242816], [128, 'Postal Address ', 2024, (10, 35, 175, 123), 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, 106, 50, 17), 1342177280], [129, '', 2067, (76, 107, 100, 12), 1350631552], [130, 'Fed. State : ', -1, (18, 134, 50, 15), 1342177280], [129, '', 2106, (76, 135, 54, 12), 1350568064], [128, 'Search', 2107, (135, 136, 40, 12), 1342242816], [130, 'Country :', -1, (18, 121, 35, 15), 1342177280], [129, '', 2108, (76, 122, 54, 12), 1350568064], [128, 'Search', 2109, (135, 121, 40, 12), 1342242816], [128, 'Communication ', 2024, (188, 35, 150, 123), 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, 162, 45, 13), 1342242816], [128, 'Save', 40009, (240, 162, 45, 13), 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_SELECT_PARTNER': [['Search Partner', (0, 0, 220, 250), -1865940928, 1024, (8, 'Tahoma')], [130, 'Enter Name : ', -1, (8, 12, 80, 17), 1342177280], [129, '', 2076, (55, 10, 100, 12), 1350631552], [128, 'Search', 2077, (160, 10, 50, 14), 1342242816], ['SysListView32', 'List1', 2072, (8, 40, 200, 185), 1353711657], [128, 'Create New Partner', 2078, (10, 230, 100, 14), 1342242816], [128, 'Select', 2075, (170, 230, 40, 14), 1342242816]], '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 : ', -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 New 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 New 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]], 'IDD_SELECT_COUNTRY': [['Search Country', (0, 0, 220, 250), -1865940928, 1024, (8, 'Tahoma')], [130, 'Enter Name : ', -1, (8, 12, 80, 17), 1342177280], [129, '', 2095, (55, 10, 100, 12), 1350631552], [128, 'Search', 2098, (160, 10, 50, 14), 1342242816], ['SysListView32', 'List1', 2096, (8, 40, 200, 185), 1353711657], [128, 'Select', 2097, (170, 230, 40, 14), 1342242816]]} ids = {'IDC_BUT_DEL_OBJECT': 2012, 'IDD_OPEN_PARTNER_DIALOG': 2084, 'IDD_SELECT_STATE': 2099, 'IDC_DELAY1_SLIDER': 1056, 'IDC_PROGRESS': 1000, 'IDD_MANAGER': 101, 'IDC_ABOUT': 2028, 'IDD_DIAGNOSTIC': 113, 'IDET_PARTNER_COUNTRY': 2063, '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, 'IDD_SYNC': 40002, 'IDC_TAB': 1068, 'IDC_FOLDER_UNSURE': 1033, '_APS_NEXT_SYMED_VALUE': 101, 'IDC_VERBOSE_LOG': 1061, 'IDC_EDIT1': 1094, 'IDC_BROWSE': 1037, 'ID_DB_DROPDOWNLIST': 2004, 'IDC_BACK_BTN': 1069, 'ID_CONTACT_NAME_TEXT': 40005, 'IDPB_PARTNER_SEARCH': 2077, 'IDD_WIZARD_FINISHED_UNCONFIGURED': 119, 'IDC_ACTION_CERTAIN': 1025, 'IDC_BUT_ACT_ALL': 1019, 'IDD_FILTER_NOW': 104, 'IDET_WED_SERVER': 2080, 'ID_WEB_OK': 2091, 'ID_PROTOCOL_GRP': 2040, 'IDC_HEADER': 2017, 'IDC_MARK_SPAM_AS_READ': 1047, 'IDPB_NEW_PARTNER_BUTTON': 2092, '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, 'IDET_PARTNER_LINK_TEXT': 2085, 'IDC_FOLDER_HAM': 1083, 'IDC_LIST_COUNTRY': 2096, 'IDD_WIZARD_FOLDERS_REST': 117, 'IDC_SHOW_DATA_FOLDER': 1071, 'IDC_BUT_ACT_SCORE': 1018, 'IDET_STATE_SEARCH_NAME': 2100, 'IDET_WEB_SERVER': 2089, '_APS_NEXT_RESOURCE_VALUE': 128, 'ID_SET_WEB_CONNECTION': 2082, 'IDC_LIST_STATE': 2101, '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, 'ID_CONTACT_MOBILE_TEXT': 40007, 'IDD_VIEW_PARTNER_DIALOG': 2044, 'IDD_WIZARD_FOLDERS_TRAIN': 120, 'IDC_BUT_FILTER_ENABLE': 1013, 'IDPB_WEB_CONNECTION': 2083, 'IDC_ABOUT_BTN': 1072, 'IDD_WIZARD_FINISHED_TRAINED': 122, 'ID_SERVER': 2001, 'IDD_SELECT_PARTNER': 2073, 'IDET_NC_PARTNER_STATE': 2106, '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, 'IDEB_OPENDOC_LINK_TEXT': 2086, '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_OPEN_DOCUEMNT_DIALOG': 2087, 'IDD_WIZARD_FINISHED_UNTRAINED': 116, 'IDC_MARK_UNSURE_AS_READ': 1051, 'IDPB_SEARCH_COUNTRY1': 2105, '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, 'IDPB_CREATE_NEW_PARTNER': 2078, '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, 'IDPB_SEARCH_STATE': 2103, 'IDET_COUNTRY_SEARCH_NAME': 2095, '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, 'IDPB_SEARCH_STATE1': 2104, '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, 'IDD_SELECT_COUNTRY': 2094, '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, 'IDET_PARTNER': 2064, 'IDC_SAVE_SPAM_SCORE': 1048, 'IDC_OBJECT_TITLE': 2013, 'IDC_FOLDER_CERTAIN': 1027, 'IDET_WEB_PORT': 2090, 'IDC_BROWSE_UNSURE': 1034, 'IDC_STATISTICS': 1095, 'IDPB_STATE_SEARCH': 40012, 'ID_MAKE_ATTACHMENT': 2019, 'IDC_BUT_LOAD_IMAGE': 2010, 'IDC_NAME_LIST': 2026, 'IDC_BUT_TRAIN_TO_SPAM_FOLDER': 1011, 'IDET_PARTNER_SEARCH_NAME': 2076, 'IDC_BUT_RESET': 1073, 'ID_SEARCH': 40004, 'IDET_PARTNER_CONTACT_NAME': 2046, 'IDPB_SELECT_STATE': 2102, 'IDC_ACTION_UNSURE': 1031, 'IDD_WIZARD_TRAIN': 121, 'IDC_STATIC_GROUP': 2024, 'IDPB_NEWPARTNER_BUTTON': 2071, 'ID_PARTNER_TEXT': 2079, 'IDD_WIZARD_FINISHED_TRAIN_LATER': 124, 'IDET_PARTNER_NAME': 2045, 'IDPB_NEW_PART_BUTTON': 2093, 'IDC_BUT_REBUILD': 1007, 'IDET_PARTNER_STREET2': 2054, 'IDPB_SEARCH_COUNTRY': 2098, 'ID_SAVE_PARTNER_BUTTON': 2035, 'IDPB_SELECT_PARTNER': 2075, 'ID_STREET_TEXT': 2062, '_APS_NEXT_COMMAND_VALUE': 40001, 'IDET_SEARCH_PARTNER': 2051, 'IDC_LIST_PARTNER': 2072, 'IDD_WEB_SERVER_PORT_DIALOG': 2088, 'ID_PORT': 2002, 'IDD_SERVER_PORT_DIALOG': 2022, 'IDET_PARTNER_STATE': 2062, 'IDPB_SELECT_COUNTRY': 2097, 'ID_SEARCH_TEXT': 40003, 'IDET_NC_PARTNER_COUNTRY': 2108, '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, 'IDPB_NC_SEARCH_STATE1': 2107, 'ID_CONTACT_SAVE_BUTTON': 40009, 'IDOK': 1, 'IDC_BROWSE_CERTAIN': 1028, 'IDC_BUT_SHOW_DIAGNOSTICS': 1080, 'IDC_BUT_TRAIN_NOW': 1012, 'IDPB_NC_SEARCH_COUNTRY1': 2109} 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', 2076: 'IDET_PARTNER_SEARCH_NAME', 2077: 'IDPB_PARTNER_SEARCH', 2078: 'IDPB_CREATE_NEW_PARTNER', 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', 2088: 'IDD_WEB_SERVER_PORT_DIALOG', 2089: 'IDET_WEB_SERVER', 2090: 'IDET_WEB_PORT', 2091: 'ID_WEB_OK', 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', 2100: 'IDET_STATE_SEARCH_NAME', 1077: 'IDC_FORWARD_BTN', 1078: 'IDC_PAGE_PLACEHOLDER', 2057: 'IDET_PARTNER_COUNTRY', 1080: 'IDC_BUT_SHOW_DIAGNOSTICS', 1081: 'IDC_BUT_PREPARATION', 2106: 'IDET_NC_PARTNER_STATE', 1083: 'IDC_FOLDER_HAM', 2108: 'IDET_NC_PARTNER_COUNTRY', 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', 40012: 'IDPB_STATE_SEARCH', 2061: 'ID_ALL_COUNTRY_DROPDOWNLIST', 2062: 'IDET_PARTNER_STATE', 2063: 'IDET_PARTNER_COUNTRY', 2064: 'IDET_PARTNER', 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', 2072: 'IDC_LIST_PARTNER', 2073: 'IDD_SELECT_PARTNER', 2068: 'ID_ZIP_TEXT', 2051: 'IDET_SEARCH_PARTNER', 2075: 'IDPB_SELECT_PARTNER', 2079: 'ID_PARTNER_TEXT', 2080: 'IDET_WED_SERVER', 2081: 'IDET_WEB_PORT', 2082: 'ID_SET_WEB_CONNECTION', 2083: 'IDPB_WEB_CONNECTION', 2084: 'IDD_OPEN_PARTNER_DIALOG', 2085: 'IDET_PARTNER_LINK_TEXT', 40004: 'ID_SEARCH', 2086: 'IDEB_OPENDOC_LINK_TEXT', 2087: 'IDD_OPEN_DOCUEMNT_DIALOG', 2046: 'IDET_PARTNER_CONTACT_NAME', 2105: 'IDPB_SEARCH_COUNTRY1', 2054: 'IDET_PARTNER_STREET2', 128: '_APS_NEXT_RESOURCE_VALUE', 2092: 'IDPB_NEW_PARTNER_BUTTON', 2093: 'IDPB_NEW_PART_BUTTON', 2094: 'IDD_SELECT_COUNTRY', 2095: 'IDET_COUNTRY_SEARCH_NAME', 2096: 'IDC_LIST_COUNTRY', 2097: 'IDPB_SELECT_COUNTRY', 2098: 'IDPB_SEARCH_COUNTRY', 2099: 'IDD_SELECT_STATE', 2101: 'IDC_LIST_STATE', 2102: 'IDPB_SELECT_STATE', 2103: 'IDPB_SEARCH_STATE', 2104: 'IDPB_SEARCH_STATE1', 2040: 'ID_PROTOCOL_GRP', 2065: 'ID_COUNTRY_DROPLIST', 2048: 'IDET_PARTNER_OFFICENO', 2107: 'IDPB_NC_SEARCH_STATE1', 2109: 'IDPB_NC_SEARCH_COUNTRY1', 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 b0ef1968a41..6b620127a33 100644 --- a/addons/outlook/plugin/openerp-outlook-plugin/dialogs/resources/dialogs.rc +++ b/addons/outlook/plugin/openerp-outlook-plugin/dialogs/resources/dialogs.rc @@ -49,9 +49,9 @@ BEGIN EDITTEXT ID_SERVER_PORT,85,30,120,12,ES_READONLY | WS_VISIBLE | WS_TABSTOP// left top width height PUSHBUTTON "Change",IDC_BUT_SET_SERVER_PORT,210,30,30,13, WS_VISIBLE | WS_TABSTOP LTEXT "Database : ",IDC_STATIC,30,50,100,17 - COMBOBOX ID_DB_DROPDOWNLIST,85,50,120,40,CBS_DROPDOWNLIST | + COMBOBOX ID_DB_DROPDOWNLIST,85,50,154,40,CBS_DROPDOWNLIST | WS_VSCROLL | WS_VISIBLE | WS_TABSTOP - PUSHBUTTON "Reload",IDC_RELOAD,210,50,30,13, WS_VISIBLE | WS_TABSTOP + LTEXT "Username : ",IDC_STATIC,30,70,100,17 EDITTEXT ID_USERNAME,85,70,154,12,ES_AUTOHSCROLL | WS_VISIBLE | WS_TABSTOP LTEXT "Password : ",IDC_STATIC,30,90,100,17 diff --git a/addons/outlook/plugin/openerp-outlook-plugin/dialogs/resources/openerp_logo1.bmp b/addons/outlook/plugin/openerp-outlook-plugin/dialogs/resources/openerp_logo1.bmp index 45b745dec86..4e40d9e989a 100644 Binary files a/addons/outlook/plugin/openerp-outlook-plugin/dialogs/resources/openerp_logo1.bmp and b/addons/outlook/plugin/openerp-outlook-plugin/dialogs/resources/openerp_logo1.bmp differ diff --git a/addons/outlook/plugin/openerp-outlook-plugin/tiny_xmlrpc.py b/addons/outlook/plugin/openerp-outlook-plugin/tiny_xmlrpc.py index 2c2ab3b787f..3883e08ad78 100644 --- a/addons/outlook/plugin/openerp-outlook-plugin/tiny_xmlrpc.py +++ b/addons/outlook/plugin/openerp-outlook-plugin/tiny_xmlrpc.py @@ -30,6 +30,7 @@ import email from win32com.mapi import mapi, mapiutil, mapitags import pythoncom import win32com +import win32ui waittime = 10 wait_count = 0 wait_limit = 12 @@ -38,19 +39,19 @@ def execute(connector, method, *args): global wait_count res = False try: - res = getattr(connector,method)(*args) + 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 "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 + return res wait_count = 0 return res @@ -58,475 +59,514 @@ 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', 'SearchPartner', 'SearchEmailResources', \ - 'GetCountry', 'GetStates', 'FindCountryForState'] + 'ArchiveToOpenERP', 'IsCRMInstalled', 'GetPartners', 'GetObjectItems', \ + 'CreateCase', 'MakeAttachment', 'CreateContact', 'CreatePartner', 'getitem', 'setitem', \ + 'SearchPartnerDetail', 'WritePartnerValues', 'GetAllState', 'GetAllCountry', 'SearchPartner', 'SearchEmailResources', \ + 'GetCountry', 'GetStates', 'FindCountryForState','CreateEmailAttachment'] _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 + 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) + v=self.__getattribute__(attrib) + return str(v) def setitem(self, attrib, value): - return self.__setattr__(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 + 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 + 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 + 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 + 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) + 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 + 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 - flag = False - new_msg = files = ext_msg ="" - message_id = referances = None - try: - outlook = win32com.client.Dispatch("Outlook.Application") - session = win32com.client.Dispatch("MAPI.session") - session.Logon('Outlook') - objMessage = session.GetMessage(mail.EntryID, mail.Parent.StoreID) - objFields = objMessage.Fields - strheader = objFields.Item(mapitags.PR_TRANSPORT_MESSAGE_HEADERS) - strheader = ustr(strheader).encode('iso-8859-1') - headers = {} - strheader = strheader.replace("\n ", " ").splitlines() - for line in strheader: - split_here = line.find(":") - headers[line[:split_here]] = line[split_here:] - temp1 = headers.get('Message-ID') - temp2 = headers.get('Message-Id') - referances = headers.get('References') - if temp1 == None: message_id = temp2 - if temp2 == None: message_id = temp1 - startCut = message_id.find("<") - endCut = message_id.find(">") - message_id = message_id[startCut:endCut+1] - if not referances == None: - startCut = referances.find("<") - endCut = referances.find(">") - referances = referances[startCut:endCut+1] - except Exception,e: - win32ui.MessageBox(str(e),"Archive To OpenERP") - return - new_mail=eml.generateEML(mail) - attachments=mail.Attachments - 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 + import win32ui, win32con + conn = xmlrpclib.ServerProxy(self._uri + '/xmlrpc/object') + import eml + flag = False + new_msg = files = ext_msg ="" + message_id = referances = None + try: + outlook = win32com.client.Dispatch("Outlook.Application") + session = win32com.client.Dispatch("MAPI.session") + session.Logon('Outlook') + objMessage = session.GetMessage(mail.EntryID, mail.Parent.StoreID) + objFields = objMessage.Fields + strheader = objFields.Item(mapitags.PR_TRANSPORT_MESSAGE_HEADERS) + strheader = ustr(strheader).encode('iso-8859-1') + headers = {} + strheader = strheader.replace("\n ", " ").splitlines() + for line in strheader: + split_here = line.find(":") + headers[line[:split_here]] = line[split_here:] + temp1 = headers.get('Message-ID') + temp2 = headers.get('Message-Id') + referances = headers.get('References') + if temp1 == None: message_id = temp2 + if temp2 == None: message_id = temp1 + startCut = message_id.find("<") + endCut = message_id.find(">") + message_id = message_id[startCut:endCut+1] + if not referances == None: + startCut = referances.find("<") + endCut = referances.find(">") + referances = referances[startCut:endCut+1] + except Exception,e: + win32ui.MessageBox(str(e),"Archive To OpenERP") + return + new_mail=eml.generateEML(mail) + attachments=mail.Attachments + 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','=',message_id),('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 {0} '{1}'.\n""".format(object_name,name) + flag = True + continue + msg = { + 'subject':mail.Subject, + 'date':str(mail.ReceivedTime), + 'body':mail.Body, + 'cc':mail.CC, + 'from':mail.SenderEmailAddress, + 'to':mail.To, + 'message-id':message_id, + 'references':ustr(referances), + } + obj_list= ['crm.lead','project.issue','hr.applicant','res.partner'] + if rec[0] not in obj_list: + ids = self.CreateEmailAttachment(rec,mail) + 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 - 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','=',message_id),('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 {0} '{1}'.\n""".format(object_name,name) - flag = True - continue - msg = { - 'subject':mail.Subject, - 'date':str(mail.ReceivedTime), - 'body':mail.Body, - 'cc':mail.CC, - 'from':mail.SenderEmailAddress, - 'to':mail.To, - 'message-id':message_id, - 'references':ustr(referances), - } - 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 = """Mail archived Successfully with attachments.\n"""+ext_msg - t += "\n"+new_msg - win32ui.MessageBox(t,"Archived to OpenERP",win32con.MB_ICONINFORMATION) - return flag + if flag: + t = """Mail archived Successfully with attachments.\n"""+ext_msg + t += "\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 + 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 + 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, search_partner=''): - import win32ui - conn = xmlrpclib.ServerProxy(self._uri+ '/xmlrpc/object') - ids=[] - obj_list=[] - domain = [] - if not search_partner.strip() == '': - domain.append(('name','ilike',ustr(search_partner))) - ids = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'res.partner','search',domain) - 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 + import win32ui + conn = xmlrpclib.ServerProxy(self._uri+ '/xmlrpc/object') + ids=[] + obj_list=[] + domain = [] + if not search_partner.strip() == '': + domain.append(('name','ilike',ustr(search_partner))) + ids = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'res.partner','search',domain) + 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 + 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): - import win32ui - import eml - flag = False - id = -1 - try: - conn = xmlrpclib.ServerProxy(self._uri+ '/xmlrpc/object') - email=eml.generateEML(mail) - message_id = referances = None - outlook = win32com.client.Dispatch("Outlook.Application") - session = win32com.client.Dispatch("MAPI.session") - session.Logon('Outlook') - objMessage = session.GetMessage(mail.EntryID, mail.Parent.StoreID) - objFields = objMessage.Fields - strheader = objFields.Item(mapitags.PR_TRANSPORT_MESSAGE_HEADERS) - strheader = ustr(strheader).encode('iso-8859-1') - headers = {} - strheader = strheader.replace("\n ", " ").splitlines() - for line in strheader: - split_here = line.find(":") - headers[line[:split_here]] = line[split_here:] - temp1 = headers.get('Message-ID') - temp2 = headers.get('Message-Id') - if temp1 == None: message_id = temp2 - if temp2 == None: message_id = temp1 - startCut = message_id.find("<") - endCut = message_id.find(">") - message_id = message_id[startCut:endCut+1] - email.replace_header('Message-Id',message_id) - id = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'email.server.tools','process_email',section, str(email)) - if id > 0: - flag = True - return flag - else: - flag = False - return flag - except Exception,e: - win32ui.MessageBox("Create Case\n"+str(e),"Mail Reading Error") - return flag + import win32ui + import eml + flag = False + id = -1 + try: + conn = xmlrpclib.ServerProxy(self._uri+ '/xmlrpc/object') + email=eml.generateEML(mail) + message_id = referances = None + outlook = win32com.client.Dispatch("Outlook.Application") + session = win32com.client.Dispatch("MAPI.session") + session.Logon('Outlook') + objMessage = session.GetMessage(mail.EntryID, mail.Parent.StoreID) + objFields = objMessage.Fields + strheader = objFields.Item(mapitags.PR_TRANSPORT_MESSAGE_HEADERS) + strheader = ustr(strheader).encode('iso-8859-1') + headers = {} + strheader = strheader.replace("\n ", " ").splitlines() + for line in strheader: + split_here = line.find(":") + headers[line[:split_here]] = line[split_here:] + temp1 = headers.get('Message-ID') + temp2 = headers.get('Message-Id') + if temp1 == None: message_id = temp2 + if temp2 == None: message_id = temp1 + startCut = message_id.find("<") + endCut = message_id.find(">") + message_id = message_id[startCut:endCut+1] + email.replace_header('Message-Id',message_id) + id = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'email.server.tools','process_email',section, str(email)) + if id > 0: + flag = True + return flag + else: + flag = False + return flag + except Exception,e: + win32ui.MessageBox("Create Case\n"+str(e),"Mail Reading Error") + return flag 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("%temp%\\")) - 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 + attachments = mail.Attachments + result = {} + conn = xmlrpclib.ServerProxy(self._uri+ '/xmlrpc/object') + att_folder_path = os.path.abspath(os.path.dirname("%temp%\\")) + 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, res=None): - res=eval(str(res)) - partner = res['partner_id'] - state = res['state_id'] - country = res['country_id'] - conn = xmlrpclib.ServerProxy(self._uri+ '/xmlrpc/object') - if not partner.strip() == '': - partner_id = execute( conn, 'execute', self._dbname, int(self._uid), self._pwd, 'res.partner', 'search', [('name','=',ustr(partner))]) - res.update({'partner_id' : partner_id[0]}) - else: - res.pop('partner_id') - if not state == "": - country_id = execute( conn, 'execute', self._dbname, int(self._uid), self._pwd, 'res.country', 'search', [('name','=',ustr(country))]) - res.update({'country_id' : country_id[0]}) - else: - res.pop('country_id') - if not country == "": - state_id = execute( conn, 'execute', self._dbname, int(self._uid), self._pwd, 'res.country.state', 'search', [('name','=',ustr(state))]) - res.update({'state_id' : state_id[0]}) - else: - res.pop('state_id') - id = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'res.partner.address','create',res) - return id + res=eval(str(res)) + partner = res['partner_id'] + state = res['state_id'] + country = res['country_id'] + conn = xmlrpclib.ServerProxy(self._uri+ '/xmlrpc/object') + if not partner.strip() == '': + partner_id = execute( conn, 'execute', self._dbname, int(self._uid), self._pwd, 'res.partner', 'search', [('name','=',ustr(partner))]) + res.update({'partner_id' : partner_id[0]}) + else: + res.pop('partner_id') + if not state == "": + country_id = execute( conn, 'execute', self._dbname, int(self._uid), self._pwd, 'res.country', 'search', [('name','=',ustr(country))]) + res.update({'country_id' : country_id[0]}) + else: + res.pop('country_id') + if not country == "": + state_id = execute( conn, 'execute', self._dbname, int(self._uid), self._pwd, 'res.country.state', 'search', [('name','=',ustr(state))]) + res.update({'state_id' : state_id[0]}) + else: + res.pop('state_id') + 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 + 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 + 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'] - partner = new_dict['partner'] - country_val = new_dict['country'] - state_val = new_dict['state'] - conn = xmlrpclib.ServerProxy(self._uri+ '/xmlrpc/object') - partner_id = execute( conn, 'execute', self._dbname, int(self._uid), self._pwd, 'res.partner', 'search', [('name','=',ustr(partner))]) - country_id = execute( conn, 'execute', self._dbname, int(self._uid), self._pwd, 'res.country', 'search', [('name','=',ustr(country_val))]) - state_id = execute( conn, 'execute', self._dbname, int(self._uid), self._pwd, 'res.country.state', 'search', [('name','=',ustr(state_val))]) - address_id = execute( conn, 'execute', self._dbname, int(self._uid), self._pwd, 'res.partner.address', 'search', [('email','=',ustr(email))]) - if not partner_id or not address_id or not country_id or not state_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={ - 'partner_id' : partner_id[0], - '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'], - 'country_id' : country_id[0], - 'state_id' : state_id[0] - } - 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 + import win32ui + flag = -1 + new_dict = dict(new_vals) + email=new_dict['email'] + partner = new_dict['partner'] + country_val = new_dict['country'] + state_val = new_dict['state'] + conn = xmlrpclib.ServerProxy(self._uri+ '/xmlrpc/object') + partner_id = execute( conn, 'execute', self._dbname, int(self._uid), self._pwd, 'res.partner', 'search', [('name','=',ustr(partner))]) + country_id = execute( conn, 'execute', self._dbname, int(self._uid), self._pwd, 'res.country', 'search', [('name','=',ustr(country_val))]) + state_id = execute( conn, 'execute', self._dbname, int(self._uid), self._pwd, 'res.country.state', 'search', [('name','=',ustr(state_val))]) + address_id = execute( conn, 'execute', self._dbname, int(self._uid), self._pwd, 'res.partner.address', 'search', [('email','=',ustr(email))]) + if not partner_id or not address_id or not country_id or not state_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={ + 'partner_id' : partner_id[0], + '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'], + 'country_id' : country_id[0], + 'state_id' : state_id[0] + } + 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 + 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 + 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 def SearchPartner(self, mail_id = ""): - import win32ui - conn = xmlrpclib.ServerProxy(self._uri+ '/xmlrpc/object') - address = execute( conn, 'execute', self._dbname, int(self._uid), self._pwd, 'res.partner.address', 'search', [('email','=',ustr(mail_id))]) - if not address: - return None - else: - add_rec = execute( conn, 'execute', self._dbname, int(self._uid), self._pwd, 'res.partner.address', 'read', address[0]) - partner = add_rec.get('partner_id',False) - if partner: - return partner[0] - else: - return True - return partner_id[0] + import win32ui + conn = xmlrpclib.ServerProxy(self._uri+ '/xmlrpc/object') + address = execute( conn, 'execute', self._dbname, int(self._uid), self._pwd, 'res.partner.address', 'search', [('email','=',ustr(mail_id))]) + if not address: + return None + else: + add_rec = execute( conn, 'execute', self._dbname, int(self._uid), self._pwd, 'res.partner.address', 'read', address[0]) + partner = add_rec.get('partner_id',False) + if partner: + return partner[0] + else: + return True + return partner_id[0] def SearchEmailResources(self, message_id): - import win32ui - import eml + import win32ui + import eml - conn = xmlrpclib.ServerProxy(self._uri+ '/xmlrpc/object') - sub = "" - res_vals = [] - mail_id = execute( conn, 'execute', self._dbname, int(self._uid), self._pwd, 'mailgate.message', 'search', [('message_id','=',message_id)]) - if not mail_id: - return None - address = execute( conn, 'execute', self._dbname, int(self._uid), self._pwd, 'mailgate.message','read',mail_id[0],['model','res_id']) - for key, vals in address.items(): - res_vals.append([key,vals]) - return res_vals + conn = xmlrpclib.ServerProxy(self._uri+ '/xmlrpc/object') + sub = "" + res_vals = [] + mail_id = execute( conn, 'execute', self._dbname, int(self._uid), self._pwd, 'mailgate.message', 'search', [('message_id','=',message_id)]) + if not mail_id: + return None + address = execute( conn, 'execute', self._dbname, int(self._uid), self._pwd, 'mailgate.message','read',mail_id[0],['model','res_id']) + for key, vals in address.items(): + res_vals.append([key,vals]) + return res_vals def GetCountry(self, country_search=''): - conn = xmlrpclib.ServerProxy(self._uri+ '/xmlrpc/object') - ids=[] - obj_list=[] - domain = [] - if not country_search.strip() == '': - domain.append(('name','ilike',ustr(country_search))) - ids = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'res.country','search',domain) - if ids: - ids.sort() - for id in ids: - object = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'res.country','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 + conn = xmlrpclib.ServerProxy(self._uri+ '/xmlrpc/object') + ids=[] + obj_list=[] + domain = [] + if not country_search.strip() == '': + domain.append(('name','ilike',ustr(country_search))) + ids = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'res.country','search',domain) + if ids: + ids.sort() + for id in ids: + object = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'res.country','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 GetStates(self, state_search='', country=None): - import win32ui - conn = xmlrpclib.ServerProxy(self._uri+ '/xmlrpc/object') - ids = [] - c_id = [] - obj_list = [] - domain = [] - if not state_search.strip() == '': - domain.append(('name','ilike',ustr(state_search))) + import win32ui + conn = xmlrpclib.ServerProxy(self._uri+ '/xmlrpc/object') + ids = [] + c_id = [] + obj_list = [] + domain = [] + if not state_search.strip() == '': + domain.append(('name','ilike',ustr(state_search))) - if country == None: - ids = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'res.country.state','search',domain) - if not country == None: - c_id = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'res.country','search',[('name','=',ustr(country))]) - domain.append(('country_id','=',c_id[0])) - ids = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'res.country.state','search',domain) - if ids: - ids.sort() - for id in ids: - object = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'res.country.state','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 + if country == None: + ids = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'res.country.state','search',domain) + if not country == None: + c_id = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'res.country','search',[('name','=',ustr(country))]) + domain.append(('country_id','=',c_id[0])) + ids = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'res.country.state','search',domain) + if ids: + ids.sort() + for id in ids: + object = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'res.country.state','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 FindCountryForState(self, state_search=''): - import win32ui - res_vals = [] - conn = xmlrpclib.ServerProxy(self._uri+ '/xmlrpc/object') - ids = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'res.country.state','search',[('name','=',ustr(state_search))]) - if not ids: - return None - object = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'res.country.state','read',ids)[0] - country = object['country_id'][1] - return country + import win32ui + res_vals = [] + conn = xmlrpclib.ServerProxy(self._uri+ '/xmlrpc/object') + ids = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'res.country.state','search',[('name','=',ustr(state_search))]) + if not ids: + return None + object = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'res.country.state','read',ids)[0] + country = object['country_id'][1] + return country + def CreateEmailAttachment(self, rec, email): + result = {} + conn = xmlrpclib.ServerProxy(self._uri+ '/xmlrpc/object') + att_folder_path = os.path.abspath(os.path.dirname("%temp%\\")) + if not os.path.exists(att_folder_path): + os.makedirs(att_folder_path) + obj = rec[0] + obj_id = rec[1] + res={} + res['res_model'] = obj + ls = ['*', '/', '\\', '<', '>', ':', '?', '"', '|', '\t', '\n',':','~'] + sub = (email.Subject).replace(' ','') + if sub.strip() == '': + sub = 'NO SBUJECT' + fn = sub + for c in ls: + fn = fn.replace(c,'') + if len(fn) > 64: + l = 64 - len(fn) + f = fn.split('-') + fn = '-'.join(f[1:]) + if len(fn) > 64: + l = 64 - len(fn) + f = fn.split('.') + fn = f[0][0:l] + '.' + f[-1] + fn = fn+'.txt' + att_path = os.path.join(att_folder_path,fn) + f=open(fn,"w") + f.writelines(ustr(email.Body).encode('iso-8859-1')) + f.close() + f=open(fn,"r") + content = "".join(f.readlines()).encode('base64') + f.close() + att_path = os.path.join(att_folder_path,fn) + res['name'] = ustr(sub) + 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) + return id diff --git a/addons/thunderbird/partner/partner.py b/addons/thunderbird/partner/partner.py index e9de536c135..327f895bdec 100644 --- a/addons/thunderbird/partner/partner.py +++ b/addons/thunderbird/partner/partner.py @@ -159,6 +159,7 @@ class thunderbird_partner(osv.osv_memory): msg_ids = [] res = {} res_ids = [] + obj_list= ['crm.lead','project.issue','hr.applicant','res.partner'] for ref_id in ref_ids: msg_new = dictcreate.get('message') ref = ref_id.split(',') @@ -168,6 +169,31 @@ class thunderbird_partner(osv.osv_memory): msg_ids = msg_pool.search(cr, uid, [('message_id','=',message_id),('res_id','=',res_id),('model','=',model)]) if msg_ids and len(msg_ids): continue + if model not in obj_list: + res={} + obj_attch = self.pool.get('ir.attachment') + ls = ['*', '/', '\\', '<', '>', ':', '?', '"', '|', '\t', '\n',':','~'] + sub = (email.Subject).replace(' ','') + if sub.strip() == '': + sub = 'NO SBUJECT' + fn = sub + for c in ls: + fn = fn.replace(c,'') + if len(fn) > 64: + l = 64 - len(fn) + f = fn.split('-') + fn = '-'.join(f[1:]) + if len(fn) > 64: + l = 64 - len(fn) + f = fn.split('.') + fn = f[0][0:l] + '.' + f[-1] + fn = fn[:-4]+'.txt' + res['res_model'] = model + res['name'] = msg.get('subject','NO-SUBJECT') + res['datas_fname'] = fn + res['datas'] = base64.b64encode(msg.get('body')) + res['res_id'] = res_id + obj_attch.create(cr, uid, res) server_tools_pool.history_message(cr, uid, model, res_id, msg_new) res_ids.append(res_id) return len(res_ids)