Odoo is the world's easiest all-in-one management software. It includes hundreds of business apps:
CRM | e-Commerce | Accounting | Inventory | PoS | Project management | MRP | etc.
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
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.Register
Odoo Training Center
Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.Test it now
|Asked: 6/19/15, 1:52 PM|
|Seen: 626 times|
|Last updated: 6/19/15, 2:31 PM|