I've started a migration to Odoo 10 from Odoo 8 and I didn't figured out how to replace a simple self.write with the new API.
For example, on one of my custom module I have
self.write(cr, uid, context['active_ids'], {'to_wait':'No'})
but when I fire the server action in my view I get
NameError: name 'self' is not defined
This is my working code for the server action on V8:
<record id="rest_order_send" model="ir.actions.server">
<field name="sequence" eval="5"/>
<field name="name">rest_order_send</field>
<field name="model_id" ref="model_rest_order"/>
<field name="condition">True</field>
<field name="type">ir.actions.server</field>
<field name="state">code</field>
<field name="code">self.write(cr, uid, context['active_ids'],{'status':'Pronto'})
self.write(cr, uid, context['active_ids'], {'to_floor':'2'})
self.write(cr, uid, context['active_ids'], {'end_date':datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")})
</field>
</record>
Looking on Odoo10 doc I found I can't use self.write anymore and I have to use another syntax now, but sadly I didn't figured out how to use the new object_write command.
Partially solved with the help of Raaj with:
pos_obj = env['pos.order'].browse(context.get('active_id'))
pos_obj.write({'costs': '1.45'})