Quick Tip – calling methods with standard function signature
In OpenERP, if you have spent any time at all writing mods you will be used to something like this
prod_obj.action_update_cost(cr, uid, product_id, context)
to call a method of an object, passing the cursor, user id, product_id and context. Also you have probably done something like this
sale_order.order_line.product_id
to obtain a browse record, or even appended .id to get the id of the object for passing in the above orm_pool function.
Well, as it turns out there is another way, and you can call these methods directly, and without arguments, so for example
sale_order.order_line.product_id.action_update_cost()
Then the ORM works out the arguments for you. I kind of worked this out from some write calls I had seen in workflow, but to date have had no problems using it with any function with a standard signature.