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/106966

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/106966
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 09:13:21 +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_action_rule.py'
--- crm/crm_action_rule.py	2012-03-16 14:42:51 +0000
+++ crm/crm_action_rule.py	2012-05-23 09:13:21 +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

Reply via email to