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/106605
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/106605
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-05-21 10:26:19 +0000
@@ -125,9 +125,27 @@
(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))
+ if new_users:
+ 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})
+
+ 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) :
+ if not isinstance(ids, list) :
ids = [ids]
res = []
if not ids:
@@ -325,10 +343,10 @@
return rule_obj._action(cr, uid, rule_ids, cases, scrit=scrit, context=context)
class crm_case(crm_base):
- """ A simple python class to be used for common functions
+ """ A simple python class to be used for common functions
Object that inherit from this class should inherit from mailgate.thread
And need a stage_id field
- And object that inherit (orm inheritance) from a class the overwrite copy
+ And object that inherit (orm inheritance) from a class the overwrite copy
"""
def stage_find(self, cr, uid, section_id, domain=[], order='sequence'):
@@ -577,6 +595,15 @@
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()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
_______________________________________________
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