首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >引发TypeError(repr(o) +“不是可序列化的JSON

引发TypeError(repr(o) +“不是可序列化的JSON
EN

Stack Overflow用户
提问于 2016-04-20 03:17:02
回答 1查看 1.3K关注 0票数 0

能帮我吗?我想在其他事务中不显示id的域many2one字段。

代码语言:javascript
复制
@api.multi
@api.onchange('batch_id')
def _onchange_batch_id(self):
    if self:
        tempt=[]
        for record in self:
            tempt.extend([record.batch_id])

        culling = self.env['estate.nursery.cullinglinebatch'].search([('batch_id', '!=', list(tempt))])

        return {
             'domain': {'batch_id': [('batch_id','not in',culling),('qty_abnormal','>',0)]}

        }
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-04-20 06:04:37

在ODOO8 8/9搜索中,方法总是返回对象,而不是对象的Id。

代码语言:javascript
复制
culling = self.env['estate.nursery.cullinglinebatch'].search([('batch_id', '!=', list(tempt))])

在这里,culling'estate.nursery.cullinglinebatch模型的对象

你的域名应该看起来像

代码语言:javascript
复制
 'domain': {'batch_id': [('batch_id','not in',culling.ids),('qty_abnormal','>',0)]}

这里我使用了culling.ids,而不是culling.ids

我希望这能帮到你。

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/36733192

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档