Merge lp:~vauxoo/addons-vauxoo/7.0-add_project_followers_rule-dev_ernesto into lp:addons-vauxoo/7.0

Status: Merged
Merged at revision: 1050
Proposed branch: lp:~vauxoo/addons-vauxoo/7.0-add_project_followers_rule-dev_ernesto
Merge into: lp:addons-vauxoo/7.0
Diff against target: 303 lines (+254/-0)
9 files modified
project_followers_rule/__init__.py (+26/-0)
project_followers_rule/__openerp__.py (+49/-0)
project_followers_rule/data/ir_rule_project_data.xml (+17/-0)
project_followers_rule/i18n/es_MX.po (+21/-0)
project_followers_rule/i18n/es_VE.po (+21/-0)
project_followers_rule/i18n/project_followers_rule.pot (+21/-0)
project_followers_rule/model/__init__.py (+28/-0)
project_followers_rule/model/project.py (+56/-0)
project_followers_rule/view/project_project_view.xml (+15/-0)
To merge this branch: bzr merge lp:~vauxoo/addons-vauxoo/7.0-add_project_followers_rule-dev_ernesto
Reviewer Review Type Date Requested Status
Luis Ernesto García Medina - http://www.vauxoo.com Needs Resubmitting
Julio Serna-http://www.vauxoo.com Pending
Review via email: mp+219922@code.launchpad.net

Description of the change

Julio agrego el modulo de project_followers_rule, este agrega un campo function que saca los seguidores de las tareas de los proyectos, la regla de registro checa si el partner del usuario conectado y ve si esta entre los seguidores del las tareas del proyecto

To post a comment you must log in.
1020. By Luis Ernesto García Medina - http://www.vauxoo.com

[REF][project_followers_rule] applied autopep8

1021. By Luis Ernesto García Medina - http://www.vauxoo.com

[REF][project_followers_rule] changes in variable names

Revision history for this message
Luis Ernesto García Medina - http://www.vauxoo.com (ernesto-gm) wrote :

Se aplico autopep8 y se cambiaron nombres de algunas variables

