I would like to add a server action to my module but I'm having trouble to find the correct syntax of object_write to do that:
<record id="rest_env" model="ir.actions.server">
<field name="sequence" eval="5"/>
<field name="model_id" ref="rest.order"/>
<field name="code">Write on my fields here</field>
In code I would like to update some fields, that's easy from the GUI, but I didn't understand how to do that from xml.
Odoo documentation doesn't offers examples for that...
Example from crm_lead_view.xml:
<record id="action_assign_salesman_according_assigned_partner" model="ir.actions.server">
<field name="name">Assign salesman of assigned partner</field>
<field name="model_id" ref="model_crm_lead"/>
if context.get('active_model') == 'crm.lead':
ids = 
ids = self.search(cr, uid, context['active_domain'], context=context)
ids = context['active_ids']
self.assign_salesman_of_assigned_partner(cr, uid, ids, context=context)
Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!
About This Community
|Asked: 6/19/15, 1:52 PM|
|Seen: 517 times|
|Last updated: 6/19/15, 2:31 PM|