odoo13新版本特性

本博客列出跟以往12版本不同之处,避免在13版本开发上的错误

1.废除 @api.multi

13的后端方法直接def,不允许再跟此装饰器,因为已废除

2.移除下面类似写法(12可以)

<field name="view_type">form</field>

view_type 已取消,如果视图上有这个会升级报错,但是安装没问题

3.前端方法传入参数,后端不能在自定义方法中带参数拿来接受(12可以),正确的做法是

前端代码

<button name="action_creatorder" string="创建微信订单" type="object" class="btn btn-primary float-right m1000 o_clipboard_button" context="{'saleType': 1}"/>

后端代码

    def action_creatorder(self):
        # print(self.env.context)
        type = int(self.env.context.get('saleType'))
        print('类型',type)
发布了109 篇原创文章 · 获赞 23 · 访问量 30万+

猜你喜欢

转载自blog.csdn.net/qq_32394351/article/details/102789388