review: Needs Resubmitting

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added directory 'project_followers_rule'
2=== added file 'project_followers_rule/__init__.py'
3--- project_followers_rule/__init__.py 1970-01-01 00:00:00 +0000
4+++ project_followers_rule/__init__.py 2014-05-16 23:29:47 +0000
5@@ -0,0 +1,26 @@
6+# -*- encoding: utf-8 -*-
7+#
8+# Module Writen to OpenERP, Open Source Management Solution
9+#
10+# Copyright (c) 2013 Vauxoo - http://www.vauxoo.com/
11+# All Rights Reserved.
12+# info Vauxoo (info@vauxoo.com)
13+#
14+# Coded by: Jorge Angel Naranjo (jorge_nr@vauxoo.com)
15+#
16+#
17+# This program is free software: you can redistribute it and/or modify
18+# it under the terms of the GNU Affero General Public License as
19+# published by the Free Software Foundation, either version 3 of the
20+# License, or (at your option) any later version.
21+#
22+# This program is distributed in the hope that it will be useful,
23+# but WITHOUT ANY WARRANTY; without even the implied warranty of
24+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25+# GNU Affero General Public License for more details.
26+#
27+# You should have received a copy of the GNU Affero General Public License
28+# along with this program. If not, see <http://www.gnu.org/licenses/>.
29+#
30+#
31+import model
32
33=== added file 'project_followers_rule/__openerp__.py'
34--- project_followers_rule/__openerp__.py 1970-01-01 00:00:00 +0000
35+++ project_followers_rule/__openerp__.py 2014-05-16 23:29:47 +0000
36@@ -0,0 +1,49 @@
37+# -*- encoding: utf-8 -*-
38+#
39+# Module Writen to OpenERP, Open Source Management Solution
40+#
41+# Copyright (c) 2013 Vauxoo - http://www.vauxoo.com/
42+# All Rights Reserved.
43+# info Vauxoo (info@vauxoo.com)
44+#
45+# Coded by: Luis Ernesto García Medina (ernesto_gm@vauxoo.com)
46+#
47+#
48+# This program is free software: you can redistribute it and/or modify
49+# it under the terms of the GNU Affero General Public License as
50+# published by the Free Software Foundation, either version 3 of the
51+# License, or (at your option) any later version.
52+#
53+# This program is distributed in the hope that it will be useful,
54+# but WITHOUT ANY WARRANTY; without even the implied warranty of
55+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
56+# GNU Affero General Public License for more details.
57+#
58+# You should have received a copy of the GNU Affero General Public License
59+# along with this program. If not, see <http://www.gnu.org/licenses/>.
60+#
61+#
62+
63+{
64+ "name": "Followers of Task to Project",
65+ "version": "1.0",
66+ "author": "Vauxoo",
67+ "category": "Generic Modules",
68+ "description" : """
69+The followers_task_ids function field type is added, this field is used in the registration rule Follow Project Task,
70+allowing read, write, delete and create tasks without being a follower of the project.
71+ """,
72+ "website": "http://www.vauxoo.com/",
73+ "license": "AGPL-3",
74+ "depends": [
75+ "project",
76+ ],
77+ "demo": [
78+ ],
79+ "data": [
80+ 'data/ir_rule_project_data.xml',
81+ 'view/project_project_view.xml',
82+ ],
83+ "installable": True,
84+ "active": False,
85+}
86
87=== added directory 'project_followers_rule/data'
88=== added file 'project_followers_rule/data/ir_rule_project_data.xml'
89--- project_followers_rule/data/ir_rule_project_data.xml 1970-01-01 00:00:00 +0000
90+++ project_followers_rule/data/ir_rule_project_data.xml 2014-05-16 23:29:47 +0000
91@@ -0,0 +1,17 @@
92+<?xml version="1.0" encoding="UTF-8"?>
93+<openerp>
94+ <data noupdate='1'>
95+ <record id="rule_followers_task" model="ir.rule">
96+ <field name="name">Project Follow Task</field>
97+ <field ref="model_project_project" name="model_id"/>
98+ <field name="domain_force">[('followers_tasks_ids', 'in', [user.partner_id.id])]</field>
99+ <field name="perm_read" eval="1"/>
100+ <field name="perm_write" eval="1"/>
101+ <field name="perm_create" eval="1"/>
102+ <field name="perm_unlink" eval="1"/>
103+ <field name="active" eval="1"/>
104+ <field name="groups" eval="[(6,0,[ref('base.group_user'),])]"/>
105+ </record>
106+
107+ </data>
108+</openerp>
109
110=== added directory 'project_followers_rule/i18n'
111=== added file 'project_followers_rule/i18n/es_MX.po'
112--- project_followers_rule/i18n/es_MX.po 1970-01-01 00:00:00 +0000
113+++ project_followers_rule/i18n/es_MX.po 2014-05-16 23:29:47 +0000
114@@ -0,0 +1,21 @@
115+# Translation of OpenERP Server.
116+# This file contains the translation of the following modules:
117+#
118+msgid ""
119+msgstr ""
120+"Project-Id-Version: OpenERP Server 7.0\n"
121+"Report-Msgid-Bugs-To: \n"
122+"POT-Creation-Date: 2014-05-16 22:51+0000\n"
123+"PO-Revision-Date: 2014-05-16 22:51+0000\n"
124+"Last-Translator: <>\n"
125+"Language-Team: \n"
126+"MIME-Version: 1.0\n"
127+"Content-Type: text/plain; charset=UTF-8\n"
128+"Content-Transfer-Encoding: \n"
129+"Plural-Forms: \n"
130+
131+#. module: project_followers_rule
132+#: model:ir.model,name:project_followers_rule.model_project_project
133+msgid "Project"
134+msgstr "Proyecto"
135+
136
137=== added file 'project_followers_rule/i18n/es_VE.po'
138--- project_followers_rule/i18n/es_VE.po 1970-01-01 00:00:00 +0000
139+++ project_followers_rule/i18n/es_VE.po 2014-05-16 23:29:47 +0000
140@@ -0,0 +1,21 @@
141+# Translation of OpenERP Server.
142+# This file contains the translation of the following modules:
143+#
144+msgid ""
145+msgstr ""
146+"Project-Id-Version: OpenERP Server 7.0\n"
147+"Report-Msgid-Bugs-To: \n"
148+"POT-Creation-Date: 2014-05-16 22:51+0000\n"
149+"PO-Revision-Date: 2014-05-16 22:51+0000\n"
150+"Last-Translator: <>\n"
151+"Language-Team: \n"
152+"MIME-Version: 1.0\n"
153+"Content-Type: text/plain; charset=UTF-8\n"
154+"Content-Transfer-Encoding: \n"
155+"Plural-Forms: \n"
156+
157+#. module: project_followers_rule
158+#: model:ir.model,name:project_followers_rule.model_project_project
159+msgid "Project"
160+msgstr "Proyecto"
161+
162
163=== added file 'project_followers_rule/i18n/project_followers_rule.pot'
164--- project_followers_rule/i18n/project_followers_rule.pot 1970-01-01 00:00:00 +0000
165+++ project_followers_rule/i18n/project_followers_rule.pot 2014-05-16 23:29:47 +0000
166@@ -0,0 +1,21 @@
167+# Translation of OpenERP Server.
168+# This file contains the translation of the following modules:
169+#
170+msgid ""
171+msgstr ""
172+"Project-Id-Version: OpenERP Server 7.0\n"
173+"Report-Msgid-Bugs-To: \n"
174+"POT-Creation-Date: 2014-05-16 22:48+0000\n"
175+"PO-Revision-Date: 2014-05-16 22:48+0000\n"
176+"Last-Translator: <>\n"
177+"Language-Team: \n"
178+"MIME-Version: 1.0\n"
179+"Content-Type: text/plain; charset=UTF-8\n"
180+"Content-Transfer-Encoding: \n"
181+"Plural-Forms: \n"
182+
183+#. module: project_followers_rule
184+#: model:ir.model,name:project_followers_rule.model_project_project
185+msgid "Project"
186+msgstr ""
187+
188
189=== added directory 'project_followers_rule/model'
190=== added file 'project_followers_rule/model/__init__.py'
191--- project_followers_rule/model/__init__.py 1970-01-01 00:00:00 +0000
192+++ project_followers_rule/model/__init__.py 2014-05-16 23:29:47 +0000
193@@ -0,0 +1,28 @@
194+# -*- encoding: utf-8 -*-
195+#
196+# Module Writen to OpenERP, Open Source Management Solution
197+#
198+# Copyright (c) 2014 Vauxoo - http://www.vauxoo.com/
199+# All Rights Reserved.
200+# info Vauxoo (info@vauxoo.com)
201+#
202+# Coded by: Luis Ernesto García Medina (ernesto_gm@vauxoo.com)
203+#
204+#
205+# This program is free software: you can redistribute it and/or modify
206+# it under the terms of the GNU Affero General Public License as
207+# published by the Free Software Foundation, either version 3 of the
208+# License, or (at your option) any later version.
209+#
210+# This program is distributed in the hope that it will be useful,
211+# but WITHOUT ANY WARRANTY; without even the implied warranty of
212+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
213+# GNU Affero General Public License for more details.
214+#
215+# You should have received a copy of the GNU Affero General Public License
216+# along with this program. If not, see <http://www.gnu.org/licenses/>.
217+#
218+#
219+
220+import project
221+
222
223=== added file 'project_followers_rule/model/project.py'
224--- project_followers_rule/model/project.py 1970-01-01 00:00:00 +0000
225+++ project_followers_rule/model/project.py 2014-05-16 23:29:47 +0000
226@@ -0,0 +1,56 @@
227+# -*- encoding: utf-8 -*-
228+#
229+# Module Writen to OpenERP, Open Source Management Solution
230+#
231+# Copyright (c) 2014 Vauxoo - http://www.vauxoo.com/
232+# All Rights Reserved.
233+# info Vauxoo (info@vauxoo.com)
234+#
235+# Coded by: Luis Ernesto García Medina (ernesto_gm@vauxoo.com)
236+#
237+#
238+# This program is free software: you can redistribute it and/or modify
239+# it under the terms of the GNU Affero General Public License as
240+# published by the Free Software Foundation, either version 3 of the
241+# License, or (at your option) any later version.
242+#
243+# This program is distributed in the hope that it will be useful,
244+# but WITHOUT ANY WARRANTY; without even the implied warranty of
245+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
246+# GNU Affero General Public License for more details.
247+#
248+# You should have received a copy of the GNU Affero General Public License
249+# along with this program. If not, see <http://www.gnu.org/licenses/>.
250+#
251+
252+from openerp.osv import osv, fields
253+
254+
255+class project(osv.Model):
256+ _inherit = 'project.project'
257+
258+ def _get_followers(self, cr, uid, ids, field_name, arg, context=None):
259+ result = {}
260+ for project in self.browse(cr, uid, ids, context=context):
261+ task_ids = self.pool.get('project.task').search(
262+ cr, uid, [('project_id', '=', project.id)])
263+ for task in self.pool.get('project.task').browse(cr, uid, task_ids):
264+ if task.message_follower_ids:
265+ result[project.id] = [
266+ follower.id for follower in task.message_follower_ids]
267+ return result
268+
269+ def _search_project(self, cr, uid, obj, name, args, context):
270+ for cond in args:
271+ partner_ids = cond[2]
272+ task_ids = self.pool.get('project.task').search(
273+ cr, uid, [('message_follower_ids', 'in', partner_ids),
274+ ('project_id.privacy_visibility', '=', 'followers')])
275+ project_ids = set(task.project_id.id for task in self.pool.get(
276+ 'project.task').browse(cr, uid, task_ids))
277+ return [('id', 'in', tuple(project_ids))]
278+ _columns = {
279+ 'followers_tasks_ids': fields.function(_get_followers, type='many2many',
280+ relation="res.partner", string="Followers Task", method=True, store=False,
281+ fnct_search=_search_project),
282+ }
283
284=== added directory 'project_followers_rule/view'
285=== added file 'project_followers_rule/view/project_project_view.xml'
286--- project_followers_rule/view/project_project_view.xml 1970-01-01 00:00:00 +0000
287+++ project_followers_rule/view/project_project_view.xml 2014-05-16 23:29:47 +0000
288@@ -0,0 +1,15 @@
289+<?xml version="1.0" encoding="UTF-8"?>
290+<openerp>
291+ <data>
292+ <record model="ir.ui.view" id="project_project_form_follow_taks">
293+ <field name="name">project.project.form.follow_taks</field>
294+ <field name="model">project.project</field>
295+ <field name="inherit_id" ref="project.edit_project"/>
296+ <field name="arch" type="xml">
297+ <xpath expr="//field[@name='partner_id']" position="after">
298+ <field name="followers_tasks_ids" invisible='True'/>
299+ </xpath>
300+ </field>
301+ </record>
302+ </data>
303+</openerp>