微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

模块'odoo.tools.pycompat'没有属性'integer_types'odoo 13

如何解决模块'odoo.tools.pycompat'没有属性'integer_types'odoo 13

当我尝试在odoo 13中升级代码时,我在odoo 12中具有与pycompat库相关的代码 它给了我以下错误

if isinstance(res_ids,pycompat.integer_types):
AttributeError: module 'odoo.tools.pycompat' has no attribute 'integer_types'

我的python代码如下:

def generate_email(self,res_ids,fields=None):
    self.ensure_one()
    multi_mode = True
    if isinstance(res_ids,pycompat.integer_types):
        res_ids = [res_ids]
        multi_mode = False
    if fields is None:
        fields = ['subject','body_html','email_from','email_to','partner_to','email_cc','email_bcc','reply_to','scheduled_date']

    res_ids_to_templates = self.get_email_template(res_ids)

那么,我需要在此代码中进行哪些更改?

预先感谢

解决方法

integer_types是用于与Python 2代码保持兼容性的填充程序。此填充物(及其他填充物)在Odoo 13中为removed

您应该直接与int进行比较

if isinstance(res_ids,int):
    ...

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。