使用服务器动作返回HTML报表 - xiaohao0576/odoo-doc GitHub Wiki

在服务动作中,返回一个url动作,在新窗口打开HTML报表

# 使用生成器表达式将每个整数转换为字符串,然后用逗号连接
ids = ",".join(map(str, records.ids))

# 定义 URL
url = 'https://moke-mart.odoo.com/report/html/product.product_x_label/' + ids

# 创建 URL 动作
action = {
    'type': 'ir.actions.act_url',
    'url': url,
    'target': 'new'  # 在新的标签页中打开
}