能帮我吗?我想在其他事务中不显示id的域many2one字段。
@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)]}
}发布于 2016-04-20 06:04:37
在ODOO8 8/9搜索中,方法总是返回对象,而不是对象的Id。
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,而不是culling.ids。
我希望这能帮到你。
https://stackoverflow.com/questions/36733192
复制相似问题