Dhruti Shastri has proposed merging
lp:~openerp-dev/openobject-addons/6.1-opw-575089-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-575089-dhs/+merge/106963
To reproduce,
1) Install crm_claim
2) Define Automated Action having value in "Add Watchers"
3) True the Boolean field "Mail To Watchers"
4) Create claim
It will raise following error:
AttributeError: "Field 'act_email_cc' does not exist in object
'browse_record(crm.claim, 2)'"
--
https://code.launchpad.net/~openerp-dev/openobject-addons/6.1-opw-575089-dhs/+merge/106963
Your team OpenERP R&D Team is subscribed to branch
lp:~openerp-dev/openobject-addons/6.1-opw-575089-dhs.
=== modified file 'base_action_rule/base_action_rule.py'
--- base_action_rule/base_action_rule.py 2012-04-26 08:03:00 +0000
+++ base_action_rule/base_action_rule.py 2012-05-23 08:56:20 +0000
@@ -432,12 +432,22 @@
}
if action.act_email_to:
- emails.append(safe_eval(action.act_email_to, {}, locals_for_emails))
+ email_to = tools.ustr(action.act_email_to)
+ try:
+ email_to = safe_eval(tools.ustr(action.act_email_to), {}, locals_for_emails)
+ except:
+ pass
+ emails.append(email_to)
emails = filter(None, emails)
if len(emails) and action.act_mail_body:
emails = list(set(emails))
- email_from = safe_eval(action.act_email_from, {}, locals_for_emails)
+ from_email= tools.ustr(action.act_email_from)
+ try:
+ from_email= safe_eval(tools.ustr(action.act_email_from), {}, locals_for_emails)
+ except:
+ pass
+ email_from = from_email
def to_email(text):
return re.findall(r'([^ ,<@]+@[^> ,]+)', text or '')
=== modified file 'crm/crm.py'
--- crm/crm.py 2012-03-08 15:58:35 +0000
+++ crm/crm.py 2012-05-23 08:56:20 +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:
=== modified file 'crm/crm_action_rule.py'
--- crm/crm_action_rule.py 2012-03-16 14:42:51 +0000
+++ crm/crm_action_rule.py 2012-05-23 08:56:20 +0000
@@ -99,10 +99,10 @@
if hasattr(obj, 'email_cc') and action.act_email_cc:
if '@' in (obj.email_cc or ''):
emails = obj.email_cc.split(",")
- if obj.act_email_cc not in emails:# and '<'+str(action.act_email_cc)+">" not in emails:
- write['email_cc'] = obj.email_cc + ',' + obj.act_email_cc
+ if action.act_email_cc not in emails:# and '<'+str(action.act_email_cc)+">" not in emails:
+ write['email_cc'] = obj.email_cc + ',' + action.act_email_cc
else:
- write['email_cc'] = obj.act_email_cc
+ write['email_cc'] = action.act_email_cc
# Put state change by rule in communication history
if hasattr(obj, 'state') and hasattr(obj, 'message_append') and action.act_state:
_______________________________________________
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