Merge lp:~vauxoo/addons-vauxoo/7.0-addons-vauxoo-send_email_add_follower-dev-julio into lp:addons-vauxoo/7.0

Proposed by Julio Serna-http://www.vauxoo.com
Status: Needs review
Proposed branch: lp:~vauxoo/addons-vauxoo/7.0-addons-vauxoo-send_email_add_follower-dev-julio
Merge into: lp:addons-vauxoo/7.0
Diff against target: 170 lines (+149/-0)
4 files modified
send_mail_add_follower/__init__.py (+24/-0)
send_mail_add_follower/__openerp__.py (+37/-0)
send_mail_add_follower/model/__init__.py (+24/-0)
send_mail_add_follower/model/mail_thread.py (+64/-0)
To merge this branch: bzr merge lp:~vauxoo/addons-vauxoo/7.0-addons-vauxoo-send_email_add_follower-dev-julio
Reviewer Review Type Date Requested Status
Moisés López - http://www.vauxoo.com Pending
Julio Serna-http://www.vauxoo.com Pending
Review via email: mp+217470@code.launchpad.net

Description of the change

added follower to project.task when send emial with cc or to one email that not exits like follower in task

To post a comment you must log in.
1008. By Luis Torres - http://www.vauxoo.com

[IMP][send_mail_add_follower]Added generic format in module

Unmerged revisions

1008. By Luis Torres - http://www.vauxoo.com

[IMP][send_mail_add_follower]Added generic format in module

1007. By Julio Serna-http://www.vauxoo.com

[IMP] searching email in to and cc

1006. By Julio Serna-http://www.vauxoo.com

[IMP] removed print

1005. By Julio Serna-http://www.vauxoo.com

