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

Proposed by Julio Serna-http://www.vauxoo.com
Status: Merged
Merged at revision: 1082
Proposed branch: lp:~vauxoo/addons-vauxoo/7.0-addons-vauxoo-email_template_followers-dev-julio
Merge into: lp:addons-vauxoo/7.0
Diff against target: 256 lines (+219/-0)
7 files modified
email_template_followers/__init__.py (+24/-0)
email_template_followers/__openerp__.py (+41/-0)
email_template_followers/model/__init__.py (+25/-0)
email_template_followers/model/email_template.py (+37/-0)
email_template_followers/model/mail_compose_message.py (+55/-0)
email_template_followers/view/email_template_view.xml (+17/-0)
email_template_followers/view/mail_compose_message_view.xml (+20/-0)
To merge this branch: bzr merge lp:~vauxoo/addons-vauxoo/7.0-addons-vauxoo-email_template_followers-dev-julio
Reviewer Review Type Date Requested Status
Julio Serna-http://www.vauxoo.com Needs Resubmitting
Moisés López - http://www.vauxoo.com Pending
Review via email: mp+225695@code.launchpad.net

Description of the change

added field in email template to get followers by default in email_from from template

To post a comment you must log in.
1074. By Julio Serna-http://www.vauxoo.com

[MERGE]

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

[IMP]added by default true in field add_followers in template

Revision history for this message
Julio Serna-http://www.vauxoo.com (hearthebreaker) wrote :

added default in field add_followers in template

