Merge lp:~therp-nl/therp-addons/7.0-report_aeroo_ooo_plugin into lp:~therp-nl/therp-addons/7.0

Proposed by Holger Brunn (Therp)
Status: Merged
Merged at revision: 109
Proposed branch: lp:~therp-nl/therp-addons/7.0-report_aeroo_ooo_plugin
Merge into: lp:~therp-nl/therp-addons/7.0
Diff against target: 925 lines (+324/-174)
18 files modified
report_aeroo_ooo_plugin/__openerp__.py (+44/-20)
report_aeroo_ooo_plugin/model/__init__.py (+1/-0)
report_aeroo_ooo_plugin/model/get_plugin.py (+24/-11)
report_aeroo_ooo_plugin/model/instant_aeroo.py (+34/-35)
report_aeroo_ooo_plugin/model/ir_filters.py (+49/-0)
report_aeroo_ooo_plugin/plugin/META-INF/manifest.xml (+16/-14)
report_aeroo_ooo_plugin/plugin/OpenERP_Aeroo.py (+97/-62)
report_aeroo_ooo_plugin/plugin/Paths.xcu (+11/-0)
report_aeroo_ooo_plugin/plugin/description.xml (+7/-4)
report_aeroo_ooo_plugin/plugin/dialogs/FilterChooser.xdl (+10/-0)
report_aeroo_ooo_plugin/plugin/dialogs/FilterChooser_en_US.properties (+1/-0)
report_aeroo_ooo_plugin/plugin/pythonpath/Localization.py (+5/-6)
report_aeroo_ooo_plugin/plugin/pythonpath/OptionsHandler.py (+5/-4)
report_aeroo_ooo_plugin/plugin/registry/data/org/odoo/report_aeroo_ooo_plugin/OpenERPOptions.xcu (+1/-1)
report_aeroo_ooo_plugin/plugin/registry/data/org/openoffice/Office/Addons.xcu (+4/-4)
report_aeroo_ooo_plugin/plugin/registry/data/org/openoffice/Office/OptionsDialog.xcu (+5/-5)
report_aeroo_ooo_plugin/plugin/registry/schema/org/odoo/report_aeroo_ooo_plugin/OpenERPOptions.xcs (+2/-2)
report_aeroo_ooo_plugin/view/get_plugin.xml (+8/-6)
To merge this branch: bzr merge lp:~therp-nl/therp-addons/7.0-report_aeroo_ooo_plugin
Reviewer Review Type Date Requested Status
Stefan Rijnhart (Opener) (community) Approve
Review via email: mp+228074@code.launchpad.net

Commit message

[ADD] port report_aeroo_ooo_plugin

Description of the change

This is a port of report_aeroo_ooo_plugin to use odoo's built in filters.

Some small things were changed too:
- ids which were colliding with the report designer plugin were changed
- odoo branding
- provide a sample document template

To post a comment you must log in.
121. By Holger Brunn (Therp)

[IMP] bump versions

Revision history for this message
Stefan Rijnhart (Opener) (stefan-opener) wrote :

