跳至内容
菜单
此问题已终结
1 回复
3006 查看

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?

形象
丢弃
最佳答案

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

 

形象
丢弃
相关帖文 回复 查看 活动
1
8月 25
455
1
8月 25
679
2
7月 25
3187
3
7月 25
816
1
6月 25
2351