Odoo Help


Automated Action update field [Closed]

Landon Gilbert-Bland
on 4/15/13, 6:21 PM 2,653 views

The Question has been closed

Sudhir Arya (ERP Harbor Consulting Services)
on 04/18/2013 05:10:16

I am trying to update a custom field in crm.lead using automated actions. The code I have looks like this:

# You can use the following variables:
#  - self: ORM model of the record on which the action is triggered
#  - object: browse_record of the record on which the action is triggered if there is one, otherwise None
#  - pool: ORM model pool (i.e. self.pool)
#  - time: Python time module
#  - cr: database cursor
#  - uid: current user id
#  - context: current context
# If you plan to return an action, assign: action = {...}

self.write(cr, uid, object, {'custom_field': 'test'}, context)

This is the error I get (I can get the full traceback if it would be helpful):

TypeError: argument 2 to map() must support iteration

I have tried setting object to [object] and verifying that object is not None but it still errors out. If I pass in an empty list instead of object to .write() then it doesn't error out, but my field doesn't get updated, which is understandable. Can anyone point me in the direction of what I am doing wrong here?



Sudhir Arya (ERP Harbor Consulting Services)

--Sudhir Arya (ERP Harbor Consulting Services)--
| 6 8 8
Ahmedabad, India
--Sudhir Arya (ERP Harbor Consulting Services)--

• Co-Founder & Co-Owner at ERP Harbor Consulting Services

• ERP Consultant / ERP Customization / TechnoFunctional Expert

• Sound knowledge in Python, Odoo (Open ERP), XML, PostgreSQL

• Domain knowledge of Sale Management, Purchase Management, Warehouse Management, Manufacturing, Multi Company Configuration & Management, HR Management, Medical Management, Construction Management, Education Management, Point of Sale, Third Party Integrations

• Positive attitude and quick Learner

• Good analytical skill, quick bug and issue tracing and find the solution

• Good knowledge and experience in payment gateway integration with Odoo

• Ready to accept new challenges

• Active Memeber On Stackoverflow 




Sudhir Arya
ERP Harbor Consulting Services
Sudhir Arya (ERP Harbor Consulting Services)
On 4/16/13, 2:12 AM

In write method you must pass ID or list of IDs. You are facing error because you are passing browse record instead of ID.

Try this:

if object: self.write(cr, uid, [object.id], {'custom_field': 'test'}, context=context)

wow its really helpful me too today.. Arya, please advice me on this http://help.openerp.com/question/12486/how-to-set-field-as-readonly-by-function/

on 4/20/13, 3:18 AM

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

0 follower(s)


Asked: 4/15/13, 6:21 PM
Seen: 2653 times
Last updated: 3/16/15, 8:10 AM