Very cool

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== renamed directory '__unported__/report_aeroo_ooo_plugin' => 'report_aeroo_ooo_plugin'
2=== modified file 'report_aeroo_ooo_plugin/__openerp__.py'
3--- __unported__/report_aeroo_ooo_plugin/__openerp__.py 2012-12-28 14:10:30 +0000
4+++ report_aeroo_ooo_plugin/__openerp__.py 2014-07-24 15:15:04 +0000
5@@ -19,44 +19,68 @@
6 #
7 ##############################################################################
8 {
9- "name" : "Aeroo reports plugin for OpenOffice.Org",
10- "version" : "0.1r33",
11- "author" : "Therp BV",
12+ "name": "Aeroo reports plugin for OpenOffice.Org",
13+ "version": "0.2",
14+ "author": "Therp BV",
15 "category": 'Generic Modules/Aeroo Reporting',
16 'complexity': "normal",
17 "description": """
18+Introduction
19+------------
20 This module provides an OpenOffice.org/LibreOffice extension plus a small
21 interface to the Aeroo Report module on the OpenERP side to allow mail merge
22 directly from the Writer application. Mail merge is performed on records
23-stored in the saved selection in OpenERP. The result is a single document in
24+stored in the saved selection in Odoo. The result is a single document in
25 editable ODF, appearing in a new office window.
26
27 The ability to perform mail merge on the fly reliefs the administrator from
28 having to create a Report XML record in the OpenERP database and upload the
29 template after every change.
30
31-Note that the ability to store and share selections of
32-OpenERP records is provided by the Saved Selection module by Therp BV. Due
33-to this dependency, this module is only fully functional in combination with
34-the OpenERP web client.
35-
36 After installation of this module, you can download the extension file
37-from your OpenERP database under
38+from your Odoo database under
39
40 Settings -> Customization -> Aeroo Reports -> Download Office Extension
41
42-Known issues:
43-If the resulting document does not contain page breaks between the merged
44-template on different records, make sure that the document ends with a
45-line break.
46-
47-This module is compatible with OpenERP 6.1.
48- """,
49+Usage
50+-----
51+In the web client, save a custom filter. When doing a mail merge, choose one of
52+those filters and your document will be filled with the records in the filter's
53+selection.
54+
55+Figuring out the correct fields to use can be tricky, use the web client's
56+debug mode to find out a field's name. Further, consult the provided document
57+template (this is a mail merge intended to work on partners) for some general
58+usage hints.
59+
60+Requirements
61+------------
62+
63+On the client side, you need to install the extension via Tools -> Extension
64+Manager -> Add. After installation, restart Writer in order to see the newly
65+created menus.
66+
67+You also need python-uno (*not python3-uno*) installed on the client machines.
68+
69+Configure access to your database via Tools -> Options -> LibreOffice Writer ->
70+Odoo Options.
71+
72+Troubleshooting
73+---------------
74+
75+If you experience an empty configuration dialog or missing translations,
76+probably your extension registry is corrupt.
77+
78+``rm -rf ~/.config/libreoffice/4/user{extensions,uno_packages}``
79+
80+fixes the problem, but you lose all installed extensions, their configuration
81+and you'll have to reinstall them.
82+""",
83 "website": 'http://therp.nl',
84- "images" : ['images/options.png', 'images/merge.png'],
85- "depends" : ['report_aeroo', 'trp_saved_selection'],
86+ "images": ['images/options.png', 'images/merge.png'],
87+ "depends": ['report_aeroo'],
88 'data': [
89 'view/get_plugin.xml',
90 ],
91- 'installable': False,
92+ 'installable': True,
93 }
94
95=== modified file 'report_aeroo_ooo_plugin/model/__init__.py'
96--- __unported__/report_aeroo_ooo_plugin/model/__init__.py 2012-07-09 13:47:10 +0000
97+++ report_aeroo_ooo_plugin/model/__init__.py 2014-07-24 15:15:04 +0000
98@@ -1,2 +1,3 @@
99 import instant_aeroo
100 import get_plugin
101+from . import ir_filters
102
103=== modified file 'report_aeroo_ooo_plugin/model/get_plugin.py'
104--- __unported__/report_aeroo_ooo_plugin/model/get_plugin.py 2012-08-09 14:50:47 +0000
105+++ report_aeroo_ooo_plugin/model/get_plugin.py 2014-07-24 15:15:04 +0000
106@@ -3,7 +3,7 @@
107 #
108 # OpenERP, Open Source Management Solution
109 # This module copyright (c) 2012 Therp BV (<http://therp.nl>)
110-#
111+#
112 # Thanks to the contributors of Stackoverflow refered to below.
113 #
114 # This program is free software: you can redistribute it and/or modify
115@@ -21,11 +21,15 @@
116 #
117 ##############################################################################
118
119-import os, glob, base64
120+import os
121+import glob
122+import base64
123 import zipfile
124 from StringIO import StringIO
125-from osv import osv, fields
126-from addons import get_module_resource
127+from openerp.osv import osv, fields
128+from openerp.addons import get_module_resource
129+from openerp.tools import human_size
130+
131
132 class GetPlugin(osv.TransientModel):
133 _name = 'report.aeroo.get_plugin'
134@@ -33,25 +37,34 @@
135 def get_plugin_zipfile(self, cr, uid, context=None):
136
137 def addFolderToZip(myZipFile, folder, path):
138- # http://stackoverflow.com/questions/458436/adding-folders-to-a-zip-file-using-python/459419#459419
139- folder = folder.encode('ascii') #convert path to ascii for ZipFile Method
140+ # http://stackoverflow.com/questions/458436/adding-folders-to-a-
141+ # zip-file-using-python/459419#459419
142+ #convert path to ascii for ZipFile Method
143+ folder = folder.encode('ascii')
144 for file in glob.glob(folder + "/*"):
145 relpath = os.path.join(path, os.path.basename(file))
146- print relpath
147 if os.path.isfile(file):
148 myZipFile.write(file, relpath, zipfile.ZIP_DEFLATED)
149 elif os.path.isdir(file):
150 addFolderToZip(myZipFile, file, relpath)
151
152- # http://stackoverflow.com/questions/3610221/how-to-create-an-in-memory-zip-file-with-directories-without-touching-the-disk
153+ # http://stackoverflow.com/questions/3610221/how-to-create-an-in-
154+ # memory-zip-file-with-directories-without-touching-the-disk
155 inMemoryOutputFile = StringIO()
156- zipFile = zipfile.ZipFile(inMemoryOutputFile, 'w')
157+ zipFile = zipfile.ZipFile(inMemoryOutputFile, 'w')
158 addFolderToZip(
159- zipFile, get_module_resource('report_aeroo_ooo_plugin', 'plugin'), '')
160+ zipFile, get_module_resource(
161+ 'report_aeroo_ooo_plugin', 'plugin'),
162+ '')
163 zipFile.close()
164 inMemoryOutputFile.seek(0)
165+ data = base64.encodestring(inMemoryOutputFile.getvalue())
166+
167+ if context and context.get('bin_size'):
168+ return human_size(len(data))
169+
170 return base64.encodestring(inMemoryOutputFile.getvalue())
171-
172+
173 _columns = {
174 'name': fields.char(
175 'Filename', size=128, readonly=True),
176
177=== modified file 'report_aeroo_ooo_plugin/model/instant_aeroo.py'
178--- __unported__/report_aeroo_ooo_plugin/model/instant_aeroo.py 2012-08-09 14:50:47 +0000
179+++ report_aeroo_ooo_plugin/model/instant_aeroo.py 2014-07-24 15:15:04 +0000
180@@ -3,11 +3,11 @@
181 #
182 # OpenERP, Open Source Management Solution
183 # This module copyright (c) 2012 Therp BV (<http://therp.nl>)
184-#
185+#
186 # Heavily based on and to be used with the Aeroo reports modules
187 # which are
188 # Copyright (c) 2009-2011 Alistek Ltd (http://www.alistek.com)
189-# Copyright (C) 2009 Domsense s.r.l.
190+# Copyright (C) 2009 Domsense s.r.l.
191 #
192 # This program is free software: you can redistribute it and/or modify
193 # it under the terms of the GNU Affero General Public License as
194@@ -34,10 +34,13 @@
195 """
196
197 import base64
198-from osv import osv
199-from report.report_sxw import rml_parse
200-from report_aeroo.report_aeroo import Aeroo_report
201-import pooler
202+from openerp.osv import osv
203+from openerp.tools.translate import _
204+from openerp.tools.safe_eval import const_eval
205+from openerp.report.report_sxw import rml_parse
206+from openerp.addons.report_aeroo.report_aeroo import Aeroo_report
207+from openerp.addons.report_aeroo.report_aeroo import AerooPrint
208+
209
210 class report_xml_duck(object):
211 attachment = False
212@@ -49,6 +52,7 @@
213 preload_mode = False
214 fallback_false = True
215 content_fname = False
216+ report_name = ''
217 id = []
218
219 def __init__(self, file_data):
220@@ -58,11 +62,10 @@
221 # and adjust in_format accordingly
222 self.in_format = 'oo-odt'
223
224+
225 class Aeroo_report_instant(Aeroo_report):
226
227 def __init__(self, cr, table):
228-# super(Aeroo_instant_report, self).__init__(name, table, rml, parser, header, store)
229-# self.logger("registering %s (%s)" % (name, table), netsvc.LOG_INFO)
230 self.name = 'report.odt.instantaeroo'
231 self.name2 = 'odt'
232 self.oo_subreports = []
233@@ -70,46 +73,42 @@
234 self.counters = {}
235 self.table = table
236 self.parser = rml_parse
237+ self.active_prints = {False: AerooPrint()}
238+
239
240 class instant_aeroo(osv.TransientModel):
241 _name = 'instant.aeroo'
242- """ Wrapper for Aeroo_instant_report,
243- as exposed through xml-rpc
244- """
245+ """ Wrapper for Aeroo_instant_report, as exposed through xml-rpc """
246
247- def create_report(self, cr, uid, file_data, context=None):
248+ def create_report(self, cr, uid, file_data, filter_id, context=None):
249 """
250 Return a tuple (list_of_docs, type)
251 """
252 if context is None:
253 context = {}
254-
255- store = self.pool.get('saved_selection.selection').get(
256- cr, uid, context)
257- if not store:
258- return (False, "No saved selection defined for this user.")
259-
260- # TODO: do a check against the template model?
261- (model, ids) = store
262+
263+ saved_filter = self.pool['ir.filters'].browse(cr, uid, filter_id,
264+ context=context)
265+ ids = self.pool[saved_filter.model_id].search(
266+ cr, uid,
267+ const_eval(saved_filter.domain),
268+ context=const_eval(saved_filter.context))
269+
270 if not ids:
271- return (False, "User's selection does not contain any items.")
272+ return (False, _("User's selection does not contain any items."))
273
274 data = {
275 'report_type': 'aeroo',
276- 'model': model
277+ 'model': saved_filter.model_id
278 }
279- context['active_model'] = model
280-
281+ ctx = context.copy()
282+ ctx['active_model'] = saved_filter.model_id
283+
284 try:
285- report = Aeroo_report_instant(cr, model)
286+ report = Aeroo_report_instant(cr, saved_filter.model_id)
287 report_xml = report_xml_duck(file_data)
288- to_return = [[], False]
289- for res_id in ids:
290- res = report.create_aeroo_report(
291- cr, uid, [res_id], data, report_xml, context=context)
292- if res and res[0]:
293- to_return[0].append(base64.encodestring(res[0]))
294- to_return[1] = res[1]
295- except Exception, e:
296- to_return = (False, unicode(e))
297- return to_return
298+ res = report.create_aeroo_report(
299+ cr, uid, ids, data, report_xml, context=context)
300+ return (base64.encodestring(res[0]), res[1])
301+ except ValueError, e:
302+ return (False, unicode(e))
303
304=== added file 'report_aeroo_ooo_plugin/model/ir_filters.py'
305--- report_aeroo_ooo_plugin/model/ir_filters.py 1970-01-01 00:00:00 +0000
306+++ report_aeroo_ooo_plugin/model/ir_filters.py 2014-07-24 15:15:04 +0000
307@@ -0,0 +1,49 @@
308+# -*- coding: utf-8 -*-
309+##############################################################################
310+#
311+# OpenERP, Open Source Management Solution
312+# This module copyright (C) 2014 Therp BV (<http://therp.nl>).
313+#
314+# This program is free software: you can redistribute it and/or modify
315+# it under the terms of the GNU Affero General Public License as
316+# published by the Free Software Foundation, either version 3 of the
317+# License, or (at your option) any later version.
318+#
319+# This program is distributed in the hope that it will be useful,
320+# but WITHOUT ANY WARRANTY; without even the implied warranty of
321+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
322+# GNU Affero General Public License for more details.
323+#
324+# You should have received a copy of the GNU Affero General Public License
325+# along with this program. If not, see <http://www.gnu.org/licenses/>.
326+#
327+##############################################################################
328+from openerp.osv.orm import Model
329+
330+
331+class IrFilters(Model):
332+ _inherit = 'ir.filters'
333+
334+ def get_libreoffice_filters(self, cr, uid, context=None):
335+ result = []
336+ for this in self.browse(
337+ cr, uid,
338+ self.search(
339+ cr, uid,
340+ [('user_id', 'in', [uid, False])],
341+ order='model_id, name',
342+ context=context),
343+ context=context):
344+ model = self.pool['ir.model'].browse(
345+ cr, uid,
346+ self.pool['ir.model'].search(
347+ cr, uid, [('model', '=', this.model_id)],
348+ context=context)[0],
349+ context)
350+ result.append(
351+ (
352+ this.id,
353+ "%s (%s)" % (this.name, model.name),
354+ )
355+ )
356+ return result
357
358=== modified file 'report_aeroo_ooo_plugin/plugin/META-INF/manifest.xml'
359--- __unported__/report_aeroo_ooo_plugin/plugin/META-INF/manifest.xml 2012-07-11 12:10:19 +0000
360+++ report_aeroo_ooo_plugin/plugin/META-INF/manifest.xml 2014-07-24 15:15:04 +0000
361@@ -1,17 +1,19 @@
362 <?xml version="1.0" encoding="UTF-8"?>
363 <manifest:manifest xmlns:manifest="http://openoffice.org/2001/manifest">
364- <manifest:file-entry manifest:media-type="application/vnd.sun.star.configuration-data"
365- manifest:full-path="registry/data/org/openerp/OpenERPOptions.xcu"/>
366- <manifest:file-entry manifest:media-type="application/vnd.sun.star.configuration-schema"
367- manifest:full-path="registry/schema/org/openerp/OpenERPOptions.xcs"/>
368- <manifest:file-entry manifest:media-type="application/vnd.sun.star.configuration-data"
369- manifest:full-path="registry/data/org/openoffice/Office/OptionsDialog.xcu"/>
370- <manifest:file-entry manifest:media-type="application/vnd.sun.star.configuration-data"
371- manifest:full-path="registry/data/org/openoffice/Office/Addons.xcu"/>
372- <manifest:file-entry manifest:media-type="application/vnd.sun.star.uno-component;type=Python"
373- manifest:full-path="pythonpath/Localization.py"/>
374- <manifest:file-entry manifest:media-type="application/vnd.sun.star.uno-component;type=Python"
375- manifest:full-path="pythonpath/OptionsHandler.py"/>
376- <manifest:file-entry manifest:media-type="application/vnd.sun.star.uno-component;type=Python"
377- manifest:full-path="OpenERP_Aeroo.py"/>
378+ <manifest:file-entry manifest:media-type="application/vnd.sun.star.configuration-data"
379+ manifest:full-path="registry/data/org/odoo/report_aeroo_ooo_plugin/OpenERPOptions.xcu"/>
380+ <manifest:file-entry manifest:media-type="application/vnd.sun.star.configuration-schema"
381+ manifest:full-path="registry/schema/org/odoo/report_aeroo_ooo_plugin/OpenERPOptions.xcs"/>
382+ <manifest:file-entry manifest:media-type="application/vnd.sun.star.configuration-data"
383+ manifest:full-path="registry/data/org/openoffice/Office/OptionsDialog.xcu"/>
384+ <manifest:file-entry manifest:media-type="application/vnd.sun.star.configuration-data"
385+ manifest:full-path="registry/data/org/openoffice/Office/Addons.xcu"/>
386+ <manifest:file-entry manifest:media-type="application/vnd.sun.star.uno-component;type=Python"
387+ manifest:full-path="pythonpath/Localization.py"/>
388+ <manifest:file-entry manifest:media-type="application/vnd.sun.star.uno-component;type=Python"
389+ manifest:full-path="pythonpath/OptionsHandler.py"/>
390+ <manifest:file-entry manifest:media-type="application/vnd.sun.star.uno-component;type=Python"
391+ manifest:full-path="OpenERP_Aeroo.py"/>
392+ <manifest:file-entry manifest:media-type="application/vnd.sun.star.configuration-data"
393+ manifest:full-path="Paths.xcu"/>
394 </manifest:manifest>
395
396=== modified file 'report_aeroo_ooo_plugin/plugin/OpenERP_Aeroo.py'
397--- __unported__/report_aeroo_ooo_plugin/plugin/OpenERP_Aeroo.py 2012-10-11 12:07:18 +0000
398+++ report_aeroo_ooo_plugin/plugin/OpenERP_Aeroo.py 2014-07-24 15:15:04 +0000
399@@ -1,17 +1,13 @@
400-##########################################################################
401+# -*- coding: utf-8 -*-
402+##############################################################################
403 #
404 # OpenERP, Open Source Management Solution
405-#
406-# This module (C) 2012 Therp BV (<http://therp.nl>)
407-#
408-# Contains elements from the OpenERP Report Designer plugin
409-# for OpenOffice, Copyright (C) 2004-2012 OpenERP SA
410-# (<http://openerp.com>).
411+# This module copyright (C) 2012-2014 Therp BV (<http://therp.nl>).
412 #
413 # This program is free software: you can redistribute it and/or modify
414-# it under the terms of the GNU Affero General Public License as published by
415-# the Free Software Foundation, either version 3 of the License, or
416-# (at your option) any later version.
417+# it under the terms of the GNU Affero General Public License as
418+# published by the Free Software Foundation, either version 3 of the
419+# License, or (at your option) any later version.
420 #
421 # This program is distributed in the hope that it will be useful,
422 # but WITHOUT ANY WARRANTY; without even the implied warranty of
423@@ -21,7 +17,6 @@
424 # You should have received a copy of the GNU Affero General Public License
425 # along with this program. If not, see <http://www.gnu.org/licenses/>.
426 #
427-#
428 ##############################################################################
429
430 import os
431@@ -32,14 +27,23 @@
432 import traceback
433 from com.sun.star.task import XJobExecutor
434
435-import Danny
436+try:
437+ import Danny
438+except ImportError:
439+ #enable to run without extension context
440+ sys.path.append(os.path.join(
441+ os.path.dirname(__file__),
442+ 'pythonpath',
443+ ))
444+ import Danny
445 import TinySocket
446 import FileUtils
447 import Localization
448 import LoginObject
449
450+
451 class Merge(Localization.LocalizedObject, XJobExecutor):
452- """
453+ """
454 Send the current open document to the OpenERP server
455 and trigger an Aeroo report on resources in the
456 stored selection. Merge the documents into one, separated
457@@ -49,22 +53,16 @@
458
459 def __init__(self, ctx):
460 super(Merge, self).__init__(ctx)
461- try:
462- self.__init_wrapped__(ctx)
463- except Exception, e:
464- print >> sys.stderr, e
465- traceback.print_exc(file=sys.stderr)
466+ self.ctx = ctx
467+ self.module = "OpenERP_Aeroo"
468+ self.version = "0.1"
469
470- def __init_wrapped__(self, ctx):
471-
472- self.ctx = ctx
473- self.module = "OpenERP_Aeroo"
474- self.version = "0.1"
475- login = LoginObject.LoginObject(ctx).getLogin()
476+ def trigger(self, args):
477+ login = LoginObject.LoginObject(self.ctx).getLogin()
478 if not login:
479 exit(1)
480 (url, database, uid, password) = login
481- self.sock=TinySocket.RPCSession(ctx, url)
482+ self.sock = TinySocket.RPCSession(self.ctx, url)
483 Desktop = Danny.getDesktop()
484 current = Desktop.getCurrentComponent()
485 if not current.hasLocation():
486@@ -79,6 +77,31 @@
487 "application/vnd.oasis.opendocument.text"))
488 )
489 current.store()
490+
491+ dialog = self.ctx.getServiceManager()\
492+ .createInstanceWithContext(
493+ "com.sun.star.awt.DialogProvider", self.ctx)\
494+ .createDialog(
495+ "vnd.sun.star.extension://org.odoo.report_aeroo_ooo_plugin/"
496+ "dialogs/FilterChooser.xdl")
497+
498+ listbox = dialog.getControl('filter')
499+ filters = self.sock.execute(
500+ database, uid, password, 'ir.filters', 'get_libreoffice_filters')
501+ listbox.addItems(tuple(n for i, n in filters), 0)
502+ listbox.setText(listbox.getItem(0))
503+
504+ filter_id = None
505+ if dialog.execute():
506+ filter_id = None
507+ filters = [i for i, n in filters if n == listbox.getText()]
508+ if filters:
509+ filter_id = filters[0]
510+ else:
511+ dialog.dispose()
512+ return
513+ dialog.dispose()
514+
515 data = FileUtils.read_data_from_file(
516 FileUtils.get_absolute_file_path(
517 current.getURL()[7:]
518@@ -90,44 +113,21 @@
519 password,
520 'instant.aeroo',
521 'create_report',
522- base64.encodestring(data)
523+ base64.encodestring(data),
524+ filter_id
525 )
526 if res:
527 if res[0]:
528- # Combine files, based on
529+ # Combine files, based on
530 # Russell Philip's OOO Macros
531 # http://sourceforge.net/projects/ooomacros/files/ (GPL)
532 tempFile = tempfile.mkstemp('.odt')
533 os.close(tempFile[0])
534 filename = tempFile[1]
535- component = False
536- for doc in res[0]:
537- if not component:
538- FileUtils.write_data_to_file(
539- filename,
540- base64.decodestring(doc)
541- )
542- component = Desktop.loadComponentFromURL(
543- Danny.convertToURL(filename),
544- "_blank", 0,
545- ()
546- )
547- else:
548- tempFile = tempfile.mkstemp('.odt')
549- os.close(tempFile[0])
550- filename2 = tempFile[1]
551- FileUtils.write_data_to_file(
552- filename2,
553- base64.decodestring(doc)
554- )
555- # Get a cursor at the end of the text
556- oTextRange = component.Text.End
557- oTextCursor = component.Text.createTextCursorByRange(oTextRange)
558- # Insert page break by changing PageDescName to the existing page style name
559- oTextCursor.PageDescName = oTextCursor.PageStyleName
560- # Insert document at text cursor position
561- oTextCursor.insertDocumentFromURL (Danny.convertToURL(filename2), ())
562- os.remove(filename2)
563+ FileUtils.write_data_to_file(filename,
564+ base64.decodestring(res[0]))
565+ Desktop.loadComponentFromURL(
566+ Danny.convertToURL(filename), "_blank", 0, ())
567 else:
568 # Second arg *may* contain a warning or error message
569 Danny.ErrorDialog(self.localize("error"), "%s" % res[1])
570@@ -136,22 +136,27 @@
571 self.localize("not.create"))
572
573 g_ImplementationHelper = unohelper.ImplementationHelper()
574-g_ImplementationHelper.addImplementation( Merge, "org.openoffice.openerp.report.aeroo.merge", ("com.sun.star.task.Job",),)
575+g_ImplementationHelper.addImplementation(
576+ Merge,
577+ "org.odoo.report_aeroo_ooo_plugin.merge",
578+ ("com.sun.star.task.Job",),)
579+
580
581 class About(Localization.LocalizedObject, XJobExecutor):
582 def __init__(self, ctx):
583 super(About, self).__init__(ctx)
584- self.module = "OpenERP_Aeroo"
585+ self.module = "OpenERP_Aeroo"
586 self.version = "0.1"
587 self.win = Danny.DBModalDialog(
588 60, 50, 200, 215,
589 self.localize("about"))
590
591+ def trigger(self, args):
592 fdBigFont = Danny.createUnoStruct("com.sun.star.awt.FontDescriptor")
593 fdBigFont.Width = 20
594 fdBigFont.Height = 25
595 fdBigFont.Weight = 120
596- fdBigFont.Family= 3
597+ fdBigFont.Family = 3
598
599 oLabelProdDesc = self.win.addFixedText("lblProdDesc", 3, 30, 196, 175)
600 oLabelProdDesc.Model.TextColor = 1
601@@ -164,7 +169,37 @@
602 oLabelProdDesc.Model.MultiLine = True
603 oLabelProdDesc.Text = self.localize("content")
604
605- self.win.doModalDialog("",None)
606-
607-g_ImplementationHelper.addImplementation( About, "org.openoffice.openerp.report.aeroo.about", ("com.sun.star.task.Job",),)
608-
609+ self.win.doModalDialog("", None)
610+
611+g_ImplementationHelper.addImplementation(
612+ About,
613+ "org.odoo.report_aeroo_ooo_plugin.about",
614+ ("com.sun.star.task.Job",),)
615+
616+if __name__ == "__main__":
617+# from https://wiki.openoffice.org/wiki/UNO_component_packaging#
618+# Python_component_testing
619+ import os
620+ import uno
621+
622+ # Start OpenOffice.org, listen for connections and open testing document
623+ os.system("lowriter '--accept=socket,host=localhost,port=2002;urp;' &")
624+
625+ # Get local context info
626+ localContext = uno.getComponentContext()
627+ resolver = localContext.ServiceManager.createInstanceWithContext(
628+ "com.sun.star.bridge.UnoUrlResolver", localContext)
629+
630+ ctx = None
631+
632+ # Wait until the OO.o starts and connection is established
633+ while ctx is None:
634+ try:
635+ ctx = resolver.resolve(
636+ "uno:socket,host=localhost,port=2002;urp;"
637+ "StarOffice.ComponentContext")
638+ except:
639+ pass
640+
641+ # Trigger our job
642+ merge = Merge(ctx)
643
644=== added file 'report_aeroo_ooo_plugin/plugin/Paths.xcu'
645--- report_aeroo_ooo_plugin/plugin/Paths.xcu 1970-01-01 00:00:00 +0000
646+++ report_aeroo_ooo_plugin/plugin/Paths.xcu 2014-07-24 15:15:04 +0000
647@@ -0,0 +1,11 @@
648+<?xml version='1.0' encoding='UTF-8'?>
649+
650+<oor:component-data oor:package="org.openoffice.Office" oor:name="Paths" xmlns:install="http://openoffice.org/2004/installation" xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
651+ <node oor:name="Paths">
652+ <node oor:name="Template" oor:op="fuse">
653+ <node oor:name="InternalPaths">
654+ <node oor:name="%origin%/template" oor:op="fuse"/>
655+ </node>
656+ </node>
657+ </node>
658+</oor:component-data>
659
660=== modified file 'report_aeroo_ooo_plugin/plugin/description.xml'
661--- __unported__/report_aeroo_ooo_plugin/plugin/description.xml 2012-07-11 12:10:19 +0000
662+++ report_aeroo_ooo_plugin/plugin/description.xml 2014-07-24 15:15:04 +0000
663@@ -1,10 +1,10 @@
664 <?xml version="1.0" encoding="UTF-8"?>
665 <description xmlns="http://openoffice.org/extensions/description/2006" xmlns:xlink="http://www.w3.org/1999/xlink">
666- <version value="0.1.1"/>
667- <identifier value="org.openerp"/>
668+ <version value="0.2.0"/>
669+ <identifier value="org.odoo.report_aeroo_ooo_plugin"/>
670 <display-name>
671- <name lang="en">Aeroo Reports (OpenERP) Mail Merge</name>
672- <name lang="nl">Aeroo Reports (OpenERP) Samenvoegen</name>
673+ <name lang="en">Odoo Mail Merge</name>
674+ <name lang="nl">Odoo Samenvoegen</name>
675 </display-name>
676 <publisher>
677 <name xlink:href="http://therp.nl" lang="en">Therp BV</name>
678@@ -13,4 +13,7 @@
679 </extension-description>
680 <registration>
681 </registration>
682+ <icon>
683+ <default xlink:href="odoo.png" />
684+ </icon>
685 </description>
686
687=== added file 'report_aeroo_ooo_plugin/plugin/dialogs/FilterChooser.xdl'
688--- report_aeroo_ooo_plugin/plugin/dialogs/FilterChooser.xdl 1970-01-01 00:00:00 +0000
689+++ report_aeroo_ooo_plugin/plugin/dialogs/FilterChooser.xdl 2014-07-24 15:15:04 +0000
690@@ -0,0 +1,10 @@
691+<?xml version="1.0" encoding="UTF-8"?>
692+<!DOCTYPE dlg:window PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "dialog.dtd">
693+<dlg:window xmlns:dlg="http://openoffice.org/2000/dialog" xmlns:script="http://openoffice.org/2000/script" dlg:id="FilterChooser" dlg:left="168" dlg:top="158" dlg:width="141" dlg:height="50" dlg:closeable="true" dlg:moveable="true">
694+ <dlg:bulletinboard>
695+ <dlg:text dlg:id="labelFilter" dlg:tab-index="0" dlg:left="3" dlg:top="3" dlg:width="136" dlg:height="12" dlg:value="&amp;options.filter"/>
696+ <dlg:combobox dlg:id="filter" dlg:tab-index="1" dlg:left="3" dlg:top="17" dlg:width="136" dlg:height="12" dlg:spin="true"/>
697+ <dlg:button dlg:id="cancel" dlg:tab-index="2" dlg:left="3" dlg:top="34" dlg:width="27" dlg:height="12" dlg:value="Cancel" dlg:button-type="cancel"/>
698+ <dlg:button dlg:id="okay" dlg:tab-index="3" dlg:left="115" dlg:top="34" dlg:width="24" dlg:height="12" dlg:default="true" dlg:value="Ok" dlg:button-type="ok"/>
699+ </dlg:bulletinboard>
700+</dlg:window>
701
702=== added file 'report_aeroo_ooo_plugin/plugin/dialogs/FilterChooser_en_US.properties'
703--- report_aeroo_ooo_plugin/plugin/dialogs/FilterChooser_en_US.properties 1970-01-01 00:00:00 +0000
704+++ report_aeroo_ooo_plugin/plugin/dialogs/FilterChooser_en_US.properties 2014-07-24 15:15:04 +0000
705@@ -0,0 +1,1 @@
706+options.filter=Saved filter to use
707
708=== added file 'report_aeroo_ooo_plugin/plugin/odoo.png'
709Binary files report_aeroo_ooo_plugin/plugin/odoo.png 1970-01-01 00:00:00 +0000 and report_aeroo_ooo_plugin/plugin/odoo.png 2014-07-24 15:15:04 +0000 differ
710=== modified file 'report_aeroo_ooo_plugin/plugin/pythonpath/Localization.py'
711--- __unported__/report_aeroo_ooo_plugin/plugin/pythonpath/Localization.py 2012-11-05 19:30:28 +0000
712+++ report_aeroo_ooo_plugin/plugin/pythonpath/Localization.py 2014-07-24 15:15:04 +0000
713@@ -49,7 +49,8 @@
714 ]
715 try:
716 self.ctx = args[0]
717- self.config = self.getconfig('org.openerp.OpenERPOptions/ConfigNode')
718+ self.config = self.getconfig(
719+ 'org.odoo.report_aeroo_ooo_plugin.OpenERPOptions/ConfigNode')
720 self.initpath()
721 self.initlanguage()
722 except Exception, e:
723@@ -79,9 +80,7 @@
724 self.loadlocalization()
725 except Exception, e:
726 print e
727- print string
728 if string not in self.localization: return 'unlocalized: %s' % string
729- print language
730 if language in self.localization[string]:
731 return self.localization[string][language]
732 elif self.SUPPORTED_LANGUAGES[0] in self.localization[string]:
733@@ -97,7 +96,6 @@
734 self.__class__.__name__
735 )
736 for f in glob.glob(os.path.join(path, 'DialogStrings_*.properties')):
737- print >> sys.stderr, f
738 sf = os.path.split( f )[-1]
739 lang = sf[sf.index( '_' )+1:sf.index( '_' )+3]
740 for l in file( f ):
741@@ -116,5 +114,6 @@
742 # uno implementation
743 g_ImplementationHelper = unohelper.ImplementationHelper()
744 g_ImplementationHelper.addImplementation(
745- LocalizedObject, "org.openerp.LocalizedObject",
746- ("org.openerp.LocalizedObject",),)
747+ LocalizedObject,
748+ "org.odoo.report_aeroo_ooo_plugin.LocalizedObject",
749+ ("org.odoo.report_aeroo_ooo_plugin.LocalizedObject",),)
750
751=== modified file 'report_aeroo_ooo_plugin/plugin/pythonpath/OptionsHandler.py'
752--- __unported__/report_aeroo_ooo_plugin/plugin/pythonpath/OptionsHandler.py 2012-07-09 13:47:10 +0000
753+++ report_aeroo_ooo_plugin/plugin/pythonpath/OptionsHandler.py 2014-07-24 15:15:04 +0000
754@@ -44,7 +44,8 @@
755 "com.sun.star.configuration.ConfigurationProvider", ctx)
756 self.node = uno.createUnoStruct("com.sun.star.beans.PropertyValue")
757 self.node.Name = "nodepath"
758- self.node.Value = "/org.openerp.OpenERPOptions/OpenERPOptions"
759+ self.node.Value = ("/org.odoo.report_aeroo_ooo_plugin.OpenERPOptions/"
760+ "OpenERPOptions")
761 self.cfg_names = [
762 "Server",
763 "ServerPort",
764@@ -137,7 +138,7 @@
765 return False
766
767 def getImplementationName(self):
768- return "org.openerp.OptionsHandler"
769+ return "org.odoo.report_aeroo_ooo_plugin.OptionsHandler"
770
771 def getSupportedServiceNames(self):
772 return ()
773@@ -183,5 +184,5 @@
774 # uno implementation
775 g_ImplementationHelper = unohelper.ImplementationHelper()
776 g_ImplementationHelper.addImplementation(
777- OptionsHandler, "org.openerp.OptionsHandler",
778- ("org.openerp.OptionsHandler",),)
779+ OptionsHandler, "org.odoo.report_aeroo_ooo_plugin.OptionsHandler",
780+ ("org.odoo.report_aeroo_ooo_plugin.OptionsHandler",),)
781
782=== renamed directory '__unported__/report_aeroo_ooo_plugin/plugin/registry/data/org/openerp' => 'report_aeroo_ooo_plugin/plugin/registry/data/org/odoo'
783=== added directory 'report_aeroo_ooo_plugin/plugin/registry/data/org/odoo/report_aeroo_ooo_plugin'
784=== renamed directory '__unported__/report_aeroo_ooo_plugin/plugin/registry/data/org/openerp/Dialogs' => 'report_aeroo_ooo_plugin/plugin/registry/data/org/odoo/report_aeroo_ooo_plugin/Dialogs'
785=== renamed file '__unported__/report_aeroo_ooo_plugin/plugin/registry/data/org/openerp/OpenERPOptions.xcu' => 'report_aeroo_ooo_plugin/plugin/registry/data/org/odoo/report_aeroo_ooo_plugin/OpenERPOptions.xcu'
786--- __unported__/report_aeroo_ooo_plugin/plugin/registry/data/org/openerp/OpenERPOptions.xcu 2012-07-09 13:47:10 +0000
787+++ report_aeroo_ooo_plugin/plugin/registry/data/org/odoo/report_aeroo_ooo_plugin/OpenERPOptions.xcu 2014-07-24 15:15:04 +0000
788@@ -1,6 +1,6 @@
789 <?xml version="1.0" encoding="UTF-8"?>
790 <oor:component-data xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema"
791-oor:name="OpenERPOptions" oor:package="org.openerp">
792+oor:name="OpenERPOptions" oor:package="org.odoo.report_aeroo_ooo_plugin">
793 <node oor:name="ConfigNode">
794 <prop oor:name="Origin" oor:type="xs:string">
795 <value>%origin%</value>
796
797=== modified file 'report_aeroo_ooo_plugin/plugin/registry/data/org/openoffice/Office/Addons.xcu'
798--- __unported__/report_aeroo_ooo_plugin/plugin/registry/data/org/openoffice/Office/Addons.xcu 2012-07-09 13:47:10 +0000
799+++ report_aeroo_ooo_plugin/plugin/registry/data/org/openoffice/Office/Addons.xcu 2014-07-24 15:15:04 +0000
800@@ -4,10 +4,10 @@
801 oor:name="Addons" oor:package="org.openoffice.Office">
802 <node oor:name="AddonUI">
803 <node oor:name="OfficeMenuBar">
804- <node oor:name="org.openoffice.openerp.report.aeroo" oor:op="replace">
805+ <node oor:name="org.odoo.report_aeroo_ooo_plugin.menu" oor:op="replace">
806 <prop oor:name="Title" oor:type="xs:string">
807 <value/>
808- <value xml:lang="en-US">Aeroo (OpenERP)</value>
809+ <value xml:lang="en-US">Odoo</value>
810 </prop>
811 <prop oor:name="Target" oor:type="xs:string">
812 <value>_self</value>
813@@ -18,7 +18,7 @@
814 <node oor:name="Submenu">
815 <node oor:name="m11aeroo1" oor:op="replace">
816 <prop oor:name="URL" oor:type="xs:string">
817- <value>service:org.openoffice.openerp.report.aeroo.merge?execute</value>
818+ <value>service:org.odoo.report_aeroo_ooo_plugin.merge?execute</value>
819 </prop>
820 <prop oor:name="Title" oor:type="xs:string">
821 <value/>
822@@ -42,7 +42,7 @@
823 </node>
824 <node oor:name="m51" oor:op="replace">
825 <prop oor:name="URL" oor:type="xs:string">
826- <value>service:org.openoffice.openerp.report.aeroo.about?execute</value>
827+ <value>service:org.odoo.report_aeroo_ooo_plugin.about?execute</value>
828 </prop>
829 <prop oor:name="Title" oor:type="xs:string">
830 <value/>
831
832=== modified file 'report_aeroo_ooo_plugin/plugin/registry/data/org/openoffice/Office/OptionsDialog.xcu'
833--- __unported__/report_aeroo_ooo_plugin/plugin/registry/data/org/openoffice/Office/OptionsDialog.xcu 2012-07-09 13:47:10 +0000
834+++ report_aeroo_ooo_plugin/plugin/registry/data/org/openoffice/Office/OptionsDialog.xcu 2014-07-24 15:15:04 +0000
835@@ -3,19 +3,19 @@
836 <node oor:name="Nodes">
837 <node oor:name="Writer" oor:op="fuse">
838 <node oor:name="Leaves">
839- <node oor:name="org.openerp.OpenERP" oor:op="fuse">
840+ <node oor:name="org.odoo.report_aeroo_ooo_plugin.OpenERP" oor:op="fuse">
841 <prop oor:name="Id">
842- <value>org.openerp.OpenERP</value>
843+ <value>org.odoo.report_aeroo_ooo_plugin.OpenERP</value>
844 </prop>
845 <prop oor:name="Label">
846- <value xml:lang="en-US">OpenERP Options</value>
847- <value xml:lang="nl">OpenERP Instellingen</value>
848+ <value xml:lang="en-US">Odoo Options</value>
849+ <value xml:lang="nl">Odoo Instellingen</value>
850 </prop>
851 <prop oor:name="OptionsPage">
852 <value>%origin%/../../../../../dialogs/OpenERPOptions.xdl</value>
853 </prop>
854 <prop oor:name="EventHandlerService">
855- <value>org.openerp.OptionsHandler</value>
856+ <value>org.odoo.report_aeroo_ooo_plugin.OptionsHandler</value>
857 </prop>
858 </node>
859 </node>
860
861=== renamed directory '__unported__/report_aeroo_ooo_plugin/plugin/registry/schema/org/openerp' => 'report_aeroo_ooo_plugin/plugin/registry/schema/org/odoo'
862=== added directory 'report_aeroo_ooo_plugin/plugin/registry/schema/org/odoo/report_aeroo_ooo_plugin'
863=== renamed file '__unported__/report_aeroo_ooo_plugin/plugin/registry/schema/org/openerp/OpenERPOptions.xcs' => 'report_aeroo_ooo_plugin/plugin/registry/schema/org/odoo/report_aeroo_ooo_plugin/OpenERPOptions.xcs'
864--- __unported__/report_aeroo_ooo_plugin/plugin/registry/schema/org/openerp/OpenERPOptions.xcs 2012-07-09 13:47:10 +0000
865+++ report_aeroo_ooo_plugin/plugin/registry/schema/org/odoo/report_aeroo_ooo_plugin/OpenERPOptions.xcs 2014-07-24 15:15:04 +0000
866@@ -1,6 +1,6 @@
867 <?xml version="1.0" encoding="UTF-8"?>
868 <oor:component-schema xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
869- oor:name="OpenERPOptions" oor:package="org.openerp" xml:lang="en-US">
870+ oor:name="OpenERPOptions" oor:package="org.odoo.report_aeroo_ooo_plugin" xml:lang="en-US">
871 <info>
872 <author></author>
873 <desc>Contains the options data used for the options OpenERP extension.</desc>
874@@ -36,4 +36,4 @@
875 </prop>
876 </group>
877 </component>
878- </oor:component-schema>
879\ No newline at end of file
880+ </oor:component-schema>
881
882=== added directory 'report_aeroo_ooo_plugin/plugin/template'
883=== added directory 'report_aeroo_ooo_plugin/plugin/template/Odoo'
884=== added file 'report_aeroo_ooo_plugin/plugin/template/Odoo/Partner mailmerge.ott'
885Binary files report_aeroo_ooo_plugin/plugin/template/Odoo/Partner mailmerge.ott 1970-01-01 00:00:00 +0000 and report_aeroo_ooo_plugin/plugin/template/Odoo/Partner mailmerge.ott 2014-07-24 15:15:04 +0000 differ
886=== added directory 'report_aeroo_ooo_plugin/static'
887=== added directory 'report_aeroo_ooo_plugin/static/src'
888=== added directory 'report_aeroo_ooo_plugin/static/src/img'
889=== added file 'report_aeroo_ooo_plugin/static/src/img/icon.png'
890Binary files report_aeroo_ooo_plugin/static/src/img/icon.png 1970-01-01 00:00:00 +0000 and report_aeroo_ooo_plugin/static/src/img/icon.png 2014-07-24 15:15:04 +0000 differ
891=== modified file 'report_aeroo_ooo_plugin/view/get_plugin.xml'
892--- __unported__/report_aeroo_ooo_plugin/view/get_plugin.xml 2012-07-09 13:47:10 +0000
893+++ report_aeroo_ooo_plugin/view/get_plugin.xml 2014-07-24 15:15:04 +0000
894@@ -2,23 +2,25 @@
895 <openerp>
896 <data>
897 <record id="view_get_plugin" model="ir.ui.view">
898- <field name="name">Plugin download form view</field>
899 <field name="model">report.aeroo.get_plugin</field>
900- <field name="type">form</field>
901 <field name="arch" type="xml">
902- <form>
903- <field name="name" invisible="1"/>
904- <field name="plugin_file" filename="name"/>
905+ <form string="Plugin download form view" version="7.0">
906+ <group>
907+ <field name="name" invisible="1"/>
908+ <field name="plugin_file" filename="name"/>
909+ </group>
910 </form>
911 </field>
912 </record>
913
914 <record id="wizard_get_plugin" model="ir.actions.act_window">
915 <field name="name">Download Office Extension</field>
916- <field name="type">ir.actions.act_window</field>
917+ <field name="type">ir.actions.act_window</field>
918 <field name="res_model">report.aeroo.get_plugin</field>
919 <field name="view_type">form</field>
920 <field name="view_mode">form</field>
921+ <field name="target">new</field>
922+ <field name="context">{'bin_size': True}</field>
923 </record>
924
925 <menuitem name="Download Office Extension"

Subscribers

People subscribed via source and target branches

to all changes: