Odoo Help


[V8] XML for server action: how to write on fields?

on 6/19/15, 1:52 PM 664 views

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="state">code</field>
<field name="type">ir.actions.server</field>
<field name="model_id" ref="rest.order"/>
<field name="code">Write on my fields here</field>
<field name="condition">True</field>
<field name="name">Rest_env</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...



| 6 4 7
Lodz, Poland

On 6/19/15, 2:31 PM

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"/>
<field name="state">code</field>
<field name="code">
if context.get('active_model') == 'crm.lead':
ids = []
if context.get('active_domain'):
ids = self.search(cr, uid, context['active_domain'], context=context)
elif context.get('active_ids'):
ids = context['active_ids']
if ids:
self.assign_salesman_of_assigned_partner(cr, uid, ids, context=context)

zbik, thanks for your reply but how this is supposed to help me with object_write? As far as I could understand I need to use

 use_write / current
Then I would like to understand the syntax.
on 6/19/15, 3:14 PM

Have you tried: self.write(cr, uid, ids, context=context) in the part at the end (where the example posted uses self.assign_salesman_of_assigned_partner ?

Bista Solutions US, Ray Carnes
on 6/19/15, 4:30 PM

Nope. I give up. I'll add actions directly in Odoo every time a need, is really faster. I'm sorry to say that even with the new "skin" Odoo documentation is really inadequate.

on 6/19/15, 7:48 PM

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

1 follower(s)


Asked: 6/19/15, 1:52 PM
Seen: 664 times
Last updated: 6/19/15, 2:31 PM