[ADD] added module send_mail_add_follower

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added directory 'send_mail_add_follower'
2=== added file 'send_mail_add_follower/__init__.py'
3--- send_mail_add_follower/__init__.py 1970-01-01 00:00:00 +0000
4+++ send_mail_add_follower/__init__.py 2014-08-05 22:54:51 +0000
5@@ -0,0 +1,24 @@
6+#!/usr/bin/python
7+# -*- encoding: utf-8 -*-
8+###########################################################################
9+# Module Writen to OpenERP, Open Source Management Solution
10+# Copyright (C) 2013 Vauxoo (<http://vauxoo.com>).
11+# All Rights Reserved
12+###############Credits######################################################
13+# Coded by: vauxoo consultores (info@vauxoo.com)
14+#############################################################################
15+# This program is free software: you can redistribute it and/or modify
16+# it under the terms of the GNU Affero General Public License as published by
17+# the Free Software Foundation, either version 3 of the License, or
18+# (at your option) any later version.
19+#
20+# This program is distributed in the hope that it will be useful,
21+# but WITHOUT ANY WARRANTY; without even the implied warranty of
22+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23+# GNU Affero General Public License for more details.
24+#
25+# You should have received a copy of the GNU Affero General Public License
26+# along with this program. If not, see <http://www.gnu.org/licenses/>.
27+################################################################################
28+
29+import model
30
31=== added file 'send_mail_add_follower/__openerp__.py'
32--- send_mail_add_follower/__openerp__.py 1970-01-01 00:00:00 +0000
33+++ send_mail_add_follower/__openerp__.py 2014-08-05 22:54:51 +0000
34@@ -0,0 +1,37 @@
35+#!/usr/bin/python
36+# -*- encoding: utf-8 -*-
37+###########################################################################
38+# Module Writen to OpenERP, Open Source Management Solution
39+# Copyright (C) 2013 Vauxoo (<http://vauxoo.com>).
40+# All Rights Reserved
41+###############Credits######################################################
42+# Coded by: vauxoo consultores (info@vauxoo.com)
43+#############################################################################
44+# This program is free software: you can redistribute it and/or modify
45+# it under the terms of the GNU Affero General Public License as published by
46+# the Free Software Foundation, either version 3 of the License, or
47+# (at your option) any later version.
48+#
49+# This program is distributed in the hope that it will be useful,
50+# but WITHOUT ANY WARRANTY; without even the implied warranty of
51+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
52+# GNU Affero General Public License for more details.
53+#
54+# You should have received a copy of the GNU Affero General Public License
55+# along with this program. If not, see <http://www.gnu.org/licenses/>.
56+################################################################################
57+{
58+ 'name' : 'Send email and add follower',
59+ 'version' : '1.1',
60+ "website": "http://vauxoo.com",
61+ "category": "Addons Vauxoo",
62+ 'author' : 'Vauxoo',
63+ 'description' : """
64+When you received email of the instance OpenERP(project.task) and responde adding new email in to or cc, automaticly add the partner like follower if not exist
65+ """,
66+ 'depends' : ['mail'],
67+ "active": False,
68+ "installable": True,
69+}
70+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
71+
72
73=== added directory 'send_mail_add_follower/model'
74=== added file 'send_mail_add_follower/model/__init__.py'
75--- send_mail_add_follower/model/__init__.py 1970-01-01 00:00:00 +0000
76+++ send_mail_add_follower/model/__init__.py 2014-08-05 22:54:51 +0000
77@@ -0,0 +1,24 @@
78+#!/usr/bin/python
79+# -*- encoding: utf-8 -*-
80+###########################################################################
81+# Module Writen to OpenERP, Open Source Management Solution
82+# Copyright (C) 2013 Vauxoo (<http://vauxoo.com>).
83+# All Rights Reserved
84+###############Credits######################################################
85+# Coded by: vauxoo consultores (info@vauxoo.com)
86+#############################################################################
87+# This program is free software: you can redistribute it and/or modify
88+# it under the terms of the GNU Affero General Public License as published by
89+# the Free Software Foundation, either version 3 of the License, or
90+# (at your option) any later version.
91+#
92+# This program is distributed in the hope that it will be useful,
93+# but WITHOUT ANY WARRANTY; without even the implied warranty of
94+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
95+# GNU Affero General Public License for more details.
96+#
97+# You should have received a copy of the GNU Affero General Public License
98+# along with this program. If not, see <http://www.gnu.org/licenses/>.
99+################################################################################
100+
101+import mail_thread
102
103=== added file 'send_mail_add_follower/model/mail_thread.py'
104--- send_mail_add_follower/model/mail_thread.py 1970-01-01 00:00:00 +0000
105+++ send_mail_add_follower/model/mail_thread.py 2014-08-05 22:54:51 +0000
106@@ -0,0 +1,64 @@
107+#!/usr/bin/python
108+# -*- encoding: utf-8 -*-
109+###########################################################################
110+# Module Writen to OpenERP, Open Source Management Solution
111+# Copyright (C) 2013 Vauxoo (<http://vauxoo.com>).
112+# All Rights Reserved
113+###############Credits######################################################
114+# Coded by: vauxoo consultores (info@vauxoo.com)
115+#############################################################################
116+# This program is free software: you can redistribute it and/or modify
117+# it under the terms of the GNU Affero General Public License as published by
118+# the Free Software Foundation, either version 3 of the License, or
119+# (at your option) any later version.
120+#
121+# This program is distributed in the hope that it will be useful,
122+# but WITHOUT ANY WARRANTY; without even the implied warranty of
123+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
124+# GNU Affero General Public License for more details.
125+#
126+# You should have received a copy of the GNU Affero General Public License
127+# along with this program. If not, see <http://www.gnu.org/licenses/>.
128+################################################################################
129+
130+
131+from openerp.osv import osv, fields
132+from openerp import tools
133+import xmlrpclib
134+import email
135+
136+class mail_thread(osv.Model):
137+
138+ _inherit = 'mail.thread'
139+
140+ def message_process(self, cr, uid, model, message, custom_values=None,
141+ save_original=False, strip_attachments=False,
142+ thread_id=None, context=None):
143+
144+ thread_id = super(mail_thread, self).message_process(cr, uid, model,
145+ message, custom_values=custom_values, save_original=save_original,
146+ strip_attachments=strip_attachments, thread_id=thread_id, context=thread_id)
147+
148+ if isinstance(message, xmlrpclib.Binary):
149+ message = str(message.data)
150+ if isinstance(message, unicode):
151+ message = message.encode('utf-8')
152+ msg_txt = email.message_from_string(message)
153+
154+ msg = self.message_parse(cr, uid, msg_txt, save_original=save_original, context=context)
155+
156+ email_address_to = [email_address for email_address in tools.email_split(msg.get('to'))]
157+ email_address_cc = [email_address for email_address in tools.email_split(msg.get('cc'))]
158+
159+ for email_address_to_cc in email_address_to+email_address_cc:
160+ related_partners = self._message_find_partners(cr, uid, msg_txt,
161+ header_fields=['to', 'cc'], context=context)
162+ routes = self.message_route(cr, uid, msg_txt, model, thread_id, custom_values,
163+ context=context)
164+ for model, thread_id, custom_values, user_id in routes:
165+ self.pool.get(model).message_subscribe(cr, uid,
166+ [thread_id], related_partners, context=context)
167+ return thread_id
168+
169+
170+