Merge lp:~ajite/openobject-addons/elico-7.0-add-0002 into lp:~openerp-community/openobject-addons/elico-7.0
- elico-7.0-add-0002
- Merge into elico-7.0
Proposed by
Augustin Cisterne-Kaas - www.elico-corp.com
Status: | Merged |
---|---|
Approved by: | Eric Caudal - www.elico-corp.com |
Approved revision: | no longer in the source branch. |
Merged at revision: | 32 |
Proposed branch: | lp:~ajite/openobject-addons/elico-7.0-add-0002 |
Merge into: | lp:~openerp-community/openobject-addons/elico-7.0 |
Diff against target: |
695 lines (+558/-5) 17 files modified
mail_organizer/__init__.py (+24/-0) mail_organizer/__openerp__.py (+50/-0) mail_organizer/message.py (+29/-0) mail_organizer/model.py (+29/-0) mail_organizer/model_view.xml (+41/-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 (+108/-0) mail_organizer/wizard/wizard_mail_organizer_view.xml (+34/-0) web_adblock/__init__.py (+2/-2) web_adblock/__openerp__.py (+3/-3) web_adblock/static/src/js/announcement.js (+20/-0) web_polymorphic/__init__.py (+21/-0) web_polymorphic/__openerp__.py (+43/-0) web_polymorphic/static/src/js/view_form.js (+47/-0) |
To merge this branch: | bzr merge lp:~ajite/openobject-addons/elico-7.0-add-0002 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
LIN Yu | Approve | ||
Review via email: mp+207818@code.launchpad.net |
Commit message
Description of the change
Added web polymorphic module:
This module adds a new field named polymorphic.
Added Mail Organizer
This module allows a user to organize his email easily.
Added a log for the web adblock extension.
To post a comment you must log in.
Revision history for this message
LIN Yu (lin-yu) : | # |
review:
Approve
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-02-23 07:15:07 +0000 | |||
5 | @@ -0,0 +1,24 @@ | |||
6 | 1 | # -*- coding: utf-8 -*- | ||
7 | 2 | ############################################################################## | ||
8 | 3 | # | ||
9 | 4 | # OpenERP, Open Source Management Solution | ||
10 | 5 | # Copyright (c) 2010-2014 Elico Corp. All Rights Reserved. | ||
11 | 6 | # Augustin Cisterne-Kaas <augustin.cisterne-kaas@elico-corp.com> | ||
12 | 7 | # | ||
13 | 8 | # This program is free software: you can redistribute it and/or modify | ||
14 | 9 | # it under the terms of the GNU Affero General Public License as | ||
15 | 10 | # published by the Free Software Foundation, either version 3 of the | ||
16 | 11 | # License, or (at your option) any later version. | ||
17 | 12 | # | ||
18 | 13 | # This program is distributed in the hope that it will be useful, | ||
19 | 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
20 | 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
21 | 16 | # GNU Affero General Public License for more details. | ||
22 | 17 | # | ||
23 | 18 | # You should have received a copy of the GNU Affero General Public License | ||
24 | 19 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
25 | 20 | # | ||
26 | 21 | ############################################################################## | ||
27 | 22 | import model | ||
28 | 23 | import message | ||
29 | 24 | import wizard | ||
30 | 0 | 25 | ||
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-02-23 07:15:07 +0000 | |||
34 | @@ -0,0 +1,50 @@ | |||
35 | 1 | # -*- coding: utf-8 -*- | ||
36 | 2 | ############################################################################## | ||
37 | 3 | # | ||
38 | 4 | # OpenERP, Open Source Management Solution | ||
39 | 5 | # Copyright (c) 2010-2014 Elico Corp. All Rights Reserved. | ||
40 | 6 | # Augustin Cisterne-Kaas <augustin.cisterne-kaas@elico-corp.com> | ||
41 | 7 | # | ||
42 | 8 | # This program is free software: you can redistribute it and/or modify | ||
43 | 9 | # it under the terms of the GNU Affero General Public License as | ||
44 | 10 | # published by the Free Software Foundation, either version 3 of the | ||
45 | 11 | # License, or (at your option) any later version. | ||
46 | 12 | # | ||
47 | 13 | # This program is distributed in the hope that it will be useful, | ||
48 | 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
49 | 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
50 | 16 | # GNU Affero General Public License for more details. | ||
51 | 17 | # | ||
52 | 18 | # You should have received a copy of the GNU Affero General Public License | ||
53 | 19 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
54 | 20 | # | ||
55 | 21 | ############################################################################## | ||
56 | 22 | {'name': 'Mail Organizer', | ||
57 | 23 | 'version': '0.1', | ||
58 | 24 | 'category': 'Social Network', | ||
59 | 25 | 'depends': ['web_polymorphic', 'mail'], | ||
60 | 26 | 'author': 'Elico Corp', | ||
61 | 27 | 'license': 'AGPL-3', | ||
62 | 28 | 'website': 'https://www.elico-corp.com', | ||
63 | 29 | 'description': """ | ||
64 | 30 | This module allows you to assign a message to an existing or | ||
65 | 31 | a new resource dynamically. | ||
66 | 32 | |||
67 | 33 | You can configure the available model through | ||
68 | 34 | "Settings" -> "Technical" -> "Email Organizer" | ||
69 | 35 | """, | ||
70 | 36 | 'images': [], | ||
71 | 37 | 'demo': [], | ||
72 | 38 | 'data': ['wizard/wizard_mail_organizer_view.xml', | ||
73 | 39 | 'model_view.xml'], | ||
74 | 40 | 'qweb': [ | ||
75 | 41 | 'static/src/xml/mail.xml' | ||
76 | 42 | ], | ||
77 | 43 | 'js': [ | ||
78 | 44 | 'static/src/js/mail.js' | ||
79 | 45 | ], | ||
80 | 46 | 'css': [ | ||
81 | 47 | 'static/src/css/mail.css' | ||
82 | 48 | ], | ||
83 | 49 | 'installable': True, | ||
84 | 50 | 'application': False} | ||
85 | 0 | 51 | ||
86 | === added file 'mail_organizer/message.py' | |||
87 | --- mail_organizer/message.py 1970-01-01 00:00:00 +0000 | |||
88 | +++ mail_organizer/message.py 2014-02-23 07:15:07 +0000 | |||
89 | @@ -0,0 +1,29 @@ | |||
90 | 1 | # -*- coding: utf-8 -*- | ||
91 | 2 | ############################################################################## | ||
92 | 3 | # | ||
93 | 4 | # OpenERP, Open Source Management Solution | ||
94 | 5 | # Copyright (c) 2010-2014 Elico Corp. All Rights Reserved. | ||
95 | 6 | # Augustin Cisterne-Kaas <augustin.cisterne-kaas@elico-corp.com> | ||
96 | 7 | # | ||
97 | 8 | # This program is free software: you can redistribute it and/or modify | ||
98 | 9 | # it under the terms of the GNU Affero General Public License as | ||
99 | 10 | # published by the Free Software Foundation, either version 3 of the | ||
100 | 11 | # License, or (at your option) any later version. | ||
101 | 12 | # | ||
102 | 13 | # This program is distributed in the hope that it will be useful, | ||
103 | 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
104 | 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
105 | 16 | # GNU Affero General Public License for more details. | ||
106 | 17 | # | ||
107 | 18 | # You should have received a copy of the GNU Affero General Public License | ||
108 | 19 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
109 | 20 | # | ||
110 | 21 | ############################################################################## | ||
111 | 22 | from openerp.osv import fields, orm | ||
112 | 23 | |||
113 | 24 | |||
114 | 25 | class mail_message(orm.Model): | ||
115 | 26 | _inherit = 'mail.message' | ||
116 | 27 | _columns = { | ||
117 | 28 | 'name': fields.char('Name') | ||
118 | 29 | } | ||
119 | 0 | 30 | ||
120 | === added file 'mail_organizer/model.py' | |||
121 | --- mail_organizer/model.py 1970-01-01 00:00:00 +0000 | |||
122 | +++ mail_organizer/model.py 2014-02-23 07:15:07 +0000 | |||
123 | @@ -0,0 +1,29 @@ | |||
124 | 1 | # -*- coding: utf-8 -*- | ||
125 | 2 | ############################################################################## | ||
126 | 3 | # | ||
127 | 4 | # OpenERP, Open Source Management Solution | ||
128 | 5 | # Copyright (c) 2010-2014 Elico Corp. All Rights Reserved. | ||
129 | 6 | # Augustin Cisterne-Kaas <augustin.cisterne-kaas@elico-corp.com> | ||
130 | 7 | # | ||
131 | 8 | # This program is free software: you can redistribute it and/or modify | ||
132 | 9 | # it under the terms of the GNU Affero General Public License as | ||
133 | 10 | # published by the Free Software Foundation, either version 3 of the | ||
134 | 11 | # License, or (at your option) any later version. | ||
135 | 12 | # | ||
136 | 13 | # This program is distributed in the hope that it will be useful, | ||
137 | 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
138 | 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
139 | 16 | # GNU Affero General Public License for more details. | ||
140 | 17 | # | ||
141 | 18 | # You should have received a copy of the GNU Affero General Public License | ||
142 | 19 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
143 | 20 | # | ||
144 | 21 | ############################################################################## | ||
145 | 22 | from openerp.osv import fields, orm | ||
146 | 23 | |||
147 | 24 | |||
148 | 25 | class ir_model(orm.Model): | ||
149 | 26 | _inherit = 'ir.model' | ||
150 | 27 | _columns = { | ||
151 | 28 | 'mail_organizer': fields.boolean('Use in Mail Organizer') | ||
152 | 29 | } | ||
153 | 0 | 30 | ||
154 | === added file 'mail_organizer/model_view.xml' | |||
155 | --- mail_organizer/model_view.xml 1970-01-01 00:00:00 +0000 | |||
156 | +++ mail_organizer/model_view.xml 2014-02-23 07:15:07 +0000 | |||
157 | @@ -0,0 +1,41 @@ | |||
158 | 1 | <?xml version="1.0" encoding="UTF-8"?> | ||
159 | 2 | <openerp> | ||
160 | 3 | <data> | ||
161 | 4 | <record id="view_model_form" model="ir.ui.view"> | ||
162 | 5 | <field name="name">ir.model.form</field> | ||
163 | 6 | <field name="model">ir.model</field> | ||
164 | 7 | <field name="inherit_id" ref="base.view_model_form" /> | ||
165 | 8 | <field name="arch" type="xml" > | ||
166 | 9 | <field name="modules" position="after"> | ||
167 | 10 | <field name="mail_organizer" /> | ||
168 | 11 | </field> | ||
169 | 12 | </field> | ||
170 | 13 | </record> | ||
171 | 14 | |||
172 | 15 | <record id="view_model_tree_editable" model="ir.ui.view"> | ||
173 | 16 | <field name="name">Ir Model editable tree</field> | ||
174 | 17 | <field name="model">ir.model</field> | ||
175 | 18 | <field name="arch" type="xml" > | ||
176 | 19 | <tree string="Mail Organizer" editable="bottom"> | ||
177 | 20 | <field name="name" readonly="1" /> | ||
178 | 21 | <field name="model" readonly="1" /> | ||
179 | 22 | <field name="mail_organizer" /> | ||
180 | 23 | </tree> | ||
181 | 24 | </field> | ||
182 | 25 | </record> | ||
183 | 26 | |||
184 | 27 | |||
185 | 28 | <record model="ir.actions.act_window" id="action_mail_organizer"> | ||
186 | 29 | <field name="name">Email organizer</field> | ||
187 | 30 | <field name="view_id" ref="view_model_tree_editable"/> | ||
188 | 31 | <field name="res_model">ir.model</field> | ||
189 | 32 | <field name="view_type">form</field> | ||
190 | 33 | <field name="usage">menu</field> | ||
191 | 34 | </record> | ||
192 | 35 | |||
193 | 36 | <menuitem id="menu_email_organizer" | ||
194 | 37 | name="Email Organizer" | ||
195 | 38 | action="action_mail_organizer" | ||
196 | 39 | parent="base.menu_email" /> | ||
197 | 40 | </data> | ||
198 | 41 | </openerp> | ||
199 | 0 | \ No newline at end of file | 42 | \ No newline at end of file |
200 | 1 | 43 | ||
201 | === added directory 'mail_organizer/static' | |||
202 | === added directory 'mail_organizer/static/src' | |||
203 | === added directory 'mail_organizer/static/src/css' | |||
204 | === added file 'mail_organizer/static/src/css/mail.css' | |||
205 | --- mail_organizer/static/src/css/mail.css 1970-01-01 00:00:00 +0000 | |||
206 | +++ mail_organizer/static/src/css/mail.css 2014-02-23 07:15:07 +0000 | |||
207 | @@ -0,0 +1,24 @@ | |||
208 | 1 | /****************************************************************************** | ||
209 | 2 | * | ||
210 | 3 | * OpenERP, Open Source Management Solution | ||
211 | 4 | * Copyright (c) 2010-2014 Elico Corp. All Rights Reserved. | ||
212 | 5 | * Augustin Cisterne-Kaas <augustin.cisterne-kaas@elico-corp.com> | ||
213 | 6 | * | ||
214 | 7 | * This program is free software: you can redistribute it and/or modify | ||
215 | 8 | * it under the terms of the GNU Affero General Public License as | ||
216 | 9 | * published by the Free Software Foundation, either version 3 of the | ||
217 | 10 | * License, or (at your option) any later version. | ||
218 | 11 | * | ||
219 | 12 | * This program is distributed in the hope that it will be useful, | ||
220 | 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
221 | 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
222 | 15 | * GNU Affero General Public License for more details. | ||
223 | 16 | * | ||
224 | 17 | * You should have received a copy of the GNU Affero General Public License | ||
225 | 18 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
226 | 19 | * | ||
227 | 20 | ******************************************************************************/ | ||
228 | 21 | .openerp .oe_mail .oe_msg .oe_msg_icons .oe_assign:hover a{ | ||
229 | 22 | color: #1fc0ff; | ||
230 | 23 | text-shadow: 0px 1px #184fc5,0px -1px #184fc5, -1px 0px #184fc5, 1px 0px #184fc5, 0px 3px 3px rgba(0,0,0,0.1); | ||
231 | 24 | } | ||
232 | 0 | 25 | ||
233 | === added directory 'mail_organizer/static/src/img' | |||
234 | === added file 'mail_organizer/static/src/img/icon.png' | |||
235 | 1 | 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-02-23 07:15:07 +0000 differ | 26 | 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-02-23 07:15:07 +0000 differ |
236 | === added directory 'mail_organizer/static/src/js' | |||
237 | === added file 'mail_organizer/static/src/js/mail.js' | |||
238 | --- mail_organizer/static/src/js/mail.js 1970-01-01 00:00:00 +0000 | |||
239 | +++ mail_organizer/static/src/js/mail.js 2014-02-23 07:15:07 +0000 | |||
240 | @@ -0,0 +1,53 @@ | |||
241 | 1 | /****************************************************************************** | ||
242 | 2 | * | ||
243 | 3 | * OpenERP, Open Source Management Solution | ||
244 | 4 | * Copyright (c) 2010-2014 Elico Corp. All Rights Reserved. | ||
245 | 5 | * Augustin Cisterne-Kaas <augustin.cisterne-kaas@elico-corp.com> | ||
246 | 6 | * | ||
247 | 7 | * This program is free software: you can redistribute it and/or modify | ||
248 | 8 | * it under the terms of the GNU Affero General Public License as | ||
249 | 9 | * published by the Free Software Foundation, either version 3 of the | ||
250 | 10 | * License, or (at your option) any later version. | ||
251 | 11 | * | ||
252 | 12 | * This program is distributed in the hope that it will be useful, | ||
253 | 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
254 | 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
255 | 15 | * GNU Affero General Public License for more details. | ||
256 | 16 | * | ||
257 | 17 | * You should have received a copy of the GNU Affero General Public License | ||
258 | 18 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
259 | 19 | * | ||
260 | 20 | ******************************************************************************/ | ||
261 | 21 | openerp.mail_organizer = function (instance) { | ||
262 | 22 | var mail = instance.mail; | ||
263 | 23 | var QWeb = instance.web.qweb; | ||
264 | 24 | window.yep = instance; | ||
265 | 25 | mail.ThreadMessage = mail.ThreadMessage.extend({ | ||
266 | 26 | template: 'mail.thread.message', | ||
267 | 27 | events: { | ||
268 | 28 | 'click .oe_assign': 'open_wizard', | ||
269 | 29 | }, | ||
270 | 30 | |||
271 | 31 | start: function () { | ||
272 | 32 | this._super.apply(this, arguments); | ||
273 | 33 | }, | ||
274 | 34 | |||
275 | 35 | open_wizard: function() { | ||
276 | 36 | var self = this; | ||
277 | 37 | var context = { | ||
278 | 38 | 'active_id': this.id, | ||
279 | 39 | }; | ||
280 | 40 | var action = { | ||
281 | 41 | type: 'ir.actions.act_window', | ||
282 | 42 | res_model: 'wizard.mail.organizer', | ||
283 | 43 | view_mode: 'form', | ||
284 | 44 | view_type: 'form', | ||
285 | 45 | views: [[false, 'form']], | ||
286 | 46 | target: 'new', | ||
287 | 47 | context: context, | ||
288 | 48 | }; | ||
289 | 49 | self.do_action(action); | ||
290 | 50 | } | ||
291 | 51 | |||
292 | 52 | }); | ||
293 | 53 | }; | ||
294 | 0 | \ No newline at end of file | 54 | \ No newline at end of file |
295 | 1 | 55 | ||
296 | === added directory 'mail_organizer/static/src/xml' | |||
297 | === added file 'mail_organizer/static/src/xml/mail.xml' | |||
298 | --- mail_organizer/static/src/xml/mail.xml 1970-01-01 00:00:00 +0000 | |||
299 | +++ mail_organizer/static/src/xml/mail.xml 2014-02-23 07:15:07 +0000 | |||
300 | @@ -0,0 +1,8 @@ | |||
301 | 1 | <?xml version="1.0" encoding="UTF-8"?> | ||
302 | 2 | <template> | ||
303 | 3 | <t t-extend="mail.thread.message"> | ||
304 | 4 | <t t-jquery=".oe_msg_icons span:first-child()" t-operation="after"> | ||
305 | 5 | <span class="oe_assign"><a title="Assign to" class="oe_e">C</a></span> | ||
306 | 6 | </t> | ||
307 | 7 | </t> | ||
308 | 8 | </template> | ||
309 | 0 | \ No newline at end of file | 9 | \ No newline at end of file |
310 | 1 | 10 | ||
311 | === added directory 'mail_organizer/wizard' | |||
312 | === added file 'mail_organizer/wizard/__init__.py' | |||
313 | --- mail_organizer/wizard/__init__.py 1970-01-01 00:00:00 +0000 | |||
314 | +++ mail_organizer/wizard/__init__.py 2014-02-23 07:15:07 +0000 | |||
315 | @@ -0,0 +1,22 @@ | |||
316 | 1 | # -*- coding: utf-8 -*- | ||
317 | 2 | ############################################################################## | ||
318 | 3 | # | ||
319 | 4 | # OpenERP, Open Source Management Solution | ||
320 | 5 | # Copyright (c) 2010-2014 Elico Corp. All Rights Reserved. | ||
321 | 6 | # Augustin Cisterne-Kaas <augustin.cisterne-kaas@elico-corp.com> | ||
322 | 7 | # | ||
323 | 8 | # This program is free software: you can redistribute it and/or modify | ||
324 | 9 | # it under the terms of the GNU Affero General Public License as | ||
325 | 10 | # published by the Free Software Foundation, either version 3 of the | ||
326 | 11 | # License, or (at your option) any later version. | ||
327 | 12 | # | ||
328 | 13 | # This program is distributed in the hope that it will be useful, | ||
329 | 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
330 | 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
331 | 16 | # GNU Affero General Public License for more details. | ||
332 | 17 | # | ||
333 | 18 | # You should have received a copy of the GNU Affero General Public License | ||
334 | 19 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
335 | 20 | # | ||
336 | 21 | ############################################################################## | ||
337 | 22 | import wizard_mail_organizer | ||
338 | 0 | 23 | ||
339 | === added file 'mail_organizer/wizard/wizard_mail_organizer.py' | |||
340 | --- mail_organizer/wizard/wizard_mail_organizer.py 1970-01-01 00:00:00 +0000 | |||
341 | +++ mail_organizer/wizard/wizard_mail_organizer.py 2014-02-23 07:15:07 +0000 | |||
342 | @@ -0,0 +1,108 @@ | |||
343 | 1 | # -*- coding: utf-8 -*- | ||
344 | 2 | ############################################################################## | ||
345 | 3 | # | ||
346 | 4 | # OpenERP, Open Source Management Solution | ||
347 | 5 | # Copyright (c) 2010-2014 Elico Corp. All Rights Reserved. | ||
348 | 6 | # Augustin Cisterne-Kaas <augustin.cisterne-kaas@elico-corp.com> | ||
349 | 7 | # | ||
350 | 8 | # This program is free software: you can redistribute it and/or modify | ||
351 | 9 | # it under the terms of the GNU Affero General Public License as | ||
352 | 10 | # published by the Free Software Foundation, either version 3 of the | ||
353 | 11 | # License, or (at your option) any later version. | ||
354 | 12 | # | ||
355 | 13 | # This program is distributed in the hope that it will be useful, | ||
356 | 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
357 | 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
358 | 16 | # GNU Affero General Public License for more details. | ||
359 | 17 | # | ||
360 | 18 | # You should have received a copy of the GNU Affero General Public License | ||
361 | 19 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
362 | 20 | # | ||
363 | 21 | ############################################################################## | ||
364 | 22 | from openerp.osv import fields, osv | ||
365 | 23 | |||
366 | 24 | |||
367 | 25 | class wizard_mail_organizer(osv.osv_memory): | ||
368 | 26 | _name = 'wizard.mail.organizer' | ||
369 | 27 | |||
370 | 28 | def _select_models(self, cr, uid, context=None): | ||
371 | 29 | module_pool = self.pool.get('ir.model') | ||
372 | 30 | module_ids = module_pool.search( | ||
373 | 31 | cr, uid, [('mail_organizer', '=', True)], | ||
374 | 32 | order="name", context=context) | ||
375 | 33 | modules = module_pool.browse(cr, uid, module_ids, context=context) | ||
376 | 34 | return [(m.model, m.name) for m in modules] | ||
377 | 35 | |||
378 | 36 | def _get_default_message_id(self, cr, uid, context=None): | ||
379 | 37 | return context.get('active_id', None) | ||
380 | 38 | |||
381 | 39 | _columns = { | ||
382 | 40 | 'message_id': fields.many2one( | ||
383 | 41 | 'mail.message', string="Message", required=True), | ||
384 | 42 | 'res': fields.char('Ressource', readonly=True), | ||
385 | 43 | 'model': fields.selection( | ||
386 | 44 | _select_models, string="Model", readonly=True), | ||
387 | 45 | 'new_res_id': fields.integer("New resource"), | ||
388 | 46 | 'new_model': fields.selection(_select_models, string="New model"), | ||
389 | 47 | 'subject': fields.char('Subject', readonly=True), | ||
390 | 48 | 'author_id': fields.many2one( | ||
391 | 49 | 'res.partner', string='Author', readonly=True), | ||
392 | 50 | 'has_domain': fields.boolean('Filter by partner'), | ||
393 | 51 | 'is_domain_visible': fields.boolean('Is domain visible') | ||
394 | 52 | } | ||
395 | 53 | |||
396 | 54 | _defaults = { | ||
397 | 55 | 'message_id': lambda self, cr, uid, c: ( | ||
398 | 56 | self._get_default_message_id(cr, uid, context=c)), | ||
399 | 57 | 'has_domain': True, | ||
400 | 58 | 'is_domain_visible': False | ||
401 | 59 | } | ||
402 | 60 | |||
403 | 61 | def onchange_new_model(self, cr, uid, ids, new_model, has_domain, | ||
404 | 62 | author_id, context=None): | ||
405 | 63 | res = {} | ||
406 | 64 | vals = {'new_res_id': None} | ||
407 | 65 | domain = {'new_res_id': []} | ||
408 | 66 | if new_model and has_domain: | ||
409 | 67 | obj_pool = self.pool.get(new_model) | ||
410 | 68 | vals.update({'is_domain_visible': False}) | ||
411 | 69 | if 'partner_id' in obj_pool._columns: | ||
412 | 70 | domain = {'new_res_id': [('partner_id', '=', author_id)]} | ||
413 | 71 | vals.update({'is_domain_visible': True}) | ||
414 | 72 | res.update({'value': vals, 'domain': domain}) | ||
415 | 73 | return res | ||
416 | 74 | |||
417 | 75 | def onchange_message_id(self, cr, uid, ids, message_id, context=None): | ||
418 | 76 | res = {} | ||
419 | 77 | if not message_id: | ||
420 | 78 | return res | ||
421 | 79 | vals = {} | ||
422 | 80 | message_pool = self.pool.get('mail.message') | ||
423 | 81 | message = message_pool.browse( | ||
424 | 82 | cr, uid, message_id, context=context) | ||
425 | 83 | resource = '' | ||
426 | 84 | if message.model and message.res_id: | ||
427 | 85 | obj_pool = self.pool.get(message.model) | ||
428 | 86 | obj = obj_pool.browse( | ||
429 | 87 | cr, uid, message.res_id, context=context) | ||
430 | 88 | resource = getattr(obj, obj._rec_name) | ||
431 | 89 | vals.update({ | ||
432 | 90 | 'model': message.model, | ||
433 | 91 | 'res': resource, | ||
434 | 92 | 'author_id': (message.author_id and message.author_id.id | ||
435 | 93 | or None), | ||
436 | 94 | 'subject': message.subject | ||
437 | 95 | }) | ||
438 | 96 | res.update({'value': vals}) | ||
439 | 97 | return res | ||
440 | 98 | |||
441 | 99 | def confirm(self, cr, uid, ids, context=None): | ||
442 | 100 | message_pool = self.pool.get('mail.message') | ||
443 | 101 | for wz in self.browse(cr, uid, ids, context=context): | ||
444 | 102 | data = {'model': wz.new_model, 'res_id': wz.new_res_id} | ||
445 | 103 | message_pool.write( | ||
446 | 104 | cr, uid, wz.message_id.id, data, context=context) | ||
447 | 105 | return { | ||
448 | 106 | 'type': 'ir.actions.client', | ||
449 | 107 | 'tag': 'reload' | ||
450 | 108 | } | ||
451 | 0 | 109 | ||
452 | === added file 'mail_organizer/wizard/wizard_mail_organizer_view.xml' | |||
453 | --- mail_organizer/wizard/wizard_mail_organizer_view.xml 1970-01-01 00:00:00 +0000 | |||
454 | +++ mail_organizer/wizard/wizard_mail_organizer_view.xml 2014-02-23 07:15:07 +0000 | |||
455 | @@ -0,0 +1,34 @@ | |||
456 | 1 | <?xml version="1.0" encoding="UTF-8"?> | ||
457 | 2 | <openerp> | ||
458 | 3 | <data> | ||
459 | 4 | <record model="ir.ui.view" id="wizard_mail_organizer_form"> | ||
460 | 5 | <field name="name">wizard_mail_organizer.form</field> | ||
461 | 6 | <field name="model">wizard.mail.organizer</field> | ||
462 | 7 | <field name="type">form</field> | ||
463 | 8 | <field name="arch" type="xml"> | ||
464 | 9 | <form string="Wizard Mail Organizer" version="7.0"> | ||
465 | 10 | <header> | ||
466 | 11 | <h2 class="oe_title">Assign email to another resource</h2> | ||
467 | 12 | </header> | ||
468 | 13 | <field name="message_id" invisible="True" on_change="onchange_message_id(message_id)" /> | ||
469 | 14 | <field name="is_domain_visible" invisible="True" /> | ||
470 | 15 | <group col="4" colspan="2"> | ||
471 | 16 | <field name="author_id" /> | ||
472 | 17 | <field name="subject" /> | ||
473 | 18 | <field name="model" /> | ||
474 | 19 | <field name="res" /> | ||
475 | 20 | <field name="new_model" colspan="2" on_change="onchange_new_model(new_model, has_domain, author_id)" /> | ||
476 | 21 | <field name="new_res_id" colspan="2" widget="polymorphic" polymorphic="new_model"/> | ||
477 | 22 | <field name="has_domain" | ||
478 | 23 | on_change="onchange_new_model(new_model, has_domain, author_id)" | ||
479 | 24 | attrs="{'invisible':[('is_domain_visible', '=', False)]}" /> | ||
480 | 25 | </group> | ||
481 | 26 | <footer> | ||
482 | 27 | <button name="confirm" string="Assign" type="object" class="oe_highlight" /> | ||
483 | 28 | <button string="Cancel" class="oe_link" special="cancel"/> | ||
484 | 29 | </footer> | ||
485 | 30 | </form> | ||
486 | 31 | </field> | ||
487 | 32 | </record> | ||
488 | 33 | </data> | ||
489 | 34 | </openerp> | ||
490 | 0 | \ No newline at end of file | 35 | \ No newline at end of file |
491 | 1 | 36 | ||
492 | === modified file 'web_adblock/__init__.py' | |||
493 | --- web_adblock/__init__.py 2013-12-28 06:25:35 +0000 | |||
494 | +++ web_adblock/__init__.py 2014-02-23 07:15:07 +0000 | |||
495 | @@ -2,8 +2,8 @@ | |||
496 | 2 | ############################################################################## | 2 | ############################################################################## |
497 | 3 | # | 3 | # |
498 | 4 | # OpenERP, Open Source Management Solution | 4 | # OpenERP, Open Source Management Solution |
501 | 5 | # Copyright (c) 2010-2013 Elico Corp. All Rights Reserved. | 5 | # Copyright (c) 2010-2014 Elico Corp. All Rights Reserved. |
502 | 6 | # Augustin Cisterne-Kaas <augustin.cisterne-kaaas@elico-corp.com> | 6 | # Augustin Cisterne-Kaas <augustin.cisterne-kaas@elico-corp.com> |
503 | 7 | # | 7 | # |
504 | 8 | # This program is free software: you can redistribute it and/or modify | 8 | # This program is free software: you can redistribute it and/or modify |
505 | 9 | # it under the terms of the GNU Affero General Public License as | 9 | # it under the terms of the GNU Affero General Public License as |
506 | 10 | 10 | ||
507 | === modified file 'web_adblock/__openerp__.py' | |||
508 | --- web_adblock/__openerp__.py 2013-12-28 06:25:35 +0000 | |||
509 | +++ web_adblock/__openerp__.py 2014-02-23 07:15:07 +0000 | |||
510 | @@ -2,8 +2,8 @@ | |||
511 | 2 | ############################################################################## | 2 | ############################################################################## |
512 | 3 | # | 3 | # |
513 | 4 | # OpenERP, Open Source Management Solution | 4 | # OpenERP, Open Source Management Solution |
516 | 5 | # Copyright (c) 2010-2013 Elico Corp. All Rights Reserved. | 5 | # Copyright (c) 2010-2014 Elico Corp. All Rights Reserved. |
517 | 6 | # Augustin Cisterne-Kaas <augustin.cisterne-kaaas@elico-corp.com> | 6 | # Augustin Cisterne-Kaas <augustin.cisterne-kaas@elico-corp.com> |
518 | 7 | # | 7 | # |
519 | 8 | # This program is free software: you can redistribute it and/or modify | 8 | # This program is free software: you can redistribute it and/or modify |
520 | 9 | # it under the terms of the GNU Affero General Public License as | 9 | # it under the terms of the GNU Affero General Public License as |
521 | @@ -22,7 +22,7 @@ | |||
522 | 22 | { | 22 | { |
523 | 23 | 'name': 'OpenERP Adblock', | 23 | 'name': 'OpenERP Adblock', |
524 | 24 | 'version': '0.1', | 24 | 'version': '0.1', |
526 | 25 | 'category': '', | 25 | 'category': 'Web', |
527 | 26 | 'depends': ['mail'], | 26 | 'depends': ['mail'], |
528 | 27 | 'author': 'Elico Corp', | 27 | 'author': 'Elico Corp', |
529 | 28 | 'license': 'AGPL-3', | 28 | 'license': 'AGPL-3', |
530 | 29 | 29 | ||
531 | === added file 'web_adblock/static/.DS_Store' | |||
532 | 30 | Binary files web_adblock/static/.DS_Store 1970-01-01 00:00:00 +0000 and web_adblock/static/.DS_Store 2014-02-23 07:15:07 +0000 differ | 30 | Binary files web_adblock/static/.DS_Store 1970-01-01 00:00:00 +0000 and web_adblock/static/.DS_Store 2014-02-23 07:15:07 +0000 differ |
533 | === added directory 'web_adblock/static/src/img' | |||
534 | === added file 'web_adblock/static/src/img/icon.png' | |||
535 | 31 | Binary files web_adblock/static/src/img/icon.png 1970-01-01 00:00:00 +0000 and web_adblock/static/src/img/icon.png 2014-02-23 07:15:07 +0000 differ | 31 | Binary files web_adblock/static/src/img/icon.png 1970-01-01 00:00:00 +0000 and web_adblock/static/src/img/icon.png 2014-02-23 07:15:07 +0000 differ |
536 | === modified file 'web_adblock/static/src/js/announcement.js' | |||
537 | --- web_adblock/static/src/js/announcement.js 2013-12-28 06:25:35 +0000 | |||
538 | +++ web_adblock/static/src/js/announcement.js 2014-02-23 07:15:07 +0000 | |||
539 | @@ -1,3 +1,23 @@ | |||
540 | 1 | /****************************************************************************** | ||
541 | 2 | * | ||
542 | 3 | * OpenERP, Open Source Management Solution | ||
543 | 4 | * Copyright (c) 2010-2014 Elico Corp. All Rights Reserved. | ||
544 | 5 | * Augustin Cisterne-Kaas <augustin.cisterne-kaas@elico-corp.com> | ||
545 | 6 | * | ||
546 | 7 | * This program is free software: you can redistribute it and/or modify | ||
547 | 8 | * it under the terms of the GNU Affero General Public License as | ||
548 | 9 | * published by the Free Software Foundation, either version 3 of the | ||
549 | 10 | * License, or (at your option) any later version. | ||
550 | 11 | * | ||
551 | 12 | * This program is distributed in the hope that it will be useful, | ||
552 | 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
553 | 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
554 | 15 | * GNU Affero General Public License for more details. | ||
555 | 16 | * | ||
556 | 17 | * You should have received a copy of the GNU Affero General Public License | ||
557 | 18 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
558 | 19 | * | ||
559 | 20 | ******************************************************************************/ | ||
560 | 1 | openerp_announcement = function(instance) { | 21 | openerp_announcement = function(instance) { |
561 | 2 | 22 | ||
562 | 3 | }; | 23 | }; |
563 | 4 | \ No newline at end of file | 24 | \ No newline at end of file |
564 | 5 | 25 | ||
565 | === added directory 'web_polymorphic' | |||
566 | === added file 'web_polymorphic/__init__.py' | |||
567 | --- web_polymorphic/__init__.py 1970-01-01 00:00:00 +0000 | |||
568 | +++ web_polymorphic/__init__.py 2014-02-23 07:15:07 +0000 | |||
569 | @@ -0,0 +1,21 @@ | |||
570 | 1 | # -*- coding: utf-8 -*- | ||
571 | 2 | ############################################################################## | ||
572 | 3 | # | ||
573 | 4 | # OpenERP, Open Source Management Solution | ||
574 | 5 | # Copyright (c) 2010-2014 Elico Corp. All Rights Reserved. | ||
575 | 6 | # Augustin Cisterne-Kaas <augustin.cisterne-kaas@elico-corp.com> | ||
576 | 7 | # | ||
577 | 8 | # This program is free software: you can redistribute it and/or modify | ||
578 | 9 | # it under the terms of the GNU Affero General Public License as | ||
579 | 10 | # published by the Free Software Foundation, either version 3 of the | ||
580 | 11 | # License, or (at your option) any later version. | ||
581 | 12 | # | ||
582 | 13 | # This program is distributed in the hope that it will be useful, | ||
583 | 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
584 | 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
585 | 16 | # GNU Affero General Public License for more details. | ||
586 | 17 | # | ||
587 | 18 | # You should have received a copy of the GNU Affero General Public License | ||
588 | 19 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
589 | 20 | # | ||
590 | 21 | ############################################################################## | ||
591 | 0 | 22 | ||
592 | === added file 'web_polymorphic/__openerp__.py' | |||
593 | --- web_polymorphic/__openerp__.py 1970-01-01 00:00:00 +0000 | |||
594 | +++ web_polymorphic/__openerp__.py 2014-02-23 07:15:07 +0000 | |||
595 | @@ -0,0 +1,43 @@ | |||
596 | 1 | # -*- coding: utf-8 -*- | ||
597 | 2 | ############################################################################## | ||
598 | 3 | # | ||
599 | 4 | # OpenERP, Open Source Management Solution | ||
600 | 5 | # Copyright (c) 2010-2014 Elico Corp. All Rights Reserved. | ||
601 | 6 | # Augustin Cisterne-Kaas <augustin.cisterne-kaas@elico-corp.com> | ||
602 | 7 | # | ||
603 | 8 | # This program is free software: you can redistribute it and/or modify | ||
604 | 9 | # it under the terms of the GNU Affero General Public License as | ||
605 | 10 | # published by the Free Software Foundation, either version 3 of the | ||
606 | 11 | # License, or (at your option) any later version. | ||
607 | 12 | # | ||
608 | 13 | # This program is distributed in the hope that it will be useful, | ||
609 | 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
610 | 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
611 | 16 | # GNU Affero General Public License for more details. | ||
612 | 17 | # | ||
613 | 18 | # You should have received a copy of the GNU Affero General Public License | ||
614 | 19 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
615 | 20 | # | ||
616 | 21 | ############################################################################## | ||
617 | 22 | {'name': 'Web Polymorphic', | ||
618 | 23 | 'version': '0.1', | ||
619 | 24 | 'category': 'Web', | ||
620 | 25 | 'depends': ['web'], | ||
621 | 26 | 'author': 'Elico Corp', | ||
622 | 27 | 'license': 'AGPL-3', | ||
623 | 28 | 'website': 'https://www.elico-corp.com', | ||
624 | 29 | 'description': """ | ||
625 | 30 | Add a new widget named "polymorphic" | ||
626 | 31 | The polymorphic field allow to dynamically store an id linked to any model in | ||
627 | 32 | OpenERP instead of the usual fixed one in the view definition | ||
628 | 33 | |||
629 | 34 | E.g: | ||
630 | 35 | |||
631 | 36 | <field name="model" invisible="1" /> | ||
632 | 37 | <field name="object_id" widget="polymorphic" polymorphic="model" /> | ||
633 | 38 | """, | ||
634 | 39 | 'js': [ | ||
635 | 40 | 'static/src/js/view_form.js' | ||
636 | 41 | ], | ||
637 | 42 | 'installable': True, | ||
638 | 43 | 'application': False} | ||
639 | 0 | 44 | ||
640 | === added directory 'web_polymorphic/static' | |||
641 | === added file 'web_polymorphic/static/.DS_Store' | |||
642 | 1 | Binary files web_polymorphic/static/.DS_Store 1970-01-01 00:00:00 +0000 and web_polymorphic/static/.DS_Store 2014-02-23 07:15:07 +0000 differ | 45 | Binary files web_polymorphic/static/.DS_Store 1970-01-01 00:00:00 +0000 and web_polymorphic/static/.DS_Store 2014-02-23 07:15:07 +0000 differ |
643 | === added directory 'web_polymorphic/static/src' | |||
644 | === added directory 'web_polymorphic/static/src/js' | |||
645 | === added file 'web_polymorphic/static/src/js/view_form.js' | |||
646 | --- web_polymorphic/static/src/js/view_form.js 1970-01-01 00:00:00 +0000 | |||
647 | +++ web_polymorphic/static/src/js/view_form.js 2014-02-23 07:15:07 +0000 | |||
648 | @@ -0,0 +1,47 @@ | |||
649 | 1 | /****************************************************************************** | ||
650 | 2 | * | ||
651 | 3 | * OpenERP, Open Source Management Solution | ||
652 | 4 | * Copyright (c) 2010-2014 Elico Corp. All Rights Reserved. | ||
653 | 5 | * Augustin Cisterne-Kaas <augustin.cisterne-kaas@elico-corp.com> | ||
654 | 6 | * | ||
655 | 7 | * This program is free software: you can redistribute it and/or modify | ||
656 | 8 | * it under the terms of the GNU Affero General Public License as | ||
657 | 9 | * published by the Free Software Foundation, either version 3 of the | ||
658 | 10 | * License, or (at your option) any later version. | ||
659 | 11 | * | ||
660 | 12 | * This program is distributed in the hope that it will be useful, | ||
661 | 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
662 | 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
663 | 15 | * GNU Affero General Public License for more details. | ||
664 | 16 | * | ||
665 | 17 | * You should have received a copy of the GNU Affero General Public License | ||
666 | 18 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
667 | 19 | * | ||
668 | 20 | ******************************************************************************/ | ||
669 | 21 | openerp.web_polymorphic = function (instance) { | ||
670 | 22 | instance.web.form.FieldPolymorphic = instance.web.form.FieldMany2One.extend( { | ||
671 | 23 | template: "FieldMany2One", | ||
672 | 24 | events: { | ||
673 | 25 | 'focus input': function(e) { | ||
674 | 26 | this.field.relation = this.field_manager.get_field_value(this.polymorphic); | ||
675 | 27 | }, | ||
676 | 28 | 'click input': function(e) { | ||
677 | 29 | this.field.relation = this.field_manager.get_field_value(this.polymorphic); | ||
678 | 30 | } | ||
679 | 31 | }, | ||
680 | 32 | init: function(field_manager, node) { | ||
681 | 33 | this._super(field_manager, node); | ||
682 | 34 | this.polymorphic = this.node.attrs.polymorphic; | ||
683 | 35 | }, | ||
684 | 36 | render_editable: function() { | ||
685 | 37 | var self = this; | ||
686 | 38 | this.$drop_down = this.$el.find(".oe_m2o_drop_down_button"); | ||
687 | 39 | this.$drop_down.click(function() { | ||
688 | 40 | self.polymorphic = self.node.attrs.polymorphic; | ||
689 | 41 | self.field.relation = self.field_manager.get_field_value(self.polymorphic); | ||
690 | 42 | }); | ||
691 | 43 | this._super(); | ||
692 | 44 | } | ||
693 | 45 | }); | ||
694 | 46 | instance.web.form.widgets.add('polymorphic', 'instance.web.form.FieldPolymorphic') | ||
695 | 47 | }; |