OpenERP Addons (modules)

Automated action: Impossible to extract sales order line information?

Asked by Li Wee, Ong on 2012-12-06

Hi,

I am able to create an automated action to return values within a sale order. E.g. customer name / user etc

Fields for "Open: Server Action"
1. Object = Sales Order
2. Action Type = Create Object
3. Model = Message
4. Destination = Contents
5. Type = Formula
6. Value = object.user_id.name

However, when I try to get the corresponding values within the sale order lines, I get an error (bottom)

Fields for "Open: Server Action"
1. Object = Sales Order Line
2. Action Type = Create Object
3. Model = Message
4. Destination = Contents
5. Type = Formula
6. Value = object.id

Is it possible to extract data from the sales order line? Am I missing something?
Would appreciate any advice.

2012-12-06 06:40:43,744 6408 ERROR None openerp.tools.safe_eval: Cannot eval u'object.id'
Traceback (most recent call last):
  File "/opt/openerp/server/openerp/tools/safe_eval.py", line 242, 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 'id'
2012-12-06 06:40:43,745 6408 ERROR None openerp.osv.osv: Uncaught exception
Traceback (most recent call last):
  File "/opt/openerp/server/openerp/osv/osv.py", line 121, in wrapper
    return f(self, dbname, *args, **kwargs)
  File "/opt/openerp/server/openerp/osv/osv.py", line 176, in execute
    res = self.execute_cr(cr, uid, obj, method, *args, **kw)
  File "/opt/openerp/server/openerp/osv/osv.py", line 164, in execute_cr
    return getattr(object, method)(cr, uid, *args, **kw)
  File "/opt/openerp/server/openerp/addons/base_action_rule/base_action_rule.py", line 135, in wrapper
    new_id = old_create(cr, uid, vals, context=context)
  File "/opt/openerp/server/openerp/addons/sale_stock/sale_stock.py", line 73, in create
    order = super(sale_order, self).create(cr, uid, vals, context=context)
  File "/opt/openerp/server/openerp/addons/sale_crm/sale_crm.py", line 33, in create
    order = super(sale_order, self).create(cr, uid, vals, context=context)
  File "/opt/openerp/server/openerp/addons/sale/sale.py", line 320, in create
    order = super(sale_order, self).create(cr, uid, vals, context=context)
  File "/opt/openerp/server/openerp/addons/mail/mail_thread.py", line 229, in create
    self.message_subscribe_users(cr, uid, [thread_id], [uid], context=context)
  File "/opt/openerp/server/openerp/addons/mail/mail_thread.py", line 801, in message_subscribe_users
    return self.message_subscribe(cr, uid, ids, partner_ids, subtype_ids=subtype_ids, context=context)
  File "/opt/openerp/server/openerp/addons/mail/mail_thread.py", line 805, in message_subscribe
    self.write(cr, uid, ids, {'message_follower_ids': [(4, pid) for pid in partner_ids]}, context=context)
  File "/opt/openerp/server/openerp/addons/base_action_rule/base_action_rule.py", line 153, in wrapper
    self.post_action(cr, uid, ids, model, context=context)
  File "/opt/openerp/server/openerp/addons/base_action_rule/base_action_rule.py", line 124, in post_action
    self._action(cr, uid, [rule_id], obj.browse(cr, uid, ids, context=context), context=context)
  File "/opt/openerp/server/openerp/addons/base_action_rule/base_action_rule.py", line 328, in _action
    self.do_action(cr, uid, action, obj, context=context)
  File "/opt/openerp/server/openerp/addons/crm/crm_action_rule.py", line 75, in do_action
    res = super(base_action_rule, self).do_action(cr, uid, action, obj, context=context)
  File "/opt/openerp/server/openerp/addons/base_action_rule/base_action_rule.py", line 294, in do_action
    action_server_obj.run(cr, uid, [x.id for x in action.server_action_ids], context=ctx)
  File "/opt/openerp/server/openerp/addons/base/ir/ir_actions.py", line 714, in run
    expr = eval(euq, cxt)
  File "/opt/openerp/server/openerp/tools/safe_eval.py", line 242, 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 'id'

Question information

Language:
English Edit question
Status:
Expired
For:
OpenERP Addons Edit question
Assignee:
No assignee Edit question
Last query:
2012-12-06
Last reply:
2012-12-21
Li Wee, Ong (liwee-ong) said : #1

If I change the Related Document Model = Sales Order Line, it works ... sort of. I get a message for every sales order line within a sale order. If I have 10 sales order line, I get 10 separate messages which is quite pointless.

Launchpad Janitor (janitor) said : #2

This question was expired because it remained in the 'Open' state without activity for the last 15 days.