Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odpovědět
2999 Zobrazení

I would like to inherit purchase.order to add a custom action method for a workflow.  Do I need to code everything in the old API like

self.write(cr, uid, ids, {'state': 'approved'})

or can I code things like

self.state='approved'

?  Is there a standard way to do this?

Avatar
Zrušit
Nejlepší odpověď

In new API you should use

self.write({'state': 'approved'})

or

self.state='approved'

If you write many values better way (only one trigger a write action) is:

self.write({’x’:1,’y’:2,’z’:4})

See:
https://media.readthedocs.org/pdf/odoo-new-api-guide-line/latest/odoo-new-api-guide-line.pdf
https://github.com/nbessi/odoo_new_api_guideline
https://www.odoo.com/documentation/8.0/reference/orm.html

 

Avatar
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
1
srp 25
454
1
srp 25
679
2
čvc 25
3181
3
čvc 25
813
1
čvn 25
2346