Odoo 13 如何通过 api 运行 一个动作?
Odoo 13 how to run a action via api?
url = "ip"
db = "dbname"
username = "user"
password = "admin"
common = xmlrpc.client.ServerProxy('{}/xmlrpc/2/common'.format(url))
uid = common.authenticate(db, username, password, {})
actions = models.execute_kw(db, uid, password, 'ir.cron', 'search', [[['name', '=', 'Mail: Email Queue Manager']]])
print(actions)
Returns [2]
但是我不确定如何运行这个动作?我已尝试查看文档,但没有看到有关如何 运行 执行操作的示例?
您可以通过调用 method_direct_trigger
方法手动 运行 操作。
示例:
models.execute_kw(db, uid, password, 'ir.cron', 'method_direct_trigger', [actions])
url = "ip"
db = "dbname"
username = "user"
password = "admin"
common = xmlrpc.client.ServerProxy('{}/xmlrpc/2/common'.format(url))
uid = common.authenticate(db, username, password, {})
actions = models.execute_kw(db, uid, password, 'ir.cron', 'search', [[['name', '=', 'Mail: Email Queue Manager']]])
print(actions)
Returns [2]
但是我不确定如何运行这个动作?我已尝试查看文档,但没有看到有关如何 运行 执行操作的示例?
您可以通过调用 method_direct_trigger
方法手动 运行 操作。
示例:
models.execute_kw(db, uid, password, 'ir.cron', 'method_direct_trigger', [actions])