Merge lp:~ajite/server-env-tools/7.0-server-env-tools-0001 into lp:~server-env-tools-core-editors/server-env-tools/7.0
- 7.0-server-env-tools-0001
- Merge into 7.0
Proposed by
Augustin Cisterne-Kaas - www.elico-corp.com
Status: | Needs review |
---|---|
Proposed branch: | lp:~ajite/server-env-tools/7.0-server-env-tools-0001 |
Merge into: | lp:~server-env-tools-core-editors/server-env-tools/7.0 |
Diff against target: |
531 lines (+454/-0) 12 files modified
mail_organizer/__init__.py (+24/-0) mail_organizer/__openerp__.py (+54/-0) mail_organizer/message.py (+29/-0) mail_organizer/model.py (+29/-0) mail_organizer/model_view.xml (+41/-0) mail_organizer/static/description/index.html (+20/-0) mail_organizer/static/src/css/mail.css (+24/-0) mail_organizer/static/src/js/mail.js (+53/-0) mail_organizer/static/src/xml/mail.xml (+8/-0) mail_organizer/wizard/__init__.py (+22/-0) mail_organizer/wizard/wizard_mail_organizer.py (+111/-0) mail_organizer/wizard/wizard_mail_organizer_view.xml (+39/-0) |
To merge this branch: | bzr merge lp:~ajite/server-env-tools/7.0-server-env-tools-0001 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Server Environment And Tools Core Editors | Pending | ||
Review via email: mp+209653@code.launchpad.net |
Commit message
Description of the change
Added a module to easily organize your email inside OpenERP
To post a comment you must log in.
Revision history for this message
Daniel Reis (dreis-pt) wrote : | # |
Where is the "web_polymorphic" MP?
Revision history for this message
Augustin Cisterne-Kaas - www.elico-corp.com (ajite) wrote : | # |
Hi all,
Thank you for your feedbacks.
Should I push the web polymorphic to this branch ?
Revision history for this message
Yannick Vaucher @ Camptocamp (yvaucher-c2c) wrote : | # |
It should certainly go in https:/
Revision history for this message
Augustin Cisterne-Kaas - www.elico-corp.com (ajite) wrote : | # |
Thanks for the advice.
I made the merge proposal. Now waiting for approval.
- 62. By Augustin Cisterne-Kaas - www.elico-corp.com
-
[FIX] changed web_polymorphic module dependence to web_many2one_
polymorphic
Revision history for this message
Sylvain LE GAL (GRAP) (sylvain-legal) wrote : | # |
For information :
The link for the MP of the dependencies :
https:/
- 63. By Augustin Cisterne-Kaas - www.elico-corp.com
-
[FIX] Name of the dependency web polymorphic
Unmerged revisions
- 63. By Augustin Cisterne-Kaas - www.elico-corp.com
-
[FIX] Name of the dependency web polymorphic
- 62. By Augustin Cisterne-Kaas - www.elico-corp.com
-
[FIX] changed web_polymorphic module dependence to web_many2one_
polymorphic - 61. By Augustin Cisterne-Kaas - www.elico-corp.com
-
[ADD] Mail Organizer
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === added directory 'mail_organizer' |
2 | === added file 'mail_organizer/__init__.py' |
3 | --- mail_organizer/__init__.py 1970-01-01 00:00:00 +0000 |
4 | +++ mail_organizer/__init__.py 2014-04-11 03:08:25 +0000 |
5 | @@ -0,0 +1,24 @@ |
6 | +# -*- coding: utf-8 -*- |
7 | +############################################################################## |
8 | +# |
9 | +# OpenERP, Open Source Management Solution |
10 | +# Copyright (c) 2010-2014 Elico Corp. All Rights Reserved. |
11 | +# Augustin Cisterne-Kaas <augustin.cisterne-kaas@elico-corp.com> |
12 | +# |
13 | +# This program is free software: you can redistribute it and/or modify |
14 | +# it under the terms of the GNU Affero General Public License as |
15 | +# published by the Free Software Foundation, either version 3 of the |
16 | +# License, or (at your option) any later version. |
17 | +# |
18 | +# This program is distributed in the hope that it will be useful, |
19 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
20 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
21 | +# GNU Affero General Public License for more details. |
22 | +# |
23 | +# You should have received a copy of the GNU Affero General Public License |
24 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
25 | +# |
26 | +############################################################################## |
27 | +import model |
28 | +import message |
29 | +import wizard |
30 | |
31 | === added file 'mail_organizer/__openerp__.py' |
32 | --- mail_organizer/__openerp__.py 1970-01-01 00:00:00 +0000 |
33 | +++ mail_organizer/__openerp__.py 2014-04-11 03:08:25 +0000 |
34 | @@ -0,0 +1,54 @@ |
35 | +# -*- coding: utf-8 -*- |
36 | +############################################################################## |
37 | +# |
38 | +# OpenERP, Open Source Management Solution |
39 | +# Copyright (c) 2010-2014 Elico Corp. All Rights Reserved. |
40 | +# Augustin Cisterne-Kaas <augustin.cisterne-kaas@elico-corp.com> |
41 | +# |
42 | +# This program is free software: you can redistribute it and/or modify |
43 | +# it under the terms of the GNU Affero General Public License as |
44 | +# published by the Free Software Foundation, either version 3 of the |
45 | +# License, or (at your option) any later version. |
46 | +# |
47 | +# This program is distributed in the hope that it will be useful, |
48 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
49 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
50 | +# GNU Affero General Public License for more details. |
51 | +# |
52 | +# You should have received a copy of the GNU Affero General Public License |
53 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
54 | +# |
55 | +############################################################################## |
56 | +{'name': 'Mail Organizer', |
57 | + 'version': '0.1', |
58 | + 'category': 'Social Network', |
59 | + 'depends': ['web_polymorphic_many2one', 'mail'], |
60 | + 'author': 'Elico Corp', |
61 | + 'license': 'AGPL-3', |
62 | + 'website': 'https://www.elico-corp.com', |
63 | + 'description': """ |
64 | +This module allows you to assign a message to an existing or |
65 | +a new resource dynamically. |
66 | + |
67 | +You can configure the available model through |
68 | +"Settings" -> "Technical" -> "Email Organizer" |
69 | + |
70 | +Screencasts available at: |
71 | + https://www.youtube.com/watch?v=XYgswq6_J1I |
72 | + http://v.youku.com/v_show/id_XNjc3Njc0Nzky.html |
73 | +""", |
74 | + 'images': [], |
75 | + 'demo': [], |
76 | + 'data': ['wizard/wizard_mail_organizer_view.xml', |
77 | + 'model_view.xml'], |
78 | + 'qweb': [ |
79 | + 'static/src/xml/mail.xml' |
80 | + ], |
81 | + 'js': [ |
82 | + 'static/src/js/mail.js' |
83 | + ], |
84 | + 'css': [ |
85 | + 'static/src/css/mail.css' |
86 | + ], |
87 | + 'installable': True, |
88 | + 'application': False} |
89 | |
90 | === added file 'mail_organizer/message.py' |
91 | --- mail_organizer/message.py 1970-01-01 00:00:00 +0000 |
92 | +++ mail_organizer/message.py 2014-04-11 03:08:25 +0000 |
93 | @@ -0,0 +1,29 @@ |
94 | +# -*- coding: utf-8 -*- |
95 | +############################################################################## |
96 | +# |
97 | +# OpenERP, Open Source Management Solution |
98 | +# Copyright (c) 2010-2014 Elico Corp. All Rights Reserved. |
99 | +# Augustin Cisterne-Kaas <augustin.cisterne-kaas@elico-corp.com> |
100 | +# |
101 | +# This program is free software: you can redistribute it and/or modify |
102 | +# it under the terms of the GNU Affero General Public License as |
103 | +# published by the Free Software Foundation, either version 3 of the |
104 | +# License, or (at your option) any later version. |
105 | +# |
106 | +# This program is distributed in the hope that it will be useful, |
107 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
108 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
109 | +# GNU Affero General Public License for more details. |
110 | +# |
111 | +# You should have received a copy of the GNU Affero General Public License |
112 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
113 | +# |
114 | +############################################################################## |
115 | +from openerp.osv import fields, orm |
116 | + |
117 | + |
118 | +class mail_message(orm.Model): |
119 | + _inherit = 'mail.message' |
120 | + _columns = { |
121 | + 'name': fields.char('Name') |
122 | + } |
123 | |
124 | === added file 'mail_organizer/model.py' |
125 | --- mail_organizer/model.py 1970-01-01 00:00:00 +0000 |
126 | +++ mail_organizer/model.py 2014-04-11 03:08:25 +0000 |
127 | @@ -0,0 +1,29 @@ |
128 | +# -*- coding: utf-8 -*- |
129 | +############################################################################## |
130 | +# |
131 | +# OpenERP, Open Source Management Solution |
132 | +# Copyright (c) 2010-2014 Elico Corp. All Rights Reserved. |
133 | +# Augustin Cisterne-Kaas <augustin.cisterne-kaas@elico-corp.com> |
134 | +# |
135 | +# This program is free software: you can redistribute it and/or modify |
136 | +# it under the terms of the GNU Affero General Public License as |
137 | +# published by the Free Software Foundation, either version 3 of the |
138 | +# License, or (at your option) any later version. |
139 | +# |
140 | +# This program is distributed in the hope that it will be useful, |
141 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
142 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
143 | +# GNU Affero General Public License for more details. |
144 | +# |
145 | +# You should have received a copy of the GNU Affero General Public License |
146 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
147 | +# |
148 | +############################################################################## |
149 | +from openerp.osv import fields, orm |
150 | + |
151 | + |
152 | +class ir_model(orm.Model): |
153 | + _inherit = 'ir.model' |
154 | + _columns = { |
155 | + 'mail_organizer': fields.boolean('Use in Mail Organizer') |
156 | + } |
157 | |
158 | === added file 'mail_organizer/model_view.xml' |
159 | --- mail_organizer/model_view.xml 1970-01-01 00:00:00 +0000 |
160 | +++ mail_organizer/model_view.xml 2014-04-11 03:08:25 +0000 |
161 | @@ -0,0 +1,41 @@ |
162 | +<?xml version="1.0" encoding="UTF-8"?> |
163 | +<openerp> |
164 | + <data> |
165 | + <record id="view_model_form" model="ir.ui.view"> |
166 | + <field name="name">ir.model.form</field> |
167 | + <field name="model">ir.model</field> |
168 | + <field name="inherit_id" ref="base.view_model_form" /> |
169 | + <field name="arch" type="xml" > |
170 | + <field name="modules" position="after"> |
171 | + <field name="mail_organizer" /> |
172 | + </field> |
173 | + </field> |
174 | + </record> |
175 | + |
176 | + <record id="view_model_tree_editable" model="ir.ui.view"> |
177 | + <field name="name">Ir Model editable tree</field> |
178 | + <field name="model">ir.model</field> |
179 | + <field name="arch" type="xml" > |
180 | + <tree string="Mail Organizer" editable="bottom"> |
181 | + <field name="name" readonly="1" /> |
182 | + <field name="model" readonly="1" /> |
183 | + <field name="mail_organizer" /> |
184 | + </tree> |
185 | + </field> |
186 | + </record> |
187 | + |
188 | + |
189 | + <record model="ir.actions.act_window" id="action_mail_organizer"> |
190 | + <field name="name">Mail organizer</field> |
191 | + <field name="view_id" ref="view_model_tree_editable"/> |
192 | + <field name="res_model">ir.model</field> |
193 | + <field name="view_type">form</field> |
194 | + <field name="usage">menu</field> |
195 | + </record> |
196 | + |
197 | + <menuitem id="menu_email_organizer" |
198 | + name="Mail Organizer" |
199 | + action="action_mail_organizer" |
200 | + parent="base.menu_email" /> |
201 | + </data> |
202 | +</openerp> |
203 | \ No newline at end of file |
204 | |
205 | === added directory 'mail_organizer/static' |
206 | === added directory 'mail_organizer/static/description' |
207 | === added file 'mail_organizer/static/description/example.png' |
208 | Binary files mail_organizer/static/description/example.png 1970-01-01 00:00:00 +0000 and mail_organizer/static/description/example.png 2014-04-11 03:08:25 +0000 differ |
209 | === added file 'mail_organizer/static/description/index.html' |
210 | --- mail_organizer/static/description/index.html 1970-01-01 00:00:00 +0000 |
211 | +++ mail_organizer/static/description/index.html 2014-04-11 03:08:25 +0000 |
212 | @@ -0,0 +1,20 @@ |
213 | +<section class="oe_container"> |
214 | + <div class="oe_row"> |
215 | + <h2 class="oe_slogan">Mail Organizer</h2> |
216 | + <h4 class="oe_slogan"><a href="http://www.elico-corp.com">By Elico Corp</a></h4> |
217 | + <p> |
218 | + This module allows you to assign a message to an existing or a new resource dynamically. |
219 | + </p> |
220 | + <p> |
221 | + You can configure the available model through "Settings" -> "Technical" -> "Email Organizer" |
222 | + </p> |
223 | + <p>Screencast available at:</p> |
224 | + <ul> |
225 | + <li><a href="https://www.youtube.com/watch?v=XYgswq6_J1I">YouTube</a></li> |
226 | + <li><a href="http://v.youku.com/v_show/id_XNjc3Njc0Nzky.html">Youku</a></li> |
227 | + </ul> |
228 | + <div class="oe_row_img oe_centered oe_mt32"> |
229 | + <img class="oe_picture oe_screenshot" src="example.png" /> |
230 | + </div> |
231 | + </div> |
232 | +</section> |
233 | \ No newline at end of file |
234 | |
235 | === added directory 'mail_organizer/static/src' |
236 | === added directory 'mail_organizer/static/src/css' |
237 | === added file 'mail_organizer/static/src/css/mail.css' |
238 | --- mail_organizer/static/src/css/mail.css 1970-01-01 00:00:00 +0000 |
239 | +++ mail_organizer/static/src/css/mail.css 2014-04-11 03:08:25 +0000 |
240 | @@ -0,0 +1,24 @@ |
241 | +/****************************************************************************** |
242 | +* |
243 | +* OpenERP, Open Source Management Solution |
244 | +* Copyright (c) 2010-2014 Elico Corp. All Rights Reserved. |
245 | +* Augustin Cisterne-Kaas <augustin.cisterne-kaas@elico-corp.com> |
246 | +* |
247 | +* This program is free software: you can redistribute it and/or modify |
248 | +* it under the terms of the GNU Affero General Public License as |
249 | +* published by the Free Software Foundation, either version 3 of the |
250 | +* License, or (at your option) any later version. |
251 | +* |
252 | +* This program is distributed in the hope that it will be useful, |
253 | +* but WITHOUT ANY WARRANTY; without even the implied warranty of |
254 | +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
255 | +* GNU Affero General Public License for more details. |
256 | +* |
257 | +* You should have received a copy of the GNU Affero General Public License |
258 | +* along with this program. If not, see <http://www.gnu.org/licenses/>. |
259 | +* |
260 | +******************************************************************************/ |
261 | +.openerp .oe_mail .oe_msg .oe_msg_icons .oe_assign:hover a{ |
262 | + color: #1fc0ff; |
263 | + text-shadow: 0px 1px #184fc5,0px -1px #184fc5, -1px 0px #184fc5, 1px 0px #184fc5, 0px 3px 3px rgba(0,0,0,0.1); |
264 | +} |
265 | |
266 | === added directory 'mail_organizer/static/src/img' |
267 | === added file 'mail_organizer/static/src/img/icon.png' |
268 | Binary files mail_organizer/static/src/img/icon.png 1970-01-01 00:00:00 +0000 and mail_organizer/static/src/img/icon.png 2014-04-11 03:08:25 +0000 differ |
269 | === added directory 'mail_organizer/static/src/js' |
270 | === added file 'mail_organizer/static/src/js/mail.js' |
271 | --- mail_organizer/static/src/js/mail.js 1970-01-01 00:00:00 +0000 |
272 | +++ mail_organizer/static/src/js/mail.js 2014-04-11 03:08:25 +0000 |
273 | @@ -0,0 +1,53 @@ |
274 | +/****************************************************************************** |
275 | +* |
276 | +* OpenERP, Open Source Management Solution |
277 | +* Copyright (c) 2010-2014 Elico Corp. All Rights Reserved. |
278 | +* Augustin Cisterne-Kaas <augustin.cisterne-kaas@elico-corp.com> |
279 | +* |
280 | +* This program is free software: you can redistribute it and/or modify |
281 | +* it under the terms of the GNU Affero General Public License as |
282 | +* published by the Free Software Foundation, either version 3 of the |
283 | +* License, or (at your option) any later version. |
284 | +* |
285 | +* This program is distributed in the hope that it will be useful, |
286 | +* but WITHOUT ANY WARRANTY; without even the implied warranty of |
287 | +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
288 | +* GNU Affero General Public License for more details. |
289 | +* |
290 | +* You should have received a copy of the GNU Affero General Public License |
291 | +* along with this program. If not, see <http://www.gnu.org/licenses/>. |
292 | +* |
293 | +******************************************************************************/ |
294 | +openerp.mail_organizer = function (instance) { |
295 | + var mail = instance.mail; |
296 | + var QWeb = instance.web.qweb; |
297 | + window.yep = instance; |
298 | + mail.ThreadMessage = mail.ThreadMessage.extend({ |
299 | + template: 'mail.thread.message', |
300 | + events: { |
301 | + 'click .oe_assign': 'open_wizard', |
302 | + }, |
303 | + |
304 | + start: function () { |
305 | + this._super.apply(this, arguments); |
306 | + }, |
307 | + |
308 | + open_wizard: function() { |
309 | + var self = this; |
310 | + var context = { |
311 | + 'active_id': this.id, |
312 | + }; |
313 | + var action = { |
314 | + type: 'ir.actions.act_window', |
315 | + res_model: 'wizard.mail.organizer', |
316 | + view_mode: 'form', |
317 | + view_type: 'form', |
318 | + views: [[false, 'form']], |
319 | + target: 'new', |
320 | + context: context, |
321 | + }; |
322 | + self.do_action(action); |
323 | + } |
324 | + |
325 | + }); |
326 | +}; |
327 | \ No newline at end of file |
328 | |
329 | === added directory 'mail_organizer/static/src/xml' |
330 | === added file 'mail_organizer/static/src/xml/mail.xml' |
331 | --- mail_organizer/static/src/xml/mail.xml 1970-01-01 00:00:00 +0000 |
332 | +++ mail_organizer/static/src/xml/mail.xml 2014-04-11 03:08:25 +0000 |
333 | @@ -0,0 +1,8 @@ |
334 | +<?xml version="1.0" encoding="UTF-8"?> |
335 | +<template> |
336 | + <t t-extend="mail.thread.message"> |
337 | + <t t-jquery=".oe_msg_icons span:first-child()" t-operation="after"> |
338 | + <span class="oe_assign"><a title="Assign to" class="oe_e">C</a></span> |
339 | + </t> |
340 | + </t> |
341 | +</template> |
342 | \ No newline at end of file |
343 | |
344 | === added directory 'mail_organizer/wizard' |
345 | === added file 'mail_organizer/wizard/__init__.py' |
346 | --- mail_organizer/wizard/__init__.py 1970-01-01 00:00:00 +0000 |
347 | +++ mail_organizer/wizard/__init__.py 2014-04-11 03:08:25 +0000 |
348 | @@ -0,0 +1,22 @@ |
349 | +# -*- coding: utf-8 -*- |
350 | +############################################################################## |
351 | +# |
352 | +# OpenERP, Open Source Management Solution |
353 | +# Copyright (c) 2010-2014 Elico Corp. All Rights Reserved. |
354 | +# Augustin Cisterne-Kaas <augustin.cisterne-kaas@elico-corp.com> |
355 | +# |
356 | +# This program is free software: you can redistribute it and/or modify |
357 | +# it under the terms of the GNU Affero General Public License as |
358 | +# published by the Free Software Foundation, either version 3 of the |
359 | +# License, or (at your option) any later version. |
360 | +# |
361 | +# This program is distributed in the hope that it will be useful, |
362 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
363 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
364 | +# GNU Affero General Public License for more details. |
365 | +# |
366 | +# You should have received a copy of the GNU Affero General Public License |
367 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
368 | +# |
369 | +############################################################################## |
370 | +import wizard_mail_organizer |
371 | |
372 | === added file 'mail_organizer/wizard/wizard_mail_organizer.py' |
373 | --- mail_organizer/wizard/wizard_mail_organizer.py 1970-01-01 00:00:00 +0000 |
374 | +++ mail_organizer/wizard/wizard_mail_organizer.py 2014-04-11 03:08:25 +0000 |
375 | @@ -0,0 +1,111 @@ |
376 | +# -*- coding: utf-8 -*- |
377 | +############################################################################## |
378 | +# |
379 | +# OpenERP, Open Source Management Solution |
380 | +# Copyright (c) 2010-2014 Elico Corp. All Rights Reserved. |
381 | +# Augustin Cisterne-Kaas <augustin.cisterne-kaas@elico-corp.com> |
382 | +# |
383 | +# This program is free software: you can redistribute it and/or modify |
384 | +# it under the terms of the GNU Affero General Public License as |
385 | +# published by the Free Software Foundation, either version 3 of the |
386 | +# License, or (at your option) any later version. |
387 | +# |
388 | +# This program is distributed in the hope that it will be useful, |
389 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
390 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
391 | +# GNU Affero General Public License for more details. |
392 | +# |
393 | +# You should have received a copy of the GNU Affero General Public License |
394 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
395 | +# |
396 | +############################################################################## |
397 | +from openerp.osv import fields, osv |
398 | + |
399 | + |
400 | +class wizard_mail_organizer(osv.osv_memory): |
401 | + _name = 'wizard.mail.organizer' |
402 | + |
403 | + def _select_models(self, cr, uid, context=None): |
404 | + module_pool = self.pool.get('ir.model') |
405 | + module_ids = module_pool.search( |
406 | + cr, uid, [('mail_organizer', '=', True)], |
407 | + order="name", context=context) |
408 | + modules = module_pool.browse(cr, uid, module_ids, context=context) |
409 | + return [(m.model, m.name) for m in modules] |
410 | + |
411 | + def _get_default_message_id(self, cr, uid, context=None): |
412 | + return context.get('active_id', None) |
413 | + |
414 | + _columns = { |
415 | + 'message_id': fields.many2one( |
416 | + 'mail.message', string="Message", required=True), |
417 | + 'res': fields.char('Ressource', readonly=True), |
418 | + 'model': fields.selection( |
419 | + _select_models, string="Model", readonly=True), |
420 | + 'new_res_id': fields.integer("New resource"), |
421 | + 'new_model': fields.selection(_select_models, string='New model'), |
422 | + 'subject': fields.char('Subject', readonly=True), |
423 | + 'email_from': fields.char('Email'), |
424 | + 'author_id': fields.many2one( |
425 | + 'res.partner', string='Author', readonly=True), |
426 | + 'has_domain': fields.boolean('Filter by partner'), |
427 | + 'is_domain_visible': fields.boolean('Is domain visible') |
428 | + } |
429 | + |
430 | + _defaults = { |
431 | + 'message_id': lambda self, cr, uid, c: ( |
432 | + self._get_default_message_id(cr, uid, context=c)), |
433 | + 'has_domain': True, |
434 | + 'is_domain_visible': False |
435 | + } |
436 | + |
437 | + def onchange_new_model(self, cr, uid, ids, new_model, has_domain, |
438 | + author_id, context=None): |
439 | + res = {} |
440 | + vals = {'new_res_id': None} |
441 | + domain = {'new_res_id': []} |
442 | + if new_model: |
443 | + obj_pool = self.pool.get(new_model) |
444 | + vals.update({'is_domain_visible': False}) |
445 | + if 'partner_id' in obj_pool._columns: |
446 | + if has_domain: |
447 | + domain = {'new_res_id': [('partner_id', '=', author_id)]} |
448 | + vals.update({'is_domain_visible': True}) |
449 | + res.update({'value': vals, 'domain': domain}) |
450 | + return res |
451 | + |
452 | + def onchange_message_id(self, cr, uid, ids, message_id, context=None): |
453 | + res = {} |
454 | + if not message_id: |
455 | + return res |
456 | + vals = {} |
457 | + message_pool = self.pool.get('mail.message') |
458 | + message = message_pool.browse( |
459 | + cr, uid, message_id, context=context) |
460 | + resource = '' |
461 | + if message.model and message.res_id: |
462 | + obj_pool = self.pool.get(message.model) |
463 | + obj = obj_pool.browse( |
464 | + cr, uid, message.res_id, context=context) |
465 | + resource = getattr(obj, obj._rec_name) |
466 | + vals.update({ |
467 | + 'model': message.model, |
468 | + 'res': resource, |
469 | + 'email_from': message.email_from, |
470 | + 'author_id': (message.author_id and message.author_id.id |
471 | + or None), |
472 | + 'subject': message.subject |
473 | + }) |
474 | + res.update({'value': vals}) |
475 | + return res |
476 | + |
477 | + def confirm(self, cr, uid, ids, context=None): |
478 | + message_pool = self.pool.get('mail.message') |
479 | + for wz in self.browse(cr, uid, ids, context=context): |
480 | + data = {'model': wz.new_model, 'res_id': wz.new_res_id} |
481 | + message_pool.write( |
482 | + cr, uid, wz.message_id.id, data, context=context) |
483 | + return { |
484 | + 'type': 'ir.actions.client', |
485 | + 'tag': 'reload' |
486 | + } |
487 | |
488 | === added file 'mail_organizer/wizard/wizard_mail_organizer_view.xml' |
489 | --- mail_organizer/wizard/wizard_mail_organizer_view.xml 1970-01-01 00:00:00 +0000 |
490 | +++ mail_organizer/wizard/wizard_mail_organizer_view.xml 2014-04-11 03:08:25 +0000 |
491 | @@ -0,0 +1,39 @@ |
492 | +<?xml version="1.0" encoding="UTF-8"?> |
493 | +<openerp> |
494 | + <data> |
495 | + <record model="ir.ui.view" id="wizard_mail_organizer_form"> |
496 | + <field name="name">wizard_mail_organizer.form</field> |
497 | + <field name="model">wizard.mail.organizer</field> |
498 | + <field name="type">form</field> |
499 | + <field name="arch" type="xml"> |
500 | + <form string="Wizard Mail Organizer" version="7.0"> |
501 | + <header> |
502 | + <h2 class="oe_title">Assign email to another resource</h2> |
503 | + </header> |
504 | + <field name="message_id" invisible="True" on_change="onchange_message_id(message_id)" /> |
505 | + <field name="is_domain_visible" invisible="True" /> |
506 | + <field name="email_from" invisible="True" /> |
507 | + <group col="4" colspan="2"> |
508 | + <field name="author_id" /> |
509 | + <field name="subject" /> |
510 | + <field name="model" /> |
511 | + <field name="res" /> |
512 | + <field name="new_model" colspan="2" on_change="onchange_new_model(new_model, has_domain, author_id)" /> |
513 | + <field name="new_res_id" |
514 | + colspan="2" |
515 | + widget="polymorphic" |
516 | + polymorphic="new_model" |
517 | + /> |
518 | + <field name="has_domain" |
519 | + on_change="onchange_new_model(new_model, has_domain, author_id)" |
520 | + attrs="{'invisible':[('is_domain_visible', '=', False)]}" /> |
521 | + </group> |
522 | + <footer> |
523 | + <button name="confirm" string="Assign" type="object" class="oe_highlight" /> |
524 | + <button string="Cancel" class="oe_link" special="cancel"/> |
525 | + </footer> |
526 | + </form> |
527 | + </field> |
528 | + </record> |
529 | + </data> |
530 | +</openerp> |
531 | \ No newline at end of file |
I think we can't merge this until all dependencies (web_polymorphic) are merged into some community branch.