Devishree Brahmbhatt (OpenERP) has proposed merging
lp:~openerp-dev/openobject-addons/trunk-contract-apa-project-dbr into
lp:~openerp-dev/openobject-addons/trunk-contract-apa.
Requested reviews:
Launchpad APA (launchpad-apa)
For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-contract-apa-project-dbr/+merge/107588
Hello Sir,
I have added one selection field privacy_visility.
and add some related methods.
So, kindly review it.
Thanks,
DBR
--
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-contract-apa-project-dbr/+merge/107588
Your team OpenERP R&D Team is subscribed to branch
lp:~openerp-dev/openobject-addons/trunk-contract-apa.
=== modified file 'project/project.py'
--- project/project.py 2012-05-22 16:10:55 +0000
+++ project/project.py 2012-05-28 07:36:19 +0000
@@ -67,6 +67,35 @@
return super(project, self).search(cr, user, args, offset=offset, limit=limit, order=order,
context=context, count=count)
+ def write(self, cr, uid, ids, vals, context=None):
+ if context is None:
+ context = {}
+ list = []
+ project_ids = self.browse(cr, uid, ids)
+ groups = self.pool.get('res.groups')
+ group_id = groups.search(cr, uid, [('name', '=', 'Followers')], context=context)
+ groups_users = groups.browse(cr, uid, group_id)[0].users
+ for project_id in project_ids:
+ select = vals.get('privacy_visility') or project_id.privacy_visility or False
+ members = vals.get('members') or project_id.members or False
+ if select=='follower':
+ if members:
+ for member in members:
+ list.append(member.id)
+ followers = self.find_followers(cr, uid, ids, context)
+ for member_id in list:
+ if not member_id in followers:
+ self.message_subscribe(cr, uid, ids, [member_id], context=context)
+ return super(project, self).write(cr, uid, ids, vals, context=context)
+
+ def find_followers(self, cr, uid, ids, context=None):
+ user=[]
+ sub_obj = self.pool.get('mail.subscription')
+ sub_id = sub_obj.search(cr, uid, [('res_model','=','project.project'),('res_id','in',ids)], context=context)
+ for follower_id in sub_obj.browse(cr, uid, sub_id):
+ user.append(follower_id.user_id.id)
+ return user
+
def _complete_name(self, cr, uid, ids, name, args, context=None):
res = {}
for m in self.browse(cr, uid, ids, context=context):
@@ -202,11 +231,20 @@
'task_count': fields.function(_task_count, type='integer', string="Open Tasks"),
'color': fields.integer('Color Index'),
'company_uom_id': fields.related('company_id', 'project_time_mode_id', type='many2one', relation='product.uom'),
+ 'privacy_visility': fields.selection([('public','Public'), ('follower','Followers Only')], 'Privacy / Visility', select=True),
}
def dummy(self, cr, uid, ids, context):
return True
-
+
+ def message_thread_followers(self, cr, uid, ids, context=None):
+ followers = super(project,self).message_thread_followers(cr, uid, ids, context=context)
+ for project in self.browse(cr, uid, followers.keys(), context=context):
+ project_followers = set(followers[project.id])
+ project_followers.add(project.user_id.user_email)
+ followers[project.id] = filter(None, project_followers)
+ return followers
+
def _get_type_common(self, cr, uid, context):
ids = self.pool.get('project.task.type').search(cr, uid, [('project_default','=',1)], context=context)
return ids
=== modified file 'project/project_view.xml'
--- project/project_view.xml 2012-05-24 16:07:52 +0000
+++ project/project_view.xml 2012-05-28 07:36:19 +0000
@@ -41,6 +41,7 @@
<field name="date_start" string="Start Date" attrs="{'readonly':[('state','in',['close', 'cancelled'])]}"/>
<field name="date" string="End Date" attrs="{'readonly':[('state','in',['close', 'cancelled'])]}"/>
<field name="progress_rate" widget="progressbar"/>
+ <field name="privacy_visility"/>
</group>
<notebook colspan="4">
<page string="Administration">
=== modified file 'project/security/project_security.xml'
--- project/security/project_security.xml 2012-04-27 07:17:01 +0000
+++ project/security/project_security.xml 2012-05-28 07:36:19 +0000
@@ -14,6 +14,11 @@
<field name="users" eval="[(4, ref('base.user_root'))]"/>
</record>
+ <record id="group_project_followers" model="res.groups">
+ <field name="name">Followers</field>
+ <field name="category_id" ref="base.module_category_project_management"/>
+ </record>
+
<record model="ir.ui.menu" id="menu_definitions">
<field name="groups_id" eval="[(6,0,[ref('group_project_manager')])]"/>
</record>
_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help : https://help.launchpad.net/ListHelp