Merge lp:~therp-nl/therp-addons/7.0-report_aeroo_ooo_plugin_python3 into lp:~therp-nl/therp-addons/7.0
- 7.0-report_aeroo_ooo_plugin_python3
- Merge into 7.0
Proposed by
Holger Brunn (Therp)
Status: | Merged |
---|---|
Merged at revision: | 110 |
Proposed branch: | lp:~therp-nl/therp-addons/7.0-report_aeroo_ooo_plugin_python3 |
Merge into: | lp:~therp-nl/therp-addons/7.0 |
Prerequisite: | lp:~therp-nl/therp-addons/7.0-report_aeroo_ooo_plugin_save_addressee |
Diff against target: |
381 lines (+82/-54) 9 files modified
report_aeroo_ooo_plugin/__openerp__.py (+2/-2) report_aeroo_ooo_plugin/plugin/OpenERP_Aeroo.py (+5/-3) report_aeroo_ooo_plugin/plugin/description.xml (+1/-1) report_aeroo_ooo_plugin/plugin/pythonpath/FileUtils.py (+7/-4) report_aeroo_ooo_plugin/plugin/pythonpath/Localization.py (+24/-20) report_aeroo_ooo_plugin/plugin/pythonpath/OptionsHandler.py (+1/-1) report_aeroo_ooo_plugin/plugin/pythonpath/TinySocket.py (+38/-19) report_aeroo_ooo_plugin_save_addressee/model/aeroo_mailmerge.py (+2/-2) report_aeroo_ooo_plugin_save_addressee/view/aeroo_mailmerge.xml (+2/-2) |
To merge this branch: | bzr merge lp:~therp-nl/therp-addons/7.0-report_aeroo_ooo_plugin_python3 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Stefan Rijnhart (Opener) (community) | Approve | ||
Review via email:
|
Commit message
Description of the change
To post a comment you must log in.
- 124. By Holger Brunn (Therp)
-
[FIX] report_
aeroo_ooo_ plugin: remove debug statement
Revision history for this message
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Stefan Rijnhart (Opener) (stefan-opener) wrote : | # |
review:
Approve
- 125. By Holger Brunn (Therp)
-
[FIX] name_get returns a list, not a dictionary
- 126. By Holger Brunn (Therp)
-
[IMP] report_
aeroo_ooo_ plugin_ save_addressee: Also hide delete button in
form view - 127. By Holger Brunn (Therp)
-
[IMP] allow deleting mail merges via the UI
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'report_aeroo_ooo_plugin/__openerp__.py' |
2 | --- report_aeroo_ooo_plugin/__openerp__.py 2014-09-10 10:40:09 +0000 |
3 | +++ report_aeroo_ooo_plugin/__openerp__.py 2014-09-10 10:40:10 +0000 |
4 | @@ -60,7 +60,7 @@ |
5 | Manager -> Add. After installation, restart Writer in order to see the newly |
6 | created menus. |
7 | |
8 | -You also need python-uno (*not python3-uno*) installed on the client machines. |
9 | +You also need python-uno (or python3-uno) installed on the client machines. |
10 | |
11 | Configure access to your database via Tools -> Options -> LibreOffice Writer -> |
12 | Odoo Options. |
13 | @@ -71,7 +71,7 @@ |
14 | If you experience an empty configuration dialog or missing translations, |
15 | probably your extension registry is corrupt. |
16 | |
17 | -``rm -rf ~/.config/libreoffice/4/user{extensions,uno_packages}`` |
18 | +``rm -rf ~/.config/libreoffice/4/user/{extensions,uno_packages}`` |
19 | |
20 | fixes the problem, but you lose all installed extensions, their configuration |
21 | and you'll have to reinstall them. |
22 | |
23 | === modified file 'report_aeroo_ooo_plugin/plugin/OpenERP_Aeroo.py' |
24 | --- report_aeroo_ooo_plugin/plugin/OpenERP_Aeroo.py 2014-09-10 10:40:09 +0000 |
25 | +++ report_aeroo_ooo_plugin/plugin/OpenERP_Aeroo.py 2014-09-10 10:40:10 +0000 |
26 | @@ -25,6 +25,7 @@ |
27 | import base64 |
28 | import tempfile |
29 | import traceback |
30 | +import codecs |
31 | from com.sun.star.task import XJobExecutor |
32 | |
33 | try: |
34 | @@ -113,7 +114,7 @@ |
35 | password, |
36 | 'instant.aeroo', |
37 | 'create_report', |
38 | - base64.encodestring(data), |
39 | + codecs.decode(base64.encodestring(data), 'ascii'), |
40 | filter_id |
41 | ) |
42 | if res: |
43 | @@ -124,8 +125,9 @@ |
44 | tempFile = tempfile.mkstemp('.odt') |
45 | os.close(tempFile[0]) |
46 | filename = tempFile[1] |
47 | - FileUtils.write_data_to_file(filename, |
48 | - base64.decodestring(res[0])) |
49 | + FileUtils.write_data_to_file( |
50 | + filename, |
51 | + base64.decodestring(codecs.encode(res[0], 'ascii'))) |
52 | Desktop.loadComponentFromURL( |
53 | Danny.convertToURL(filename), "_blank", 0, ()) |
54 | else: |
55 | |
56 | === modified file 'report_aeroo_ooo_plugin/plugin/description.xml' |
57 | --- report_aeroo_ooo_plugin/plugin/description.xml 2014-09-10 10:40:09 +0000 |
58 | +++ report_aeroo_ooo_plugin/plugin/description.xml 2014-09-10 10:40:10 +0000 |
59 | @@ -1,6 +1,6 @@ |
60 | <?xml version="1.0" encoding="UTF-8"?> |
61 | <description xmlns="http://openoffice.org/extensions/description/2006" xmlns:xlink="http://www.w3.org/1999/xlink"> |
62 | - <version value="0.2.0"/> |
63 | + <version value="0.2.1"/> |
64 | <identifier value="org.odoo.report_aeroo_ooo_plugin"/> |
65 | <display-name> |
66 | <name lang="en">Odoo Mail Merge</name> |
67 | |
68 | === modified file 'report_aeroo_ooo_plugin/plugin/pythonpath/FileUtils.py' |
69 | --- report_aeroo_ooo_plugin/plugin/pythonpath/FileUtils.py 2012-07-09 13:47:10 +0000 |
70 | +++ report_aeroo_ooo_plugin/plugin/pythonpath/FileUtils.py 2014-09-10 10:40:10 +0000 |
71 | @@ -20,21 +20,24 @@ |
72 | # |
73 | ############################################################################## |
74 | import os |
75 | -import urllib |
76 | +try: |
77 | + from urllib import unquote |
78 | +except ImportError: |
79 | + from urllib.parse import unquote |
80 | |
81 | def get_absolute_file_path( url ): |
82 | - url_unquoted = urllib.unquote(url) |
83 | + url_unquoted = unquote(url) |
84 | return os.name == 'nt' and url_unquoted[1:] or url_unquoted |
85 | |
86 | # This function reads the content of a file and return it to the caller |
87 | def read_data_from_file( filename ): |
88 | - fp = file( filename, "rb" ) |
89 | + fp = open( filename, "rb" ) |
90 | data = fp.read() |
91 | fp.close() |
92 | return data |
93 | |
94 | # This function writes the content to a file |
95 | def write_data_to_file( filename, data ): |
96 | - fp = file( filename, 'wb' ) |
97 | + fp = open( filename, 'wb' ) |
98 | fp.write( data ) |
99 | fp.close() |
100 | |
101 | === modified file 'report_aeroo_ooo_plugin/plugin/pythonpath/Localization.py' |
102 | --- report_aeroo_ooo_plugin/plugin/pythonpath/Localization.py 2014-09-10 10:40:09 +0000 |
103 | +++ report_aeroo_ooo_plugin/plugin/pythonpath/Localization.py 2014-09-10 10:40:10 +0000 |
104 | @@ -14,6 +14,7 @@ |
105 | import sys |
106 | import uno |
107 | import unohelper |
108 | +import logging |
109 | |
110 | def typednamedvalues( type, *args, **kwargs ): |
111 | if args: |
112 | @@ -53,8 +54,8 @@ |
113 | 'org.odoo.report_aeroo_ooo_plugin.OpenERPOptions/ConfigNode') |
114 | self.initpath() |
115 | self.initlanguage() |
116 | - except Exception, e: |
117 | - print >> sys.stderr, e |
118 | + except Exception as e: |
119 | + logging.exception(e) |
120 | |
121 | def getconfig( self, nodepath, update = False ): |
122 | if update: |
123 | @@ -68,7 +69,7 @@ |
124 | |
125 | def initlanguage( self ): |
126 | config = self.getconfig( '/org.openoffice.Setup' ) |
127 | - self.uilanguage = config.L10N.ooLocale.encode( 'ascii' ).split( '-' )[0] |
128 | + self.uilanguage = config.L10N.ooLocale.encode( 'ascii' ).split(b'-')[0] |
129 | if self.uilanguage not in self.SUPPORTED_LANGUAGES: |
130 | self.uilanguage = self.SUPPORTED_LANGUAGES[0] |
131 | |
132 | @@ -78,8 +79,8 @@ |
133 | if not hasattr( self, 'localization' ): |
134 | try: |
135 | self.loadlocalization() |
136 | - except Exception, e: |
137 | - print e |
138 | + except Exception as e: |
139 | + logging.exception(e) |
140 | if string not in self.localization: return 'unlocalized: %s' % string |
141 | if language in self.localization[string]: |
142 | return self.localization[string][language] |
143 | @@ -95,21 +96,24 @@ |
144 | 'Dialogs', |
145 | self.__class__.__name__ |
146 | ) |
147 | - for f in glob.glob(os.path.join(path, 'DialogStrings_*.properties')): |
148 | - sf = os.path.split( f )[-1] |
149 | - lang = sf[sf.index( '_' )+1:sf.index( '_' )+3] |
150 | - for l in file( f ): |
151 | - l = l.split( '#' )[0].strip() |
152 | - if len( l ) == 0: continue |
153 | - assert '=' in l |
154 | - key, value = l.split( '=', 1 ) |
155 | - key = key.strip() |
156 | - value = value.strip() |
157 | - if key not in self.localization: |
158 | - self.localization[key] = {} |
159 | - self.localization[key][lang] = value.decode( 'unicode_escape' ).replace( '\\', '' ) |
160 | - except Exception, e: |
161 | - print >> sys.stderr, e |
162 | + for f in glob.glob(os.path.join(path, 'DialogStrings_*.properties')): |
163 | + sf = os.path.split( f )[-1] |
164 | + lang = sf[sf.index( '_' )+1:sf.index( '_' )+3] |
165 | + for l in open( f ): |
166 | + l = l.split( '#' )[0].strip() |
167 | + if len( l ) == 0: continue |
168 | + assert '=' in l |
169 | + key, value = l.split( '=', 1 ) |
170 | + key = key.strip() |
171 | + value = value.strip() |
172 | + if key not in self.localization: |
173 | + self.localization[key] = {} |
174 | + if hasattr(value, 'decode'): |
175 | + self.localization[key][lang] = value.decode( 'unicode_escape' ).replace( '\\', '' ) |
176 | + else: |
177 | + self.localization[key][lang] = value.encode('ascii').decode('unicode_escape').replace( '\\', '' ) |
178 | + except Exception as e: |
179 | + logging.exception(e) |
180 | |
181 | # uno implementation |
182 | g_ImplementationHelper = unohelper.ImplementationHelper() |
183 | |
184 | === modified file 'report_aeroo_ooo_plugin/plugin/pythonpath/OptionsHandler.py' |
185 | --- report_aeroo_ooo_plugin/plugin/pythonpath/OptionsHandler.py 2014-09-10 10:40:09 +0000 |
186 | +++ report_aeroo_ooo_plugin/plugin/pythonpath/OptionsHandler.py 2014-09-10 10:40:10 +0000 |
187 | @@ -83,7 +83,7 @@ |
188 | for key, value in cfg_values.items(): |
189 | ConfigWriter.replaceByName(key, value) |
190 | ConfigWriter.commitChanges() |
191 | - except Exception, e: |
192 | + except Exception as e: |
193 | log(e) |
194 | |
195 | def get_options(self): |
196 | |
197 | === modified file 'report_aeroo_ooo_plugin/plugin/pythonpath/TinySocket.py' |
198 | --- report_aeroo_ooo_plugin/plugin/pythonpath/TinySocket.py 2012-07-09 13:47:10 +0000 |
199 | +++ report_aeroo_ooo_plugin/plugin/pythonpath/TinySocket.py 2014-09-10 10:40:10 +0000 |
200 | @@ -20,14 +20,33 @@ |
201 | # |
202 | ############################################################################## |
203 | import sys |
204 | +import logging |
205 | import socket |
206 | -import cPickle |
207 | -import cStringIO |
208 | -import xmlrpclib |
209 | +try: |
210 | + import cPickle |
211 | +except ImportError: |
212 | + import pickle as cPickle |
213 | +try: |
214 | + from cStringIO import StringIO |
215 | +except ImportError: |
216 | + from io import StringIO |
217 | +try: |
218 | + import xmlrpclib |
219 | +except ImportError: |
220 | + import xmlrpc.client as xmlrpclib |
221 | import re |
222 | import traceback |
223 | import Localization |
224 | |
225 | +#http://stackoverflow.com/a/11301781 |
226 | +try: |
227 | + isinstance("", basestring) |
228 | + def isstr(s): |
229 | + return isinstance(s, basestring) |
230 | +except NameError: |
231 | + def isstr(s): |
232 | + return isinstance(s, str) or isinstance(s, bytes) |
233 | + |
234 | class Myexception(Exception): |
235 | def __init__(self, faultCode, faultString): |
236 | self.faultCode = faultCode |
237 | @@ -60,14 +79,14 @@ |
238 | while totalsent < size: |
239 | sent = self.sock.send(msg[totalsent:]) |
240 | if sent == 0: |
241 | - raise RuntimeError, "socket connection broken" |
242 | + raise RuntimeError("socket connection broken") |
243 | totalsent = totalsent + sent |
244 | def myreceive(self): |
245 | buf='' |
246 | while len(buf) < 8: |
247 | chunk = self.sock.recv(8 - len(buf)) |
248 | if chunk == '': |
249 | - raise RuntimeError, "socket connection broken" |
250 | + raise RuntimeError("socket connection broken") |
251 | buf += chunk |
252 | size = int(buf) |
253 | buf = self.sock.recv(1) |
254 | @@ -79,9 +98,9 @@ |
255 | while len(msg) < size: |
256 | chunk = self.sock.recv(size-len(msg)) |
257 | if chunk == '': |
258 | - raise RuntimeError, "socket connection broken" |
259 | + raise RuntimeError("socket connection broken") |
260 | msg = msg + chunk |
261 | - msgio = cStringIO.StringIO(msg) |
262 | + msgio = StringIO(msg) |
263 | unpickler = cPickle.Unpickler(msgio) |
264 | unpickler.find_global = None |
265 | res = unpickler.load() |
266 | @@ -122,7 +141,7 @@ |
267 | def __init__(self, ctx, url): |
268 | try: |
269 | super(RPCSession, self).__init__(ctx, url) |
270 | - except Exception, e: |
271 | + except Exception as e: |
272 | print >> sys.stderr, e |
273 | m = re.match('^(http[s]?://|socket://)([\w.\-]+):(\d{1,5})$', url or '') |
274 | if not m: |
275 | @@ -165,16 +184,16 @@ |
276 | try: |
277 | result = self.gateway.execute(obj, method, *args) |
278 | return self.__convert(result) |
279 | - except Exception,e: |
280 | - info = reduce(lambda x, y: x+y, traceback.format_exception(sys.exc_type, sys.exc_value, sys.exc_traceback)) |
281 | + except Exception as e: |
282 | + logging.exception(e) |
283 | |
284 | def __convert(self, result): |
285 | |
286 | - if isinstance(result, basestring): |
287 | + if isstr(result): |
288 | # try to convert into unicode string |
289 | try: |
290 | return ustr(result) |
291 | - except Exception, e: |
292 | + except Exception as e: |
293 | return result |
294 | |
295 | elif isinstance(result, list): |
296 | @@ -207,7 +226,7 @@ |
297 | sock = xmlrpclib.ServerProxy(rpc_url + 'db') |
298 | try: |
299 | return sock.list() |
300 | - except Exception, e: |
301 | + except Exception as e: |
302 | return -1 |
303 | |
304 | def login(self, db, user, password): |
305 | @@ -220,8 +239,8 @@ |
306 | socket.setdefaulttimeout(10) |
307 | try: |
308 | res = sock.login(db, user, password) |
309 | - except Exception, e: |
310 | - info = reduce(lambda x, y: x+y, traceback.format_exception(sys.exc_type, sys.exc_value, sys.exc_traceback)) |
311 | + except Exception as e: |
312 | + logging.exception(e) |
313 | return -1 |
314 | finally: |
315 | socket.setdefaulttimeout(oldtimeout) |
316 | @@ -250,7 +269,7 @@ |
317 | res = sock.myreceive() |
318 | sock.disconnect() |
319 | return res |
320 | - except Exception, e: |
321 | + except Exception as e: |
322 | return -1 |
323 | |
324 | def login(self, db, user, password): |
325 | @@ -260,7 +279,7 @@ |
326 | sock.mysend(('common', 'login', db, user, password)) |
327 | res = sock.myreceive() |
328 | sock.disconnect() |
329 | - except Exception, e: |
330 | + except Exception as e: |
331 | return -1 |
332 | return res |
333 | def execute(self,obj, method, *args): |
334 | @@ -273,5 +292,5 @@ |
335 | sock.disconnect() |
336 | return res |
337 | |
338 | - except Exception,e: |
339 | - info = reduce(lambda x, y: x+y, traceback.format_exception(sys.exc_type, sys.exc_value, sys.exc_traceback)) |
340 | + except Exception as e: |
341 | + logging.exception(e) |
342 | |
343 | === modified file 'report_aeroo_ooo_plugin_save_addressee/model/aeroo_mailmerge.py' |
344 | --- report_aeroo_ooo_plugin_save_addressee/model/aeroo_mailmerge.py 2014-09-10 10:40:09 +0000 |
345 | +++ report_aeroo_ooo_plugin_save_addressee/model/aeroo_mailmerge.py 2014-09-10 10:40:10 +0000 |
346 | @@ -48,11 +48,11 @@ |
347 | cr, uid, [('code', '=', user.partner_id.lang)], |
348 | context=context)[0], |
349 | context=context) |
350 | - return dict([ |
351 | + return [ |
352 | (this.id, '%s [%s]' % ( |
353 | this.filter_id.name, |
354 | datetime.datetime.strptime( |
355 | this.create_date, DEFAULT_SERVER_DATETIME_FORMAT).strftime( |
356 | lang.date_format))) |
357 | for this in self.browse(cr, uid, ids, context=context) |
358 | - ]) |
359 | + ] |
360 | |
361 | === modified file 'report_aeroo_ooo_plugin_save_addressee/view/aeroo_mailmerge.xml' |
362 | --- report_aeroo_ooo_plugin_save_addressee/view/aeroo_mailmerge.xml 2014-09-10 10:40:09 +0000 |
363 | +++ report_aeroo_ooo_plugin_save_addressee/view/aeroo_mailmerge.xml 2014-09-10 10:40:10 +0000 |
364 | @@ -4,7 +4,7 @@ |
365 | <record id="form_aeroo_mailmerge" model="ir.ui.view"> |
366 | <field name="model">aeroo.mailmerge</field> |
367 | <field name="arch" type="xml"> |
368 | - <form string="Mail merges" version="7.0" create="0"> |
369 | + <form string="Mail merges" version="7.0" create="0" delete="1"> |
370 | <sheet> |
371 | <group> |
372 | <field name="create_date" /> |
373 | @@ -33,7 +33,7 @@ |
374 | <record id="tree_aeroo_mailmerge" model="ir.ui.view"> |
375 | <field name="model">aeroo.mailmerge</field> |
376 | <field name="arch" type="xml"> |
377 | - <tree string="Mail merges" create="0" delete="0"> |
378 | + <tree string="Mail merges" create="0" delete="1"> |
379 | <field name="create_date" /> |
380 | <field name="create_uid" /> |
381 | <field name="filter_id" /> |
Great, tnx!