Files
Odoo-Modules/fusion_accounting/views/match_history_views.xml
gsinghpal 3cc93b8783 changes
2026-04-04 15:37:16 -04:00

138 lines
7.3 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="view_fusion_history_list" model="ir.ui.view">
<field name="name">fusion.accounting.match.history.list</field>
<field name="model">fusion.accounting.match.history</field>
<field name="arch" type="xml">
<list string="Match History" default_order="proposed_at desc">
<field name="proposed_at" string="Date"/>
<field name="session_id" string="Session"/>
<field name="tool_display_name" string="Tool"/>
<field name="tool_name" string="Tool (Code)" optional="hide"/>
<field name="decision" widget="badge"
decoration-success="decision in ('approved', 'auto')"
decoration-danger="decision == 'rejected'"
decoration-warning="decision == 'pending'"/>
<field name="ai_confidence" string="Confidence" widget="progressbar"/>
<field name="amount" string="Amount"/>
<field name="partner_id" string="Partner"/>
<field name="ai_reasoning" string="Reasoning" optional="hide"/>
<field name="decided_by" string="Decided By" optional="hide"/>
<field name="decided_at" string="Decided At" optional="hide"/>
</list>
</field>
</record>
<record id="view_fusion_history_form" model="ir.ui.view">
<field name="name">fusion.accounting.match.history.form</field>
<field name="model">fusion.accounting.match.history</field>
<field name="arch" type="xml">
<form string="Match History">
<header>
<button name="action_approve" string="Approve" type="object"
class="btn-primary" invisible="decision != 'pending'"
groups="fusion_accounting.group_fusion_accounting_manager"/>
<button name="action_reject" string="Reject" type="object"
class="btn-danger" invisible="decision != 'pending'"
groups="fusion_accounting.group_fusion_accounting_manager"/>
<field name="decision" widget="statusbar"
statusbar_visible="pending,approved,rejected,auto"/>
</header>
<sheet>
<div class="oe_title mb-3">
<h1>
<field name="tool_display_name" readonly="1"/>
</h1>
<div class="text-muted small">
Internal: <field name="tool_name" readonly="1" class="d-inline"/>
</div>
</div>
<group>
<group string="Request Details">
<field name="session_id"/>
<field name="proposed_at" string="When"/>
<field name="ai_confidence" widget="progressbar" string="Confidence"/>
<field name="amount"/>
<field name="partner_id"/>
<field name="rule_id" invisible="not rule_id"/>
</group>
<group string="Decision">
<field name="decided_by"/>
<field name="decided_at"/>
<field name="rejection_reason"
invisible="decision != 'rejected'"/>
</group>
</group>
<notebook>
<page string="AI Reasoning" name="reasoning">
<field name="ai_reasoning" widget="text"
placeholder="No AI reasoning recorded for this tool call."
nolabel="1"/>
</page>
<page string="Parameters" name="params">
<field name="tool_params_pretty" widget="text"
nolabel="1" readonly="1"/>
</page>
<page string="Result" name="result">
<field name="tool_result_pretty" widget="text"
nolabel="1" readonly="1"/>
</page>
<page string="Correction" name="correction"
invisible="decision != 'rejected'">
<group>
<field name="rejection_reason" string="Why was this rejected?"/>
<field name="correct_action" widget="text"
string="What should have been done instead?"/>
</group>
</page>
</notebook>
<group string="Linked Records" invisible="not bank_statement_line_id">
<field name="bank_statement_line_id"/>
<field name="move_line_ids" widget="many2many_tags"/>
</group>
</sheet>
</form>
</field>
</record>
<record id="view_fusion_history_search" model="ir.ui.view">
<field name="name">fusion.accounting.match.history.search</field>
<field name="model">fusion.accounting.match.history</field>
<field name="arch" type="xml">
<search>
<field name="tool_name"/>
<field name="partner_id"/>
<field name="session_id"/>
<filter name="pending" string="Pending" domain="[('decision', '=', 'pending')]"/>
<filter name="approved" string="Approved" domain="[('decision', '=', 'approved')]"/>
<filter name="rejected" string="Rejected" domain="[('decision', '=', 'rejected')]"/>
<filter name="auto" string="Auto-Executed" domain="[('decision', '=', 'auto')]"/>
<separator/>
<filter name="today" string="Today" domain="[('proposed_at', '>=', (context_today()).strftime('%Y-%m-%d'))]"/>
<filter name="this_week" string="This Week" domain="[('proposed_at', '>=', (context_today() - datetime.timedelta(days=7)).strftime('%Y-%m-%d'))]"/>
<separator/>
<group>
<filter name="group_tool" string="Tool" domain="[]" context="{'group_by': 'tool_name'}"/>
<filter name="group_decision" string="Decision" domain="[]" context="{'group_by': 'decision'}"/>
<filter name="group_session" string="Session" domain="[]" context="{'group_by': 'session_id'}"/>
</group>
</search>
</field>
</record>
<record id="action_fusion_history" model="ir.actions.act_window">
<field name="name">Match History</field>
<field name="res_model">fusion.accounting.match.history</field>
<field name="view_mode">list,form</field>
<field name="search_view_id" ref="view_fusion_history_search"/>
<field name="context">{'search_default_today': 1}</field>
<field name="help" type="html">
<p class="o_view_nocontent_smiling_face">No match history yet</p>
<p>AI tool calls and their outcomes will appear here.</p>
</field>
</record>
</odoo>