← Back to team overview

openerp-community team mailing list archive

[Merge] lp:~openerp-community/openobject-addons/rocket_l10n_gt into lp:openobject-addons

 

Rocket has proposed merging lp:~openerp-community/openobject-addons/rocket_l10n_gt into lp:openobject-addons.

Requested reviews:
  OpenERP Core Team (openerp)
Related bugs:
  Bug #764050 in OpenERP Addons: "l10n_gt: price_include not set on taxes"
  https://bugs.launchpad.net/openobject-addons/+bug/764050
  Bug #792931 in OpenERP Addons: "An error occurs when an automated action has a blank email from field"
  https://bugs.launchpad.net/openobject-addons/+bug/792931

For more details, see:
https://code.launchpad.net/~openerp-community/openobject-addons/rocket_l10n_gt/+merge/63478

Bug #792931: Fixed an error when the Email From (act_email_from) is blank.
-- 
https://code.launchpad.net/~openerp-community/openobject-addons/rocket_l10n_gt/+merge/63478
Your team OpenERP Community is subscribed to branch lp:~openerp-community/openobject-addons/rocket_l10n_gt.
=== modified file 'base_action_rule/base_action_rule.py'
--- base_action_rule/base_action_rule.py	2011-03-04 12:53:34 +0000
+++ base_action_rule/base_action_rule.py	2011-06-04 21:54:26 +0000
@@ -423,7 +423,18 @@
         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)
+
+            #
+            # If there is no python on the email to field, use the
+            # email from the user, and if the user doesn't have an
+            # email, display an error.
+            #
+            if action.act_email_from:
+                email_from = safe_eval(action.act_email_from, {}, locals_for_emails)
+            elif locals_for_emails['user'].user_email:
+                email_from = locals_for_emails['user'].user_email 
+            else:
+                raise osv.except_osv(_('Error!'), _("No email from or user email to send the email from"))
 
             def to_email(text):
                 return re.findall(r'([^ ,<@]+@[^> ,]+)', text or '')