Antoine(OpenERP) has proposed merging
lp:~openerp-dev/openobject-addons/6.1-activemodel-ahu into
lp:openobject-addons/6.1.
Requested reviews:
OpenERP Core Team (openerp)
For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/6.1-activemodel-ahu/+merge/97832
1) Modifying line 392 in base_action_rule.py to add:
context.update({'active_id':obj.id,
'active_ids':[obj.id],'active_model':obj._name})
I don't know if this trick is properly "fixing" the following bug, but at least
it works:
What we're trying to do is to link a responsible on an issue fetched by
fetchmail through an automated action. Then, on the same action, send a mail to
this responsible to warn him of the new issue:
a) Try to make some server action of type mail
b) Link it to an automated action
c) look at it failing:
Traceback (most recent call last):
File "/home/antoine/source/server/6.1/openerp/osv/osv.py", line 121, in
wrapper
return f(self, dbname, *args, **kwargs)
File "/home/antoine/source/server/6.1/openerp/osv/osv.py", line 176, in
execute
res = self.execute_cr(cr, uid, obj, method, *args, **kw)
File "/home/antoine/source/server/6.1/openerp/osv/osv.py", line 164, in
execute_cr
return getattr(object, method)(cr, uid, *args, **kw)
File "/home/antoine/source/addons/6.1/crm/crm.py", line 456, in case_pending
self._action(cr, uid, cases, 'pending')
File "/home/antoine/source/addons/6.1/crm/crm.py", line 325, in _action
return rule_obj._action(cr, uid, rule_ids, cases, scrit=scrit,
context=context)
File "/home/antoine/source/addons/6.1/base_action_rule/base_action_rule.py",
line 469, in _action
self.do_action(cr, uid, action, model_obj, obj, context=context)
File "/home/antoine/source/addons/6.1/crm/crm_action_rule.py", line 111, in
do_action
super(base_action_rule, self).do_action(cr, uid, action, model_obj, obj,
context=context)
File "/home/antoine/source/addons/6.1/base_action_rule/base_action_rule.py",
line 394, in do_action
self.pool.get('ir.actions.server').run(cr, uid,
[action.server_action_id.id], context)
File "/home/antoine/source/server/6.1/openerp/addons/base/ir/ir_actions.py",
line 687, in run
res_email = ir_mail_server.send_email(cr, uid, msg)
File
"/home/antoine/source/server/6.1/openerp/addons/base/ir/ir_mail_server.py",
line 381, in send_email
assert smtp_to_list, "At least one valid recipient address should be
specified for outgoing emails (To/Cc/Bcc)"
AssertionError: At least one valid recipient address should be specified for
outgoing emails (To/Cc/Bcc)
2012-03-13 08:58:17,794 4698 ERROR ? openerp.netsvc: At least one valid
recipient address should be specified for outgoing emails (To/Cc/Bcc)
> /home/antoine/source/server/6.1/openerp/addons/base/ir/ir_mail_server.py(381)send_email()
-> assert smtp_to_list, "At least one valid recipient address should be
specified for outgoing emails (To/Cc/Bcc)"
The second change is similar but for server actions linked to fetchmail.
Changes in fetchmail.py:
line 195: action_pool.run(cr, uid, [server.action_id.id], {'active_id': res_id,
'active_ids':[res_id]})
adding: 'active_model':server.object_id.model
to also give the type of model needed
Also avoiding:
Traceback (most recent call last):
File "/home/antoine/source/addons/6.1/fetchmail/fetchmail.py", line 195, in
fetch_mail
action_pool.run(cr, uid, [server.action_id.id], {'active_id': res_id,
'active_ids':[res_id]})
File "/home/antoine/source/server/6.1/openerp/addons/base/ir/ir_actions.py",
line 728, in run
expr = eval(euq, cxt)
File "/home/antoine/source/server/6.1/openerp/tools/safe_eval.py", line 241,
in safe_eval
return eval(test_expr(expr,_SAFE_OPCODES, mode=mode), globals_dict,
locals_dict)
File "", line 1, in <module>
AttributeError: 'NoneType' object has no attribute 'email_from'
I know this fix is maybe (certainly) not a good one. If not acceptable, could
somebody have a look at these bugs ?
--
https://code.launchpad.net/~openerp-dev/openobject-addons/6.1-activemodel-ahu/+merge/97832
Your team OpenERP R&D Team is subscribed to branch
lp:~openerp-dev/openobject-addons/6.1-activemodel-ahu.
=== modified file 'base_action_rule/base_action_rule.py'
--- base_action_rule/base_action_rule.py 2011-12-27 09:27:00 +0000
+++ base_action_rule/base_action_rule.py 2012-03-16 10:37:23 +0000
@@ -389,7 +389,7 @@
context = {}
if action.server_action_id:
- context.update({'active_id':obj.id, 'active_ids':[obj.id]})
+ context.update({'active_id':obj.id, 'active_ids':[obj.id],'active_model':obj._name})
self.pool.get('ir.actions.server').run(cr, uid, [action.server_action_id.id], context)
write = {}
=== modified file 'fetchmail/fetchmail.py'
--- fetchmail/fetchmail.py 2011-10-16 01:28:00 +0000
+++ fetchmail/fetchmail.py 2012-03-16 10:37:23 +0000
@@ -192,7 +192,7 @@
strip_attachments=(not server.attach),
context=context)
if res_id and server.action_id:
- action_pool.run(cr, uid, [server.action_id.id], {'active_id': res_id, 'active_ids':[res_id]})
+ action_pool.run(cr, uid, [server.action_id.id], {'active_id': res_id, 'active_ids':[res_id], 'active_model':server.object_id.model})
imap_server.store(num, '+FLAGS', '\\Seen')
cr.commit()
count += 1
_______________________________________________
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