Merge lp:~therp-nl/therp-addons/7.0-report_aeroo_ooo_plugin_save_addressee into lp:~therp-nl/therp-addons/7.0
- 7.0-report_aeroo_ooo_plugin_save_addressee
- Merge into 7.0
Proposed by
Holger Brunn (Therp)
Status: | Merged |
---|---|
Approved by: | Stefan Rijnhart (Opener) |
Approved revision: | 122 |
Merged at revision: | 110 |
Proposed branch: | lp:~therp-nl/therp-addons/7.0-report_aeroo_ooo_plugin_save_addressee |
Merge into: | lp:~therp-nl/therp-addons/7.0 |
Prerequisite: | lp:~therp-nl/therp-addons/7.0-report_aeroo_ooo_plugin |
Diff against target: |
397 lines (+318/-3) 11 files modified
report_aeroo_ooo_plugin/model/instant_aeroo.py (+3/-3) report_aeroo_ooo_plugin_save_addressee/__init__.py (+21/-0) report_aeroo_ooo_plugin_save_addressee/__openerp__.py (+55/-0) report_aeroo_ooo_plugin_save_addressee/model/__init__.py (+23/-0) report_aeroo_ooo_plugin_save_addressee/model/aeroo_mailmerge.py (+58/-0) report_aeroo_ooo_plugin_save_addressee/model/instant_aeroo.py (+47/-0) report_aeroo_ooo_plugin_save_addressee/model/res_partner.py (+36/-0) report_aeroo_ooo_plugin_save_addressee/security/ir.model.access.csv (+2/-0) report_aeroo_ooo_plugin_save_addressee/view/aeroo_mailmerge.xml (+44/-0) report_aeroo_ooo_plugin_save_addressee/view/menu.xml (+15/-0) report_aeroo_ooo_plugin_save_addressee/view/res_partner.xml (+14/-0) |
To merge this branch: | bzr merge lp:~therp-nl/therp-addons/7.0-report_aeroo_ooo_plugin_save_addressee |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Stefan Rijnhart (Opener) (community) | Approve | ||
Review via email:
|
This proposal supersedes a proposal from 2014-07-28.
Commit message
Description of the change
To post a comment you must log in.
Revision history for this message
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Stefan Rijnhart (Opener) (stefan-opener) wrote : | # |
review:
Approve
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'report_aeroo_ooo_plugin/model/instant_aeroo.py' |
2 | --- report_aeroo_ooo_plugin/model/instant_aeroo.py 2014-07-28 15:37:05 +0000 |
3 | +++ report_aeroo_ooo_plugin/model/instant_aeroo.py 2014-07-28 15:37:05 +0000 |
4 | @@ -36,7 +36,7 @@ |
5 | import base64 |
6 | from openerp.osv import osv |
7 | from openerp.tools.translate import _ |
8 | -from openerp.tools.safe_eval import const_eval |
9 | +from openerp.tools.safe_eval import safe_eval |
10 | from openerp.report.report_sxw import rml_parse |
11 | from openerp.addons.report_aeroo.report_aeroo import Aeroo_report |
12 | from openerp.addons.report_aeroo.report_aeroo import AerooPrint |
13 | @@ -91,8 +91,8 @@ |
14 | context=context) |
15 | ids = self.pool[saved_filter.model_id].search( |
16 | cr, uid, |
17 | - const_eval(saved_filter.domain), |
18 | - context=const_eval(saved_filter.context)) |
19 | + safe_eval(saved_filter.domain), |
20 | + context=safe_eval(saved_filter.context)) |
21 | |
22 | if not ids: |
23 | return (False, _("User's selection does not contain any items.")) |
24 | |
25 | === added directory 'report_aeroo_ooo_plugin_save_addressee' |
26 | === added file 'report_aeroo_ooo_plugin_save_addressee/__init__.py' |
27 | --- report_aeroo_ooo_plugin_save_addressee/__init__.py 1970-01-01 00:00:00 +0000 |
28 | +++ report_aeroo_ooo_plugin_save_addressee/__init__.py 2014-07-28 15:37:05 +0000 |
29 | @@ -0,0 +1,21 @@ |
30 | +# -*- coding: utf-8 -*- |
31 | +############################################################################## |
32 | +# |
33 | +# OpenERP, Open Source Management Solution |
34 | +# This module copyright (C) 2014 Therp BV (<http://therp.nl>). |
35 | +# |
36 | +# This program is free software: you can redistribute it and/or modify |
37 | +# it under the terms of the GNU Affero General Public License as |
38 | +# published by the Free Software Foundation, either version 3 of the |
39 | +# License, or (at your option) any later version. |
40 | +# |
41 | +# This program is distributed in the hope that it will be useful, |
42 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
43 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
44 | +# GNU Affero General Public License for more details. |
45 | +# |
46 | +# You should have received a copy of the GNU Affero General Public License |
47 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
48 | +# |
49 | +############################################################################## |
50 | +from . import model |
51 | |
52 | === added file 'report_aeroo_ooo_plugin_save_addressee/__openerp__.py' |
53 | --- report_aeroo_ooo_plugin_save_addressee/__openerp__.py 1970-01-01 00:00:00 +0000 |
54 | +++ report_aeroo_ooo_plugin_save_addressee/__openerp__.py 2014-07-28 15:37:05 +0000 |
55 | @@ -0,0 +1,55 @@ |
56 | +# -*- coding: utf-8 -*- |
57 | +############################################################################## |
58 | +# |
59 | +# OpenERP, Open Source Management Solution |
60 | +# This module copyright (C) 2014 Therp BV (<http://therp.nl>). |
61 | +# |
62 | +# This program is free software: you can redistribute it and/or modify |
63 | +# it under the terms of the GNU Affero General Public License as |
64 | +# published by the Free Software Foundation, either version 3 of the |
65 | +# License, or (at your option) any later version. |
66 | +# |
67 | +# This program is distributed in the hope that it will be useful, |
68 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
69 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
70 | +# GNU Affero General Public License for more details. |
71 | +# |
72 | +# You should have received a copy of the GNU Affero General Public License |
73 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
74 | +# |
75 | +############################################################################## |
76 | +{ |
77 | + "name": "Save mail merges' addressees", |
78 | + "version": "1.0", |
79 | + "author": "Therp BV", |
80 | + "license": "AGPL-3", |
81 | + "complexity": "normal", |
82 | + "description": """ |
83 | +This addons saves the partners used in a mail merge. A byproduct of this is |
84 | +that mail merges (against res.partner) end up in your database. |
85 | + """, |
86 | + "category": "Generic Modules/Aeroo Reporting", |
87 | + "depends": [ |
88 | + 'report_aeroo_ooo_plugin', |
89 | + ], |
90 | + "data": [ |
91 | + "view/res_partner.xml", |
92 | + "view/aeroo_mailmerge.xml", |
93 | + "view/menu.xml", |
94 | + 'security/ir.model.access.csv', |
95 | + ], |
96 | + "js": [ |
97 | + ], |
98 | + "css": [ |
99 | + ], |
100 | + "qweb": [ |
101 | + ], |
102 | + "test": [ |
103 | + ], |
104 | + "auto_install": False, |
105 | + "installable": True, |
106 | + "application": False, |
107 | + "external_dependencies": { |
108 | + 'python': [], |
109 | + }, |
110 | +} |
111 | |
112 | === added directory 'report_aeroo_ooo_plugin_save_addressee/model' |
113 | === added file 'report_aeroo_ooo_plugin_save_addressee/model/__init__.py' |
114 | --- report_aeroo_ooo_plugin_save_addressee/model/__init__.py 1970-01-01 00:00:00 +0000 |
115 | +++ report_aeroo_ooo_plugin_save_addressee/model/__init__.py 2014-07-28 15:37:05 +0000 |
116 | @@ -0,0 +1,23 @@ |
117 | +# -*- coding: utf-8 -*- |
118 | +############################################################################## |
119 | +# |
120 | +# OpenERP, Open Source Management Solution |
121 | +# This module copyright (C) 2014 Therp BV (<http://therp.nl>). |
122 | +# |
123 | +# This program is free software: you can redistribute it and/or modify |
124 | +# it under the terms of the GNU Affero General Public License as |
125 | +# published by the Free Software Foundation, either version 3 of the |
126 | +# License, or (at your option) any later version. |
127 | +# |
128 | +# This program is distributed in the hope that it will be useful, |
129 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
130 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
131 | +# GNU Affero General Public License for more details. |
132 | +# |
133 | +# You should have received a copy of the GNU Affero General Public License |
134 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
135 | +# |
136 | +############################################################################## |
137 | +from . import instant_aeroo |
138 | +from . import aeroo_mailmerge |
139 | +from . import res_partner |
140 | |
141 | === added file 'report_aeroo_ooo_plugin_save_addressee/model/aeroo_mailmerge.py' |
142 | --- report_aeroo_ooo_plugin_save_addressee/model/aeroo_mailmerge.py 1970-01-01 00:00:00 +0000 |
143 | +++ report_aeroo_ooo_plugin_save_addressee/model/aeroo_mailmerge.py 2014-07-28 15:37:05 +0000 |
144 | @@ -0,0 +1,58 @@ |
145 | +# -*- coding: utf-8 -*- |
146 | +############################################################################## |
147 | +# |
148 | +# OpenERP, Open Source Management Solution |
149 | +# This module copyright (C) 2014 Therp BV (<http://therp.nl>). |
150 | +# |
151 | +# This program is free software: you can redistribute it and/or modify |
152 | +# it under the terms of the GNU Affero General Public License as |
153 | +# published by the Free Software Foundation, either version 3 of the |
154 | +# License, or (at your option) any later version. |
155 | +# |
156 | +# This program is distributed in the hope that it will be useful, |
157 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
158 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
159 | +# GNU Affero General Public License for more details. |
160 | +# |
161 | +# You should have received a copy of the GNU Affero General Public License |
162 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
163 | +# |
164 | +############################################################################## |
165 | +import datetime |
166 | +from openerp.osv.orm import Model |
167 | +from openerp.osv import fields |
168 | +from openerp.tools.misc import DEFAULT_SERVER_DATETIME_FORMAT |
169 | + |
170 | + |
171 | +class AerooMailmerge(Model): |
172 | + _name = 'aeroo.mailmerge' |
173 | + _description = 'Mailmerge' |
174 | + _order = 'create_date desc, filter_id' |
175 | + |
176 | + _columns = { |
177 | + 'filter_id': fields.many2one('ir.filters', 'Filter', required=True), |
178 | + 'create_date': fields.datetime('Created', required=True), |
179 | + 'create_uid': fields.many2one('res.users', 'User', required=True), |
180 | + 'template': fields.binary('Template', required=True), |
181 | + 'partner_ids': fields.many2many( |
182 | + 'res.partner', 'aeroo_mailmerge_partner_rel', 'mailmerge_id', |
183 | + 'partner_id', string='Partners'), |
184 | + } |
185 | + |
186 | + def name_get(self, cr, uid, ids, context=None): |
187 | + user = self.pool['res.users'].browse(cr, uid, uid, context=context) |
188 | + res_lang = self.pool['res.lang'] |
189 | + lang = res_lang.browse( |
190 | + cr, uid, |
191 | + res_lang.search( |
192 | + cr, uid, [('code', '=', user.partner_id.lang)], |
193 | + context=context)[0], |
194 | + context=context) |
195 | + return dict([ |
196 | + (this.id, '%s [%s]' % ( |
197 | + this.filter_id.name, |
198 | + datetime.datetime.strptime( |
199 | + this.create_date, DEFAULT_SERVER_DATETIME_FORMAT).strftime( |
200 | + lang.date_format))) |
201 | + for this in self.browse(cr, uid, ids, context=context) |
202 | + ]) |
203 | |
204 | === added file 'report_aeroo_ooo_plugin_save_addressee/model/instant_aeroo.py' |
205 | --- report_aeroo_ooo_plugin_save_addressee/model/instant_aeroo.py 1970-01-01 00:00:00 +0000 |
206 | +++ report_aeroo_ooo_plugin_save_addressee/model/instant_aeroo.py 2014-07-28 15:37:05 +0000 |
207 | @@ -0,0 +1,47 @@ |
208 | +# -*- coding: utf-8 -*- |
209 | +############################################################################## |
210 | +# |
211 | +# OpenERP, Open Source Management Solution |
212 | +# This module copyright (C) 2014 Therp BV (<http://therp.nl>). |
213 | +# |
214 | +# This program is free software: you can redistribute it and/or modify |
215 | +# it under the terms of the GNU Affero General Public License as |
216 | +# published by the Free Software Foundation, either version 3 of the |
217 | +# License, or (at your option) any later version. |
218 | +# |
219 | +# This program is distributed in the hope that it will be useful, |
220 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
221 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
222 | +# GNU Affero General Public License for more details. |
223 | +# |
224 | +# You should have received a copy of the GNU Affero General Public License |
225 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
226 | +# |
227 | +############################################################################## |
228 | +from openerp.osv.orm import TransientModel |
229 | +from openerp.tools.safe_eval import safe_eval |
230 | + |
231 | + |
232 | +class InstantAeroo(TransientModel): |
233 | + _inherit = 'instant.aeroo' |
234 | + |
235 | + def create_report(self, cr, uid, file_data, filter_id, context=None): |
236 | + saved_filter = self.pool['ir.filters'].browse( |
237 | + cr, uid, filter_id, context=context) |
238 | + partner_ids = [] |
239 | + if saved_filter.model_id == 'res.partner': |
240 | + partner_ids = self.pool[saved_filter.model_id].search( |
241 | + cr, uid, |
242 | + safe_eval(saved_filter.domain), |
243 | + context=safe_eval(saved_filter.context)) |
244 | + |
245 | + self.pool['aeroo.mailmerge'].create( |
246 | + cr, uid, |
247 | + { |
248 | + 'filter_id': filter_id, |
249 | + 'template': file_data, |
250 | + 'partner_ids': [(6, 0, partner_ids)], |
251 | + }, |
252 | + context=context) |
253 | + return super(InstantAeroo, self).create_report( |
254 | + cr, uid, file_data, filter_id, context=context) |
255 | |
256 | === added file 'report_aeroo_ooo_plugin_save_addressee/model/res_partner.py' |
257 | --- report_aeroo_ooo_plugin_save_addressee/model/res_partner.py 1970-01-01 00:00:00 +0000 |
258 | +++ report_aeroo_ooo_plugin_save_addressee/model/res_partner.py 2014-07-28 15:37:05 +0000 |
259 | @@ -0,0 +1,36 @@ |
260 | +# -*- coding: utf-8 -*- |
261 | +############################################################################## |
262 | +# |
263 | +# OpenERP, Open Source Management Solution |
264 | +# This module copyright (C) 2014 Therp BV (<http://therp.nl>). |
265 | +# |
266 | +# This program is free software: you can redistribute it and/or modify |
267 | +# it under the terms of the GNU Affero General Public License as |
268 | +# published by the Free Software Foundation, either version 3 of the |
269 | +# License, or (at your option) any later version. |
270 | +# |
271 | +# This program is distributed in the hope that it will be useful, |
272 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
273 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
274 | +# GNU Affero General Public License for more details. |
275 | +# |
276 | +# You should have received a copy of the GNU Affero General Public License |
277 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
278 | +# |
279 | +############################################################################## |
280 | +from openerp.osv.orm import Model |
281 | +from openerp.tools.translate import _ |
282 | + |
283 | + |
284 | +class ResPartner(Model): |
285 | + _inherit = 'res.partner' |
286 | + |
287 | + def button_show_mailmerges(self, cr, uid, ids, context=None): |
288 | + return { |
289 | + 'type': 'ir.actions.act_window', |
290 | + 'name': _('Mail merges'), |
291 | + 'view_type': 'form', |
292 | + 'views': [(False, 'tree'), (False, 'form')], |
293 | + 'res_model': 'aeroo.mailmerge', |
294 | + 'domain': [('partner_ids', 'in', ids)], |
295 | + } |
296 | |
297 | === added directory 'report_aeroo_ooo_plugin_save_addressee/security' |
298 | === added file 'report_aeroo_ooo_plugin_save_addressee/security/ir.model.access.csv' |
299 | --- report_aeroo_ooo_plugin_save_addressee/security/ir.model.access.csv 1970-01-01 00:00:00 +0000 |
300 | +++ report_aeroo_ooo_plugin_save_addressee/security/ir.model.access.csv 2014-07-28 15:37:05 +0000 |
301 | @@ -0,0 +1,2 @@ |
302 | +"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink" |
303 | +"cr_aeroo_mailmerge","Create and read aeroo mail merges","model_aeroo_mailmerge","base.group_user",1,0,1,0 |
304 | |
305 | === added directory 'report_aeroo_ooo_plugin_save_addressee/static' |
306 | === added directory 'report_aeroo_ooo_plugin_save_addressee/static/src' |
307 | === added directory 'report_aeroo_ooo_plugin_save_addressee/static/src/img' |
308 | === added file 'report_aeroo_ooo_plugin_save_addressee/static/src/img/icon.png' |
309 | Binary files report_aeroo_ooo_plugin_save_addressee/static/src/img/icon.png 1970-01-01 00:00:00 +0000 and report_aeroo_ooo_plugin_save_addressee/static/src/img/icon.png 2014-07-28 15:37:05 +0000 differ |
310 | === added directory 'report_aeroo_ooo_plugin_save_addressee/view' |
311 | === added file 'report_aeroo_ooo_plugin_save_addressee/view/aeroo_mailmerge.xml' |
312 | --- report_aeroo_ooo_plugin_save_addressee/view/aeroo_mailmerge.xml 1970-01-01 00:00:00 +0000 |
313 | +++ report_aeroo_ooo_plugin_save_addressee/view/aeroo_mailmerge.xml 2014-07-28 15:37:05 +0000 |
314 | @@ -0,0 +1,44 @@ |
315 | +<?xml version="1.0" encoding="UTF-8"?> |
316 | +<openerp> |
317 | + <data> |
318 | + <record id="form_aeroo_mailmerge" model="ir.ui.view"> |
319 | + <field name="model">aeroo.mailmerge</field> |
320 | + <field name="arch" type="xml"> |
321 | + <form string="Mail merges" version="7.0" create="0"> |
322 | + <sheet> |
323 | + <group> |
324 | + <field name="create_date" /> |
325 | + <field name="create_uid" /> |
326 | + <field name="filter_id" /> |
327 | + <field name="template" /> |
328 | + </group> |
329 | + <group attrs="{'invisible': [('partner_ids', '=', [(6, False, [])])]}"> |
330 | + <field name="partner_ids" nolabel="1" /> |
331 | + </group> |
332 | + </sheet> |
333 | + </form> |
334 | + </field> |
335 | + </record> |
336 | + <record id="search_aeroo_mailmerge" model="ir.ui.view"> |
337 | + <field name="model">aeroo.mailmerge</field> |
338 | + <field name="arch" type="xml"> |
339 | + <search> |
340 | + <filter name="own" string="My mail merges" domain="[('create_uid', '=', uid)]" /> |
341 | + <field name="create_uid" /> |
342 | + <field name="filter_id" /> |
343 | + <field name="create_date" /> |
344 | + </search> |
345 | + </field> |
346 | + </record> |
347 | + <record id="tree_aeroo_mailmerge" model="ir.ui.view"> |
348 | + <field name="model">aeroo.mailmerge</field> |
349 | + <field name="arch" type="xml"> |
350 | + <tree string="Mail merges" create="0" delete="0"> |
351 | + <field name="create_date" /> |
352 | + <field name="create_uid" /> |
353 | + <field name="filter_id" /> |
354 | + </tree> |
355 | + </field> |
356 | + </record> |
357 | + </data> |
358 | +</openerp> |
359 | |
360 | === added file 'report_aeroo_ooo_plugin_save_addressee/view/menu.xml' |
361 | --- report_aeroo_ooo_plugin_save_addressee/view/menu.xml 1970-01-01 00:00:00 +0000 |
362 | +++ report_aeroo_ooo_plugin_save_addressee/view/menu.xml 2014-07-28 15:37:05 +0000 |
363 | @@ -0,0 +1,15 @@ |
364 | +<?xml version="1.0" encoding="UTF-8"?> |
365 | +<openerp> |
366 | + <data> |
367 | + <menuitem id="menu_aeroo_mailmerge" |
368 | + parent="base.menu_base_partner" |
369 | + name="Mail merges" /> |
370 | + <act_window id="action_aeroo_mailmerge" |
371 | + name="All mail merges" |
372 | + context="{'search_default_own': 1}" |
373 | + res_model="aeroo.mailmerge" /> |
374 | + <menuitem id="menu_aeroo_mailmerge_tree" |
375 | + parent="menu_aeroo_mailmerge" |
376 | + action="action_aeroo_mailmerge" /> |
377 | + </data> |
378 | +</openerp> |
379 | |
380 | === added file 'report_aeroo_ooo_plugin_save_addressee/view/res_partner.xml' |
381 | --- report_aeroo_ooo_plugin_save_addressee/view/res_partner.xml 1970-01-01 00:00:00 +0000 |
382 | +++ report_aeroo_ooo_plugin_save_addressee/view/res_partner.xml 2014-07-28 15:37:05 +0000 |
383 | @@ -0,0 +1,14 @@ |
384 | +<?xml version="1.0" encoding="UTF-8"?> |
385 | +<openerp> |
386 | + <data> |
387 | + <record id="view_partner_form" model="ir.ui.view"> |
388 | + <field name="model">res.partner</field> |
389 | + <field name="inherit_id" ref="base.view_partner_form" /> |
390 | + <field name="arch" type="xml"> |
391 | + <div name="buttons" position="inside"> |
392 | + <button type="object" name="button_show_mailmerges" string="Mail merges" /> |
393 | + </div> |
394 | + </field> |
395 | + </record> |
396 | + </data> |
397 | +</openerp> |
Tnx!