Merge lp:~openerp-dev/openobject-addons/trunk-idea-chatter-tde into lp:openobject-addons
- trunk-idea-chatter-tde
- Merge into trunk
Status: | Needs review |
---|---|
Proposed branch: | lp:~openerp-dev/openobject-addons/trunk-idea-chatter-tde |
Merge into: | lp:openobject-addons |
Diff against target: |
526 lines (+455/-3) 11 files modified
idea/doc/apply.txt (+23/-0) idea/doc/patch1_mailthread.txt (+29/-0) idea/doc/patch2_chatterkanban.txt (+29/-0) idea/doc/patch3_summarykanban.txt (+20/-0) idea/doc/patch4_needaction.txt (+38/-0) idea/doc/patch5_trackvisibility.txt (+28/-0) idea/doc/patch6_subtypes.txt (+50/-0) idea/doc/patch7_messagepost.txt (+34/-0) idea/doc/patch8_override_chatter.txt (+109/-0) idea/doc/patch9_alias.txt (+92/-0) idea/models/idea.py (+3/-3) |
To merge this branch: | bzr merge lp:~openerp-dev/openobject-addons/trunk-idea-chatter-tde |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
OpenERP Core Team | Pending | ||
Review via email: mp+171284@code.launchpad.net |
Commit message
[DOC] Idea: added patches files used for technical demonstration of OpenChatter.
The various patches are held in idea/doc. Applying them allow to gradually add the OpenChatter feature on the idea module. Those patches have been used for the Opendays 2013.
Description of the change
- 8793. By Launchpad Translations on behalf of openerp
-
Launchpad automatic translations update.
- 8794. By Thibault Delavallée (OpenERP)
-
[MERGE] [REF] mail_thread: message_track: now using a browse record instead of a read result. This is among other necessary to be able to use smarter conditions on subtypes, like using many2one fields.
Updated addons accordingly.
Updated tests for some corner cases using many2one fields. - 8795. By Denis Ledoux (OpenERP)
-
[REF]google_docs to google_drive, using oauth authentication
- 8796. By Launchpad Translations on behalf of openerp
-
Launchpad automatic translations update.
- 8797. By Antony Lesuisse (OpenERP)
-
[IMP] move html module description and icon
- 8798. By Launchpad Translations on behalf of openerp
-
Launchpad automatic translations update.
- 8799. By Launchpad Translations on behalf of openerp
-
Launchpad automatic translations update.
- 8800. By Martin Trigaux (OpenERP)
-
[MERGE] forward port of saas-1 up to revision 8749 (<email address hidden>)
- 8801. By Launchpad Translations on behalf of openerp
-
Launchpad automatic translations update.
- 8802. By Thibault Delavallée (OpenERP)
-
[FIX] auth_signup: refactoring to new framework introduced an authentification level to user for login; none seems to be required because the user is not authentified anymore.
- 8803. By Launchpad Translations on behalf of openerp
-
Launchpad automatic translations update.
- 8804. By Launchpad Translations on behalf of openerp
-
Launchpad automatic translations update.
- 8805. By Launchpad Translations on behalf of openerp
-
Launchpad automatic translations update.
- 8806. By Thibault Delavallée (OpenERP)
-
[REF] crm, crm_claim, crm_helpdek: removed inheritance from base_stage and first cleaning of stage/stage management.
Most of state update methods are removed (like case_cancel and case_reset). This is because we are moving towards removing state and the related methods where stage is already present. Also removed some dead tests about case update.
Some methods are added back from base_stage like case_escalate, to remove the inheritance.
[CLEAN] crm, crm_claim, crm_helpdesk: misc cleaning in modified files/methods about spaces and unused variables
[DOC] added doc directory + changelog
- 8807. By Thibault Delavallée (OpenERP)
-
[CLEAN] Idea: misc cleaning
- 8808. By Thibault Delavallée (OpenERP)
-
[ADD] IDea: added various files for openchatter integration demo
Unmerged revisions
- 8808. By Thibault Delavallée (OpenERP)
-
[ADD] IDea: added various files for openchatter integration demo
- 8807. By Thibault Delavallée (OpenERP)
-
[CLEAN] Idea: misc cleaning
Preview Diff
1 | === added directory 'idea/doc' |
2 | === added file 'idea/doc/apply.txt' |
3 | --- idea/doc/apply.txt 1970-01-01 00:00:00 +0000 |
4 | +++ idea/doc/apply.txt 2013-07-08 14:39:29 +0000 |
5 | @@ -0,0 +1,23 @@ |
6 | +bzr patch idea/doc/patch1_mailthread.txt |
7 | +bzr ci -m "[IMP] Patch1: added mail_thread inheritance + widgets" |
8 | + |
9 | +bzr patch idea/doc/patch2_chatterkanban.txt |
10 | +bzr ci -m "[IMP] Patch2: add chatter data in kanban view" |
11 | + |
12 | +bzr patch idea/doc/patch3_summarykanban.txt |
13 | +bzr ci -m "[IMP] Patch3: add summary in kanban view" |
14 | + |
15 | +bzr patch idea/doc/patch4_needaction.txt |
16 | +bzr ci -m "[IMP] Patch4: added ir_needactionmixin inheritance + unread filter" |
17 | + |
18 | +bzr patch idea/doc/patch5_trackvisibility.txt |
19 | +bzr ci -m "[IMP] Patch5: track user_id and state to automatically generate logs." |
20 | + |
21 | +bzr patch idea/doc/patch6_subtypes.txt |
22 | +bzr ci -m "[IMP] Patch6: add a subtype on messages about state changed and idea approved, using automatic tracking." |
23 | + |
24 | +bzr patch idea/doc/patch7_messagepost.txt |
25 | +bzr ci -m "[IMP] Patch7: add a message_post with a subtype" |
26 | + |
27 | +bzr patch idea/doc/patch8_override_chatter.txt |
28 | +bzr ci -m "[IMP] Patch8: override and add an action in OpenChatter" |
29 | |
30 | === added file 'idea/doc/patch1_mailthread.txt' |
31 | --- idea/doc/patch1_mailthread.txt 1970-01-01 00:00:00 +0000 |
32 | +++ idea/doc/patch1_mailthread.txt 2013-07-08 14:39:29 +0000 |
33 | @@ -0,0 +1,29 @@ |
34 | +=== modified file 'idea/models/idea.py' |
35 | +--- idea/models/idea.py 2013-06-25 11:11:10 +0000 |
36 | ++++ idea/models/idea.py 2013-06-28 08:56:24 +0000 |
37 | +@@ -43,6 +43,7 @@ |
38 | + """ Model of an Idea """ |
39 | + _name = 'idea.idea' |
40 | + _description = 'Idea' |
41 | ++ _inherit = ['mail.thread'] |
42 | + |
43 | + _rec_name = 'name' |
44 | + _order = 'name asc' |
45 | + |
46 | +=== modified file 'idea/views/idea.xml' |
47 | +--- idea/views/idea.xml 2013-06-25 11:15:08 +0000 |
48 | ++++ idea/views/idea.xml 2013-06-28 08:56:24 +0000 |
49 | +@@ -60,6 +60,12 @@ |
50 | + <field name="description"/> |
51 | + </group> |
52 | + </sheet> |
53 | ++ <div class="oe_chatter"> |
54 | ++ <field name="message_follower_ids" widget="mail_followers" |
55 | ++ groups="base.group_user"/> |
56 | ++ <field name="message_ids" widget="mail_thread" options='{"thread_level": 1}' |
57 | ++ placeholder="Share your thoughts about the idea"/> |
58 | ++ </div> |
59 | + </form> |
60 | + </field> |
61 | + </record> |
62 | + |
63 | |
64 | === added file 'idea/doc/patch2_chatterkanban.txt' |
65 | --- idea/doc/patch2_chatterkanban.txt 1970-01-01 00:00:00 +0000 |
66 | +++ idea/doc/patch2_chatterkanban.txt 2013-07-08 14:39:29 +0000 |
67 | @@ -0,0 +1,29 @@ |
68 | +=== modified file 'idea/views/idea.xml' |
69 | +--- idea/views/idea.xml 2013-06-28 09:10:25 +0000 |
70 | ++++ idea/views/idea.xml 2013-06-28 09:13:06 +0000 |
71 | +@@ -9,6 +9,8 @@ |
72 | + <kanban version="7.0" default_group_by="state" class="oe_background_grey"> |
73 | + <field name="color"/> |
74 | + <field name="user_id"/> |
75 | ++ <field name="message_follower_ids"/> |
76 | ++ <field name="message_ids"/> |
77 | + <templates> |
78 | + <t t-name="kanban-box"> |
79 | + <div t-attf-class="oe_kanban_card oe_kanban_color_#{kanban_getcolor(record.color.raw_value)} oe_kanban_idea_idea oe_kanban_global_click"> |
80 | +@@ -23,10 +25,14 @@ |
81 | + </div> |
82 | + <div class="oe_kanban_content"> |
83 | + <h4><field name="name"/></h4> |
84 | ++ <field name="category_ids"/> |
85 | + <div class="oe_kanban_bottom_right"> |
86 | + <img t-att-src="kanban_image('res.users', 'image_small', record.user_id.raw_value)" t-att-title="record.user_id.value" width="24" height="24" class="oe_kanban_avatar" t-if="record.user_id.value"/> |
87 | + </div> |
88 | +- <field name="category_ids"/> |
89 | ++ <div class="oe_kanban_footer_left"> |
90 | ++ <span title='Messages'><span class='oe_e'>9</span><t t-esc="record.message_ids.raw_value.length"/></span> |
91 | ++ <span title='Followers'><span class='oe_e'>+</span><t t-esc="record.message_follower_ids.raw_value.length"/></span> |
92 | ++ </div> |
93 | + </div> |
94 | + <div class="oe_clear"></div> |
95 | + </div> |
96 | + |
97 | |
98 | === added file 'idea/doc/patch3_summarykanban.txt' |
99 | --- idea/doc/patch3_summarykanban.txt 1970-01-01 00:00:00 +0000 |
100 | +++ idea/doc/patch3_summarykanban.txt 2013-07-08 14:39:29 +0000 |
101 | @@ -0,0 +1,20 @@ |
102 | +=== modified file 'idea/views/idea.xml' |
103 | +--- idea/views/idea.xml 2013-06-28 09:14:01 +0000 |
104 | ++++ idea/views/idea.xml 2013-06-28 09:14:05 +0000 |
105 | +@@ -11,6 +11,7 @@ |
106 | + <field name="user_id"/> |
107 | + <field name="message_follower_ids"/> |
108 | + <field name="message_ids"/> |
109 | ++ <field name="message_summary"/> |
110 | + <templates> |
111 | + <t t-name="kanban-box"> |
112 | + <div t-attf-class="oe_kanban_card oe_kanban_color_#{kanban_getcolor(record.color.raw_value)} oe_kanban_idea_idea oe_kanban_global_click"> |
113 | +@@ -30,6 +31,7 @@ |
114 | + <img t-att-src="kanban_image('res.users', 'image_small', record.user_id.raw_value)" t-att-title="record.user_id.value" width="24" height="24" class="oe_kanban_avatar" t-if="record.user_id.value"/> |
115 | + </div> |
116 | + <div class="oe_kanban_footer_left"> |
117 | ++ <t t-raw="record.message_summary.raw_value"/> |
118 | + <span title='Messages'><span class='oe_e'>9</span><t t-esc="record.message_ids.raw_value.length"/></span> |
119 | + <span title='Followers'><span class='oe_e'>+</span><t t-esc="record.message_follower_ids.raw_value.length"/></span> |
120 | + </div> |
121 | + |
122 | |
123 | === added file 'idea/doc/patch4_needaction.txt' |
124 | --- idea/doc/patch4_needaction.txt 1970-01-01 00:00:00 +0000 |
125 | +++ idea/doc/patch4_needaction.txt 2013-07-08 14:39:29 +0000 |
126 | @@ -0,0 +1,38 @@ |
127 | +=== modified file 'idea/models/idea.py' |
128 | +--- idea/models/idea.py 2013-06-28 09:29:18 +0000 |
129 | ++++ idea/models/idea.py 2013-06-28 09:32:31 +0000 |
130 | +@@ -43,7 +43,7 @@ |
131 | + """ Model of an Idea """ |
132 | + _name = 'idea.idea' |
133 | + _description = 'Idea' |
134 | +- _inherit = ['mail.thread'] |
135 | ++ _inherit = ['mail.thread', 'ir.needaction_mixin'] |
136 | + |
137 | + _rec_name = 'name' |
138 | + _order = 'name asc' |
139 | + |
140 | +=== modified file 'idea/views/idea.xml' |
141 | +--- idea/views/idea.xml 2013-06-28 09:31:32 +0000 |
142 | ++++ idea/views/idea.xml 2013-06-28 09:33:24 +0000 |
143 | +@@ -82,7 +82,9 @@ |
144 | + <field name="name">idea.idea.tree</field> |
145 | + <field name="model">idea.idea</field> |
146 | + <field name="arch" type="xml"> |
147 | +- <tree colors="blue:state == 'draft';black:state in ('open', 'close'); gray:state == 'cancel'" string="Ideas"> |
148 | ++ <tree string="Ideas" |
149 | ++ colors="blue:state == 'draft';black:state in ('open', 'close'); gray:state == 'cancel';" |
150 | ++ fonts="bold:message_unread==True"> |
151 | + <field name="name"/> |
152 | + <field name="user_id"/> |
153 | + <field name="priority"/> |
154 | +@@ -105,6 +107,9 @@ |
155 | + help="Open Ideas"/> |
156 | + <filter string="Accepted" domain="[('state','=', 'close')]" |
157 | + help="Accepted Ideas" /> |
158 | ++ <filter string="Unread Messages" name="message_unread" |
159 | ++ domain="[('message_unread','=',True)]" |
160 | ++ help="Unread messages"/> |
161 | + <group expand="0" string="Group By..."> |
162 | + <filter string="Creator" help="By Responsible" context="{'group_by': 'user_id'}"/> |
163 | + <filter string="Category" help="By Category" context="{'group_by': 'category_ids'}"/> |
164 | + |
165 | |
166 | === added file 'idea/doc/patch5_trackvisibility.txt' |
167 | --- idea/doc/patch5_trackvisibility.txt 1970-01-01 00:00:00 +0000 |
168 | +++ idea/doc/patch5_trackvisibility.txt 2013-07-08 14:39:29 +0000 |
169 | @@ -0,0 +1,28 @@ |
170 | +=== modified file 'idea/models/idea.py' |
171 | +--- idea/models/idea.py 2013-06-18 13:29:15 +0000 |
172 | ++++ idea/models/idea.py 2013-06-18 13:29:38 +0000 |
173 | +@@ -63,7 +63,8 @@ |
174 | + return res |
175 | + |
176 | + _columns = { |
177 | +- 'user_id': fields.many2one('res.users', 'Responsible', required=True), |
178 | ++ 'user_id': fields.many2one('res.users', 'Responsible', required=True, |
179 | ++ track_visibility='onchange'), |
180 | + 'name': fields.char('Summary', required=True, readonly=True, |
181 | + states={'draft': [('readonly', False)]}, |
182 | + oldname='title'), |
183 | +@@ -71,9 +72,11 @@ |
184 | + states={'draft': [('readonly', False)]}, |
185 | + help='Content of the idea'), |
186 | + 'category_ids': fields.many2many('idea.category', string='Tags'), |
187 | +- 'state': fields.selection(_get_state_list, string='Status', required=True), |
188 | ++ 'state': fields.selection(_get_state_list, string='Status', required=True, |
189 | ++ track_visibility='onchange'), |
190 | + 'priority': fields.selection([('low', 'Low'), ('normal', 'Normal'), ('high', 'High')], |
191 | +- string='Priority', required=True), |
192 | ++ string='Priority', required=True, |
193 | ++ track_visibility='always'), |
194 | + 'color': fields.function(_get_color, type='integer', string='Color Index'), |
195 | + } |
196 | + |
197 | + |
198 | |
199 | === added file 'idea/doc/patch6_subtypes.txt' |
200 | --- idea/doc/patch6_subtypes.txt 1970-01-01 00:00:00 +0000 |
201 | +++ idea/doc/patch6_subtypes.txt 2013-07-08 14:39:29 +0000 |
202 | @@ -0,0 +1,50 @@ |
203 | +=== modified file 'idea/data/idea.xml' |
204 | +--- idea/data/idea.xml 2013-06-18 13:23:19 +0000 |
205 | ++++ idea/data/idea.xml 2013-06-28 09:21:40 +0000 |
206 | +@@ -2,5 +2,25 @@ |
207 | + <openerp> |
208 | + <data> |
209 | + |
210 | ++ <!-- CRM-related subtypes for messaging / Chatter --> |
211 | ++ <record id="mt_state_change" model="mail.message.subtype"> |
212 | ++ <field name="name">State Changed</field> |
213 | ++ <field name="res_model">idea.idea</field> |
214 | ++ <field name="default" eval="False"/> |
215 | ++ <field name="description">State changed</field> |
216 | ++ </record> |
217 | ++ <record id="mt_state_approved" model="mail.message.subtype"> |
218 | ++ <field name="name">Idea Approved</field> |
219 | ++ <field name="res_model">idea.idea</field> |
220 | ++ <field name="default" eval="True"/> |
221 | ++ <field name="description">Idea approved</field> |
222 | ++ </record> |
223 | ++ <record id="mt_state_refused" model="mail.message.subtype"> |
224 | ++ <field name="name">Idea Refused</field> |
225 | ++ <field name="res_model">idea.idea</field> |
226 | ++ <field name="default" eval="True"/> |
227 | ++ <field name="description">Idea refused</field> |
228 | ++ </record> |
229 | ++ |
230 | + </data> |
231 | + </openerp> |
232 | +\ No newline at end of file |
233 | + |
234 | +=== modified file 'idea/models/idea.py' |
235 | +--- idea/models/idea.py 2013-06-28 09:19:23 +0000 |
236 | ++++ idea/models/idea.py 2013-06-28 09:22:22 +0000 |
237 | +@@ -48,6 +48,14 @@ |
238 | + _rec_name = 'name' |
239 | + _order = 'name asc' |
240 | + |
241 | ++ _track = { |
242 | ++ 'state': { |
243 | ++ 'idea.mt_state_approved': lambda self, cr, uid, obj, ctx=None: obj.state == 'close', |
244 | ++ 'idea.mt_state_refused': lambda self, cr, uid, obj, ctx=None: obj.state == 'cancel', |
245 | ++ 'idea.mt_state_change': lambda self, cr, uid, obj, ctx=None: obj.state not in ('close', 'cancel'), |
246 | ++ }, |
247 | ++ } |
248 | ++ |
249 | + def _get_state_list(self, cr, uid, context=None): |
250 | + return [('draft', 'New'), |
251 | + ('open', 'In discussion'), |
252 | + |
253 | |
254 | === added file 'idea/doc/patch7_messagepost.txt' |
255 | --- idea/doc/patch7_messagepost.txt 1970-01-01 00:00:00 +0000 |
256 | +++ idea/doc/patch7_messagepost.txt 2013-07-08 14:39:29 +0000 |
257 | @@ -0,0 +1,34 @@ |
258 | +=== modified file 'idea/data/idea.xml' |
259 | +--- idea/data/idea.xml 2013-06-28 09:36:00 +0000 |
260 | ++++ idea/data/idea.xml 2013-06-28 09:36:52 +0000 |
261 | +@@ -21,6 +21,11 @@ |
262 | + <field name="default" eval="True"/> |
263 | + <field name="description">Idea refused</field> |
264 | + </record> |
265 | ++ <record id="mt_priority_high" model="mail.message.subtype"> |
266 | ++ <field name="name">Priority High</field> |
267 | ++ <field name="res_model">idea.idea</field> |
268 | ++ <field name="description">Priority set to high</field> |
269 | ++ </record> |
270 | + |
271 | + </data> |
272 | + </openerp> |
273 | +\ No newline at end of file |
274 | + |
275 | +=== modified file 'idea/models/idea.py' |
276 | +--- idea/models/idea.py 2013-06-28 09:36:00 +0000 |
277 | ++++ idea/models/idea.py 2013-06-28 09:36:29 +0000 |
278 | +@@ -139,4 +139,11 @@ |
279 | + return self.write(cr, uid, ids, {'priority': 'normal'}, context=context) |
280 | + |
281 | + def idea_set_high_priority(self, cr, uid, ids, context=None): |
282 | +- return self.write(cr, uid, ids, {'priority': 'high'}, context=context) |
283 | ++ res = self.write(cr, uid, ids, {'priority': 'high'}, context=context) |
284 | ++ # congratulate the idea responsible |
285 | ++ for idea in self.browse(cr, uid, ids, context=context): |
286 | ++ self.message_post(cr, uid, ids, body='Your idea has been set as high priority. Congratulations!', |
287 | ++ subtype='idea.mt_priority_high', |
288 | ++ partner_ids=[idea.user_id.partner_id.id], |
289 | ++ context=context) |
290 | ++ return res |
291 | + |
292 | |
293 | === added file 'idea/doc/patch8_override_chatter.txt' |
294 | --- idea/doc/patch8_override_chatter.txt 1970-01-01 00:00:00 +0000 |
295 | +++ idea/doc/patch8_override_chatter.txt 2013-07-08 14:39:29 +0000 |
296 | @@ -0,0 +1,109 @@ |
297 | +=== modified file 'idea/__openerp__.py' |
298 | +--- idea/__openerp__.py 2013-06-25 11:11:10 +0000 |
299 | ++++ idea/__openerp__.py 2013-06-28 10:55:06 +0000 |
300 | +@@ -53,8 +53,12 @@ |
301 | + 'css': [ |
302 | + 'static/src/css/idea_idea.css', |
303 | + ], |
304 | +- 'js': [], |
305 | +- 'qweb': [], |
306 | ++ 'js': [ |
307 | ++ 'static/src/js/mail.js', |
308 | ++ ], |
309 | ++ 'qweb': [ |
310 | ++ 'static/src/xml/mail.xml', |
311 | ++ ], |
312 | + } |
313 | + |
314 | + # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
315 | + |
316 | +=== modified file 'idea/models/idea.py' |
317 | +--- idea/models/idea.py 2013-06-28 09:39:33 +0000 |
318 | ++++ idea/models/idea.py 2013-06-28 10:45:33 +0000 |
319 | +@@ -21,7 +21,7 @@ |
320 | + |
321 | + from openerp.osv import osv |
322 | + from openerp.osv import fields |
323 | +- |
324 | ++from openerp.tools.translate import _ |
325 | + |
326 | + class IdeaCategory(osv.Model): |
327 | + """ Category of Idea """ |
328 | +@@ -147,3 +147,20 @@ |
329 | + partner_ids=[idea.user_id.partner_id.id], |
330 | + context=context) |
331 | + return res |
332 | ++ |
333 | ++ def create_from_message(self, cr, uid, message_ids, context=None): |
334 | ++ idea_ids = list() |
335 | ++ for msg in self.pool.get('mail.message').browse(cr, uid, message_ids, context=context): |
336 | ++ idea_ids.append(self.create(cr, uid, { |
337 | ++ 'name': msg.subject or 'Idea from Message %d' % msg.id, |
338 | ++ 'user_id': uid, |
339 | ++ 'description': msg.body, |
340 | ++ }, context=context)) |
341 | ++ return {'type': 'ir.actions.act_window', |
342 | ++ 'name': _('Ideas'), |
343 | ++ 'view_type': 'kanban', |
344 | ++ 'view_mode': 'kanban,form,tree', |
345 | ++ 'views': [(False, 'kanban'), (False, 'form'), (False, 'tree')], |
346 | ++ 'res_model': 'idea.idea', |
347 | ++ 'domain': [('id', 'in', idea_ids)], |
348 | ++ } |
349 | + |
350 | +=== added directory 'idea/static/src/js' |
351 | +=== added file 'idea/static/src/js/mail.js' |
352 | +--- idea/static/src/js/mail.js 1970-01-01 00:00:00 +0000 |
353 | ++++ idea/static/src/js/mail.js 2013-06-28 10:45:56 +0000 |
354 | +@@ -0,0 +1,34 @@ |
355 | ++openerp.idea = function (session) { |
356 | ++ var _t = session.web._t, |
357 | ++ _lt = session.web._lt; |
358 | ++ |
359 | ++ var mail = session.mail; |
360 | ++ |
361 | ++ /** |
362 | ++ * ------------------------------------------------------------ |
363 | ++ * ThreadMessage extension |
364 | ++ * ------------------------------------------------------------ |
365 | ++ * |
366 | ++ * Add support of idea creation directly using messages |
367 | ++ */ |
368 | ++ |
369 | ++ mail.ThreadMessage = mail.ThreadMessage.extend({ |
370 | ++ |
371 | ++ bind_events: function () { |
372 | ++ this._super.apply(this, arguments); |
373 | ++ var self = this; |
374 | ++ this.$('.oe_create_idea').on('click', self.on_create_idea); |
375 | ++ this.ds_idea = new session.web.DataSetSearch(this, 'idea.idea'); |
376 | ++ }, |
377 | ++ |
378 | ++ on_create_idea: function (event) { |
379 | ++ console.log(event, self); |
380 | ++ var self = this; |
381 | ++ this.ds_idea.call('create_from_message', [[self.id]]) |
382 | ++ .then(function (action) { |
383 | ++ session.client.action_manager.do_action(action); |
384 | ++ }); |
385 | ++ return false; |
386 | ++ }, |
387 | ++ }); |
388 | ++}; |
389 | + |
390 | +=== added directory 'idea/static/src/xml' |
391 | +=== added file 'idea/static/src/xml/mail.xml' |
392 | +--- idea/static/src/xml/mail.xml 1970-01-01 00:00:00 +0000 |
393 | ++++ idea/static/src/xml/mail.xml 2013-06-28 10:29:11 +0000 |
394 | +@@ -0,0 +1,10 @@ |
395 | ++<?xml version="1.0" encoding="UTF-8"?> |
396 | ++<template> |
397 | ++ |
398 | ++ <t t-extend="mail.thread.message"> |
399 | ++ <t t-jquery="div.oe_msg_icons" t-operation="append"> |
400 | ++ <span class='oe_create_idea'><a title="Create Idea" class="oe_e">_</a></span> |
401 | ++ </t> |
402 | ++ </t> |
403 | ++ |
404 | ++</template> |
405 | + |
406 | |
407 | === added file 'idea/doc/patch9_alias.txt' |
408 | --- idea/doc/patch9_alias.txt 1970-01-01 00:00:00 +0000 |
409 | +++ idea/doc/patch9_alias.txt 2013-07-08 14:39:29 +0000 |
410 | @@ -0,0 +1,92 @@ |
411 | +=== modified file 'idea/models/idea.py' |
412 | +--- idea/models/idea.py 2013-07-04 09:22:52 +0000 |
413 | ++++ idea/models/idea.py 2013-07-04 10:50:21 +0000 |
414 | +@@ -21,23 +21,43 @@ |
415 | + |
416 | + from openerp.osv import osv |
417 | + from openerp.osv import fields |
418 | ++from openerp.tools import html2plaintext |
419 | + from openerp.tools.translate import _ |
420 | + |
421 | + class IdeaCategory(osv.Model): |
422 | + """ Category of Idea """ |
423 | + _name = "idea.category" |
424 | + _description = "Idea Category" |
425 | ++ _inherits = {'mail.alias': 'alias_id'} |
426 | + |
427 | + _order = 'name asc' |
428 | + |
429 | + _columns = { |
430 | + 'name': fields.char('Category Name', size=64, required=True), |
431 | ++ 'alias_id': fields.many2one('mail.alias', 'Alias', ondelete="set null", required=True, |
432 | ++ help="The email address associated with this category. New emails\n" |
433 | ++ "received will automatically create new ideas."), |
434 | + } |
435 | + |
436 | + _sql_constraints = [ |
437 | + ('name', 'unique(name)', 'The name of the category must be unique') |
438 | + ] |
439 | + |
440 | ++ def create(self, cr, uid, values, context=None): |
441 | ++ # Add alias info: aliased model, parent model |
442 | ++ create_context = dict(context, |
443 | ++ alias_model_name='idea.idea', |
444 | ++ alias_parent_model_name=self._name) |
445 | ++ new_id = super(IdeaCategory, self).create(cr, uid, values, context=create_context) |
446 | ++ |
447 | ++ # Update the newly-created alias |
448 | ++ new_category = self.browse(cr, uid, new_id, context=context) |
449 | ++ self.pool.get('mail.alias').write(cr, uid, [new_category.alias_id.id], { |
450 | ++ 'alias_parent_thread_id': new_id, |
451 | ++ 'alias_defaults': {'category_ids': [(6, 0, [new_id])]} |
452 | ++ }, context=context) |
453 | ++ return new_id |
454 | ++ |
455 | + |
456 | + class IdeaIdea(osv.Model): |
457 | + """ Model of an Idea """ |
458 | +@@ -164,3 +184,14 @@ |
459 | + 'res_model': 'idea.idea', |
460 | + 'domain': [('id', 'in', idea_ids)], |
461 | + } |
462 | ++ |
463 | ++ #------------------------------------------------------ |
464 | ++ # Mailgateway |
465 | ++ #-------------------------------------------------- |
466 | ++ |
467 | ++ def message_new(self, cr, uid, msg, custom_values=None, context=None): |
468 | ++ # Update description |
469 | ++ if not 'description' in custom_values: |
470 | ++ custom_values['description'] = html2plaintext(msg.get('body')) if msg.get('body') else 'Not found' |
471 | ++ |
472 | ++ return super(IdeaIdea, self).message_new(cr, uid, msg, custom_values, context=context) |
473 | + |
474 | +=== modified file 'idea/views/category.xml' |
475 | +--- idea/views/category.xml 2013-06-18 10:16:21 +0000 |
476 | ++++ idea/views/category.xml 2013-07-04 10:29:29 +0000 |
477 | +@@ -20,9 +20,24 @@ |
478 | + <field name="model">idea.category</field> |
479 | + <field name="arch" type="xml"> |
480 | + <form string="Category of Ideas" version="7.0"> |
481 | ++ <sheet> |
482 | + <group> |
483 | + <field name="name"/> |
484 | ++ <label for="alias_name" string="Email Alias" |
485 | ++ attrs="{'invisible': [('alias_domain', '=', False)]}"/> |
486 | ++ <div name="alias_def" |
487 | ++ attrs="{'invisible': [('alias_domain', '=', False)]}"> |
488 | ++ <field name="alias_id" class="oe_read_only oe_inline" |
489 | ++ string="Email Alias" required="0"/> |
490 | ++ <div class="oe_edit_only oe_inline" name="edit_alias" style="display: inline;" > |
491 | ++ <field name="alias_name" class="oe_inline"/>@<field name="alias_domain" class="oe_inline" readonly="1"/> |
492 | ++ </div> |
493 | ++ </div> |
494 | ++ <field name="alias_contact" class="oe_inline" |
495 | ++ string="Accept Emails From" |
496 | ++ attrs="{'invisible': [('alias_domain', '=', False)]}"/> |
497 | + </group> |
498 | ++ </sheet> |
499 | + </form> |
500 | + </field> |
501 | + </record> |
502 | + |
503 | |
504 | === modified file 'idea/models/idea.py' |
505 | --- idea/models/idea.py 2013-06-25 11:11:10 +0000 |
506 | +++ idea/models/idea.py 2013-07-08 14:39:29 +0000 |
507 | @@ -42,7 +42,7 @@ |
508 | class IdeaIdea(osv.Model): |
509 | """ Model of an Idea """ |
510 | _name = 'idea.idea' |
511 | - _description = 'Propose and Share your Ideas' |
512 | + _description = 'Idea' |
513 | |
514 | _rec_name = 'name' |
515 | _order = 'name asc' |
516 | @@ -123,8 +123,8 @@ |
517 | def idea_set_low_priority(self, cr, uid, ids, context=None): |
518 | return self.write(cr, uid, ids, {'priority': 'low'}, context=context) |
519 | |
520 | - def idea_set_normal_priority(self, cr, uid, ids, context={}): |
521 | + def idea_set_normal_priority(self, cr, uid, ids, context=None): |
522 | return self.write(cr, uid, ids, {'priority': 'normal'}, context=context) |
523 | |
524 | - def idea_set_high_priority(self, cr, uid, ids, context={}): |
525 | + def idea_set_high_priority(self, cr, uid, ids, context=None): |
526 | return self.write(cr, uid, ids, {'priority': 'high'}, context=context) |