review: Needs Resubmitting

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added directory 'email_template_followers'
2=== added file 'email_template_followers/__init__.py'
3--- email_template_followers/__init__.py 1970-01-01 00:00:00 +0000
4+++ email_template_followers/__init__.py 2014-07-14 19:25:34 +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 'email_template_followers/__openerp__.py'
32--- email_template_followers/__openerp__.py 1970-01-01 00:00:00 +0000
33+++ email_template_followers/__openerp__.py 2014-07-14 19:25:34 +0000
34@@ -0,0 +1,41 @@
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' : 'Email template Followers',
59+ 'version' : '1.1',
60+ "website": "http://vauxoo.com",
61+ "category": "Addons Vauxoo",
62+ 'author' : 'Vauxoo',
63+ 'description' : """
64+Added field boolean to allow send email all followers from template
65+ """,
66+ 'depends' : ['mail','email_template'],
67+ 'data': [
68+ 'view/email_template_view.xml',
69+ 'view/mail_compose_message_view.xml',
70+ ],
71+ "active": False,
72+ "installable": True,
73+}
74+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
75+
76
77=== added directory 'email_template_followers/model'
78=== added file 'email_template_followers/model/__init__.py'
79--- email_template_followers/model/__init__.py 1970-01-01 00:00:00 +0000
80+++ email_template_followers/model/__init__.py 2014-07-14 19:25:34 +0000
81@@ -0,0 +1,25 @@
82+#!/usr/bin/python
83+# -*- encoding: utf-8 -*-
84+###########################################################################
85+# Module Writen to OpenERP, Open Source Management Solution
86+# Copyright (C) 2013 Vauxoo (<http://vauxoo.com>).
87+# All Rights Reserved
88+###############Credits######################################################
89+# Coded by: vauxoo consultores (info@vauxoo.com)
90+#############################################################################
91+# This program is free software: you can redistribute it and/or modify
92+# it under the terms of the GNU Affero General Public License as published by
93+# the Free Software Foundation, either version 3 of the License, or
94+# (at your option) any later version.
95+#
96+# This program is distributed in the hope that it will be useful,
97+# but WITHOUT ANY WARRANTY; without even the implied warranty of
98+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
99+# GNU Affero General Public License for more details.
100+#
101+# You should have received a copy of the GNU Affero General Public License
102+# along with this program. If not, see <http://www.gnu.org/licenses/>.
103+################################################################################
104+
105+import mail_compose_message
106+import email_template
107
108=== added file 'email_template_followers/model/email_template.py'
109--- email_template_followers/model/email_template.py 1970-01-01 00:00:00 +0000
110+++ email_template_followers/model/email_template.py 2014-07-14 19:25:34 +0000
111@@ -0,0 +1,37 @@
112+#!/usr/bin/python
113+# -*- encoding: utf-8 -*-
114+###########################################################################
115+# Module Writen to OpenERP, Open Source Management Solution
116+# Copyright (C) 2013 Vauxoo (<http://vauxoo.com>).
117+# All Rights Reserved
118+###############Credits######################################################
119+# Coded by: vauxoo consultores (info@vauxoo.com)
120+#############################################################################
121+# This program is free software: you can redistribute it and/or modify
122+# it under the terms of the GNU Affero General Public License as published by
123+# the Free Software Foundation, either version 3 of the License, or
124+# (at your option) any later version.
125+#
126+# This program is distributed in the hope that it will be useful,
127+# but WITHOUT ANY WARRANTY; without even the implied warranty of
128+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
129+# GNU Affero General Public License for more details.
130+#
131+# You should have received a copy of the GNU Affero General Public License
132+# along with this program. If not, see <http://www.gnu.org/licenses/>.
133+################################################################################
134+
135+
136+from openerp.osv import osv, fields
137+
138+class email_template(osv.Model):
139+
140+ _inherit = "email.template"
141+
142+ _columns = {
143+ 'add_followers': fields.boolean('Add Followers', help='Choice to add followers in template')
144+ }
145+
146+ _defaults = {
147+ 'add_followers': True
148+ }
149
150=== added file 'email_template_followers/model/mail_compose_message.py'
151--- email_template_followers/model/mail_compose_message.py 1970-01-01 00:00:00 +0000
152+++ email_template_followers/model/mail_compose_message.py 2014-07-14 19:25:34 +0000
153@@ -0,0 +1,55 @@
154+#!/usr/bin/python
155+# -*- encoding: utf-8 -*-
156+###########################################################################
157+# Module Writen to OpenERP, Open Source Management Solution
158+# Copyright (C) 2013 Vauxoo (<http://vauxoo.com>).
159+# All Rights Reserved
160+###############Credits######################################################
161+# Coded by: vauxoo consultores (info@vauxoo.com)
162+#############################################################################
163+# This program is free software: you can redistribute it and/or modify
164+# it under the terms of the GNU Affero General Public License as published by
165+# the Free Software Foundation, either version 3 of the License, or
166+# (at your option) any later version.
167+#
168+# This program is distributed in the hope that it will be useful,
169+# but WITHOUT ANY WARRANTY; without even the implied warranty of
170+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
171+# GNU Affero General Public License for more details.
172+#
173+# You should have received a copy of the GNU Affero General Public License
174+# along with this program. If not, see <http://www.gnu.org/licenses/>.
175+################################################################################
176+
177+
178+from openerp.osv import osv, fields
179+from openerp import tools, SUPERUSER_ID
180+
181+class mail_compose_message(osv.TransientModel):
182+
183+ _inherit = 'mail.compose.message'
184+
185+ def generate_email_for_composer(self, cr, uid, template_id, res_id, context=None):
186+
187+ values = super(mail_compose_message, self).generate_email_for_composer(cr, uid,
188+ template_id, res_id, context=context)
189+
190+ email_template_obj = self.pool.get('email.template')
191+
192+ email_template = email_template_obj.browse(cr, uid, template_id, context=context)
193+ if values.get('partner_ids', False) and email_template.add_followers:
194+ partners_to_notify = set([])
195+ partner_follower = self.pool.get('mail.followers')
196+
197+ fol_ids = partner_follower.search(cr, SUPERUSER_ID, [
198+ ('res_model', '=', context.get('active_model')),
199+ ('res_id', '=', context.get('active_id')),
200+ ], context=context)
201+
202+ partners_to_notify |= set(fo.partner_id.id\
203+ for fo in partner_follower.browse(cr, SUPERUSER_ID, fol_ids, context=context))
204+
205+ partners_followers_notify = values.get('partner_ids', []) + list(partners_to_notify)
206+ values.update({'partner_ids': list(set(partners_followers_notify))})
207+ return values
208+
209
210=== added directory 'email_template_followers/view'
211=== added file 'email_template_followers/view/email_template_view.xml'
212--- email_template_followers/view/email_template_view.xml 1970-01-01 00:00:00 +0000
213+++ email_template_followers/view/email_template_view.xml 2014-07-14 19:25:34 +0000
214@@ -0,0 +1,17 @@
215+<?xml version="1.0" encoding="utf-8"?>
216+<openerp>
217+ <data>
218+
219+ <record model="ir.ui.view" id="add_followers_email_template_form">
220+ <field name="name">add.followers.email.template</field>
221+ <field name="model">email.template</field>
222+ <field name="inherit_id" ref="email_template.email_template_form"/>
223+ <field name="arch" type="xml">
224+ <xpath expr="//field[@name='lang']" position="after">
225+ <field name="add_followers"/>
226+ </xpath>
227+ </field>
228+ </record>
229+
230+ </data>
231+</openerp>
232
233=== added file 'email_template_followers/view/mail_compose_message_view.xml'
234--- email_template_followers/view/mail_compose_message_view.xml 1970-01-01 00:00:00 +0000
235+++ email_template_followers/view/mail_compose_message_view.xml 2014-07-14 19:25:34 +0000
236@@ -0,0 +1,20 @@
237+<?xml version="1.0" encoding="utf-8"?>
238+<openerp>
239+ <data>
240+
241+ <record model="ir.ui.view" id="email_compose_message_wizard_form_inherit02">
242+ <field name="name">email.compose.message.wizard.form.inherit02</field>
243+ <field name="model">mail.compose.message</field>
244+ <field name="inherit_id" ref="mail.email_compose_message_wizard_form"/>
245+ <field name="arch" type="xml">
246+ <xpath expr="//div[@groups='base.group_user']" position="replace">
247+ <div groups="base.group_user" invisible="context.get('mail_compose_log', False)">
248+ <field name="partner_ids" widget="many2many_tags_email" placeholder="Add contacts to notify..."
249+ context="{'force_email':True, 'show_email':True}"/>
250+ </div>
251+ </xpath>
252+ </field>
253+ </record>
254+
255+ </data>
256+</openerp>