Odoo 13 API 如何将空搜索结果保存为字符串

问题描述

我正在使用 odoo 13 api。

  wanted_ids= models.execute_kw(db,uid,password,'res.partner','search_read',[[['name','=',False]]],)
    print(wanted_ids)

不出所料,什么都没有返回。

[]

我想要什么而不是空

['nothing found']

我不知道如何解决这个问题。我曾尝试引发异常,但这并没有保存到 wanted_ids 变量中。

解决方法

if not wanted_ids:
    wanted_ids = ['Nothing found']

这是纯 Python,我认为是这样