265 lines
14 KiB
XML
265 lines
14 KiB
XML
<?xml version="1.0" encoding="UTF-8"?>
|
|
<odoo>
|
|
|
|
<!-- ============================================ -->
|
|
<!-- 动态报表 - 列表视图 -->
|
|
<!-- ============================================ -->
|
|
<record id="view_ai_report_tree" model="ir.ui.view">
|
|
<field name="name">ai.report.tree</field>
|
|
<field name="model">ai.report</field>
|
|
<field name="arch" type="xml">
|
|
<tree string="动态报表" default_order="create_date desc">
|
|
<field name="name"/>
|
|
<field name="model_name"/>
|
|
<field name="create_uid" string="创建人"/>
|
|
<field name="create_date" string="创建时间"/>
|
|
<field name="expire_date"/>
|
|
<field name="active" widget="boolean_toggle"/>
|
|
</tree>
|
|
</field>
|
|
</record>
|
|
|
|
<!-- ============================================ -->
|
|
<!-- 动态报表 - 表单视图 -->
|
|
<!-- ============================================ -->
|
|
<record id="view_ai_report_form" model="ir.ui.view">
|
|
<field name="name">ai.report.form</field>
|
|
<field name="model">ai.report</field>
|
|
<field name="arch" type="xml">
|
|
<form string="动态报表">
|
|
<sheet>
|
|
<widget name="web_ribbon" title="已停用"
|
|
bg_color="text-bg-danger" invisible="active"/>
|
|
|
|
<div class="oe_title">
|
|
<h1>
|
|
<field name="name" placeholder="报表名称"/>
|
|
</h1>
|
|
</div>
|
|
|
|
<group>
|
|
<group string="查询参数">
|
|
<field name="model_id"
|
|
options="{'no_create': True}"/>
|
|
<field name="model_name" invisible="1"/>
|
|
<field name="domain"/>
|
|
<field name="field_list"/>
|
|
<field name="field_labels"/>
|
|
<field name="order"/>
|
|
<field name="limit" invisible="1"/>
|
|
</group>
|
|
<group string="访问设置">
|
|
<field name="access_token" readonly="1"/>
|
|
<field name="expire_date"/>
|
|
<field name="template_id"/>
|
|
<field name="params"/>
|
|
<field name="active"/>
|
|
</group>
|
|
</group>
|
|
</sheet>
|
|
</form>
|
|
</field>
|
|
</record>
|
|
|
|
<!-- 搜索视图 -->
|
|
<record id="view_ai_report_search" model="ir.ui.view">
|
|
<field name="name">ai.report.search</field>
|
|
<field name="model">ai.report</field>
|
|
<field name="arch" type="xml">
|
|
<search string="搜索报表">
|
|
<field name="name"/>
|
|
<field name="model_name"/>
|
|
<filter name="filter_active" string="有效"
|
|
domain="[('active','=',True),('expire_date','>=', context_today().strftime('%Y-%m-%d'))]"/>
|
|
<filter name="filter_expired" string="已过期"
|
|
domain="[('expire_date','<', context_today().strftime('%Y-%m-%d'))]"/>
|
|
<separator/>
|
|
<group expand="0" string="分组">
|
|
<filter name="group_model" string="数据模型"
|
|
context="{'group_by': 'model_name'}"/>
|
|
<filter name="group_user" string="创建人"
|
|
context="{'group_by': 'create_uid'}"/>
|
|
</group>
|
|
</search>
|
|
</field>
|
|
</record>
|
|
|
|
<!-- Action -->
|
|
<record id="action_ai_report" model="ir.actions.act_window">
|
|
<field name="name">动态报表</field>
|
|
<field name="res_model">ai.report</field>
|
|
<field name="view_mode">tree,form</field>
|
|
</record>
|
|
|
|
<!-- 菜单 → 报表配置 -->
|
|
<menuitem id="menu_ai_report" name="动态报表"
|
|
parent="menu_sys_report" action="action_ai_report" sequence="1"
|
|
groups="yuthon_ai_agent.group_ai_agent_admin"/>
|
|
|
|
<!-- ============================================ -->
|
|
<!-- 报表模板 - 列表视图 -->
|
|
<!-- ============================================ -->
|
|
<record id="view_ai_report_template_tree" model="ir.ui.view">
|
|
<field name="name">ai.report.template.tree</field>
|
|
<field name="model">ai.report.template</field>
|
|
<field name="arch" type="xml">
|
|
<tree string="报表模板">
|
|
<field name="sequence" widget="handle"/>
|
|
<field name="name"/>
|
|
<field name="model_name"/>
|
|
<field name="fixed_report_url_stored" optional="show"/>
|
|
<field name="description"/>
|
|
<field name="active" widget="boolean_toggle"/>
|
|
</tree>
|
|
</field>
|
|
</record>
|
|
|
|
<!-- ============================================ -->
|
|
<!-- 报表模板 - 表单视图 -->
|
|
<!-- ============================================ -->
|
|
<record id="view_ai_report_template_form" model="ir.ui.view">
|
|
<field name="name">ai.report.template.form</field>
|
|
<field name="model">ai.report.template</field>
|
|
<field name="arch" type="xml">
|
|
<form string="报表模板">
|
|
<sheet>
|
|
<widget name="web_ribbon" title="已停用"
|
|
bg_color="text-bg-danger" invisible="active"/>
|
|
|
|
<div class="oe_title">
|
|
<table style="width:100%" cellspacing="0" cellpadding="0" border="0">
|
|
<tr>
|
|
<td style="width:60%">
|
|
<h1>
|
|
<field name="name" placeholder="如:销售订单列表模板"/>
|
|
</h1>
|
|
</td>
|
|
<td style="width:40%;text-align:right;vertical-align:bottom">
|
|
<div class="d-flex flex-nowrap justify-content-end gap-1">
|
|
<button name="action_generate_fixed_report" type="object"
|
|
string="生成链接" class="btn-secondary"
|
|
help="生成永久有效的报表链接,每天凌晨自动刷新"/>
|
|
<button name="action_preview" type="object"
|
|
string="预览报表" class="oe_highlight"
|
|
invisible="not model_name"/>
|
|
<button name="action_init_columns" type="object"
|
|
string="初始化列" class="btn-secondary"
|
|
invisible="not model_name"
|
|
help="从模型的 tree 视图中提取可见字段,批量生成列定义"/>
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
|
|
<group>
|
|
<group string="数据源">
|
|
<field name="model_id"
|
|
placeholder="选择数据模型"
|
|
options="{'no_create': True}"/>
|
|
<field name="model_name" invisible="1"/>
|
|
<field name="description"
|
|
placeholder="描述此模板用途,AI 会根据描述判断何时使用"/>
|
|
<field name="active" invisible="1"/>
|
|
<field name="column_field_ids" invisible="1"/>
|
|
<field name="group_by_ids" widget="many2many_tags"
|
|
domain="[('id', 'in', column_field_ids)]"
|
|
placeholder="添加分组字段..."/>
|
|
<field name="filter_ids" widget="many2many_tags"
|
|
domain="[('id', 'in', column_field_ids)]"
|
|
placeholder="添加筛选器..."/>
|
|
</group>
|
|
<group string="显示字段">
|
|
<!-- <field name="field_ids" widget="many2many_tags"-->
|
|
<!-- domain="[('model_id','=',model_id)]"-->
|
|
<!-- options="{'no_create': True}"-->
|
|
<!-- placeholder="选择要显示的字段(选择后自动生成下方配置)"/>-->
|
|
<field name="field_list" invisible="1"/>
|
|
<field name="field_labels" invisible="1"/>
|
|
<field name="default_order"
|
|
placeholder="date_order desc"/>
|
|
<field name="default_visible"/>
|
|
<field name="default_domain"
|
|
placeholder="[('state','=','sale')]"/>
|
|
<field name="fixed_report_url_stored" readonly="1"
|
|
placeholder="点击『生成链接』按钮生成"
|
|
help="固定报表访问链接,凌晨自动刷新数据"/>
|
|
</group>
|
|
</group>
|
|
|
|
<notebook>
|
|
|
|
|
|
<page string="列定义" name="columns">
|
|
<field name="column_ids" nolabel="1">
|
|
<tree string="列定义" editable="bottom">
|
|
<field name="model_id" column_invisible="1"/>
|
|
<field name="field_id"
|
|
placeholder="选择字段..."
|
|
options="{'no_create': True}"/>
|
|
<field name="label" placeholder="显示名称(可选)"/>
|
|
<field name="color_operator"/>
|
|
<field name="color_value" placeholder="匹配值"/>
|
|
<field name="cell_color" widget="color"/>
|
|
<field name="width"/>
|
|
<field name="sequence" widget="handle"/>
|
|
</tree>
|
|
</field>
|
|
</page>
|
|
|
|
<page string="汇总卡片" name="cards">
|
|
<field name="card_ids" nolabel="1">
|
|
<tree string="汇总卡片" editable="bottom">
|
|
<field name="model_id" column_invisible="1"/>
|
|
<field name="label" placeholder="卡片标签"/>
|
|
<field name="field_id"
|
|
placeholder="选择数值字段..."
|
|
options="{'no_create': True}"/>
|
|
<field name="calc"/>
|
|
<field name="prefix" placeholder="¥"/>
|
|
<field name="unit" placeholder="万"/>
|
|
<field name="sequence" widget="handle"/>
|
|
</tree>
|
|
</field>
|
|
</page>
|
|
|
|
<!-- 图表 tab 已隐藏:前端H5报表自带快速图表控件,无需后端配置 -->
|
|
|
|
<page string="AI 参数" name="params" invisible="1">
|
|
<field name="param_def_ids" nolabel="1">
|
|
<tree string="参数定义" editable="bottom">
|
|
<field name="model_id" column_invisible="1"/>
|
|
<field name="name" placeholder="如 date_from"/>
|
|
<field name="label" placeholder="显示名"/>
|
|
<field name="param_type"/>
|
|
<field name="field_id"
|
|
placeholder="选择映射字段..."
|
|
options="{'no_create': True}"/>
|
|
<field name="domain_field" invisible="1"/>
|
|
<field name="op" placeholder=">=/="/>
|
|
<field name="description" placeholder="AI 提取说明"/>
|
|
<field name="required"/>
|
|
<field name="sequence" widget="handle"/>
|
|
</tree>
|
|
</field>
|
|
</page>
|
|
</notebook>
|
|
</sheet>
|
|
</form>
|
|
</field>
|
|
</record>
|
|
|
|
<!-- Action -->
|
|
<record id="action_ai_report_template" model="ir.actions.act_window">
|
|
<field name="name">报表模板</field>
|
|
<field name="res_model">ai.report.template</field>
|
|
<field name="view_mode">tree,form</field>
|
|
</record>
|
|
|
|
<!-- 菜单 → 报表配置 -->
|
|
<menuitem id="menu_ai_report_template" name="报表模板"
|
|
parent="menu_sys_report" action="action_ai_report_template" sequence="2"
|
|
groups="yuthon_ai_agent.group_ai_agent_admin"/>
|
|
|
|
</odoo>
|