Dhruti Shastri has proposed merging
lp:~openerp-dev/openobject-addons/6.1-opw-574367-dhs into
lp:openobject-addons/6.1.
Requested reviews:
Naresh(OpenERP) (nch-openerp)
For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/6.1-opw-574367-dhs/+merge/108925
To reproduce:
- install SALE and CRM
- create a user and assigned the default team to him
- enable extended view
- go to Sales > Configuration > Sales > Sales Teams
- open the default team
Expected behaviour:
- the team members list should contain the new user
Current behaviour:
- the team members is empty
--
https://code.launchpad.net/~openerp-dev/openobject-addons/6.1-opw-574367-dhs/+merge/108925
Your team OpenERP R&D Team is subscribed to branch
lp:~openerp-dev/openobject-addons/6.1-opw-574367-dhs.
=== modified file 'crm/crm.py'
--- crm/crm.py 2012-03-08 15:58:35 +0000
+++ crm/crm.py 2012-06-06 12:13:23 +0000
@@ -125,6 +125,24 @@
(osv.osv._check_recursion, 'Error ! You cannot create recursive Sales team.', ['parent_id'])
]
+ def write(self, cr, uid, ids, vals, context=None):
+ new_users = vals.get('member_ids',[])
+ if new_users:
+ user_obj = self.pool.get('res.users')
+ old_users_ids = {}
+ map(lambda x:old_users_ids.setdefault(x.id, x.member_ids), self.browse(cr, uid, ids, context=context))
+ new_user = []
+ if new_users[0][0] == 6 and new_users[0][2]:
+ new_user = new_users[0][2]
+ elif new_users[0][0] == 4 and new_users[0][1]:
+ new_user = [new_users[0][1]]
+ for id in ids:
+ users = list (set(old_users_ids[id]).difference(set(new_user)))
+ user_to_modify = map(lambda x:x.id, users)
+ user_obj.write(cr, uid, user_to_modify, {'context_section_id':False}, context)
+
+ return super(crm_case_section, self).write(cr, uid, ids, vals, context=context)
+
def name_get(self, cr, uid, ids, context=None):
"""Overrides orm name_get method"""
if not isinstance(ids, list) :
@@ -576,6 +594,15 @@
if vals.get('context_section_id'):
section_obj.write(cr, uid, [vals['context_section_id']], {'member_ids':[(4, res)]}, context)
return res
+
+ def write (self, cr, uid, ids, vals, context=None):
+ res = super(users, self).write(cr, uid, ids, vals, context=context)
+ section_obj=self.pool.get('crm.case.section')
+ section_id = vals.get('context_section_id', False)
+ if section_id:
+ for id in ids:
+ section_obj.write(cr, uid, [section_id], {'member_ids':[(4,id)]}, context)
+ return res
users()
_______________________________________________
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