raise TypeError(repr(o) + " 不是 JSON 可序列化
raise TypeError(repr(o) + " is not JSON serializable
可以帮我吗?我想域 many2one 字段,其中 id 未显示在其他事务中
@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)]}
}
In ODOO8/9 search method always return object not the Id of object.
culling = self.env['estate.nursery.cullinglinebatch'].search([('batch_id', '!=', list(tempt))])
这里culling
是模型的对象'estate.nursery.cullinglinebatch
'
您的域应该类似于
'domain': {'batch_id': [('batch_id','not in',culling.ids),('qty_abnormal','>',0)]}
这里我使用了culling.ids而不是剔除.
希望对您有所帮助。
可以帮我吗?我想域 many2one 字段,其中 id 未显示在其他事务中
@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)]}
}
In ODOO8/9 search method always return object not the Id of object.
culling = self.env['estate.nursery.cullinglinebatch'].search([('batch_id', '!=', list(tempt))])
这里culling
是模型的对象'estate.nursery.cullinglinebatch
'
您的域应该类似于
'domain': {'batch_id': [('batch_id','not in',culling.ids),('qty_abnormal','>',0)]}
这里我使用了culling.ids而不是剔除.
希望对您有所帮助。