Compare commits

..

5 Commits

Author SHA1 Message Date
gsinghpal
474485f963 feat(fusion_accounting_followup): ai_text_panel + followup_history_table components
Made-with: Cursor
2026-04-19 21:20:51 -04:00
gsinghpal
da746698c5 feat(fusion_accounting_followup): partner_card + aging_bucket_strip + risk_badge components
Made-with: Cursor
2026-04-19 21:19:52 -04:00
gsinghpal
21f6171162 feat(fusion_accounting_followup): top-level followup_dashboard component
Made-with: Cursor
2026-04-19 21:18:59 -04:00
gsinghpal
86bead48e1 feat(fusion_accounting_followup): followup_service.js reactive frontend service
Made-with: Cursor
2026-04-19 21:17:57 -04:00
gsinghpal
99e4f8e17f feat(fusion_accounting_followup): SCSS foundation for OWL widget
Made-with: Cursor
2026-04-19 21:17:18 -04:00
18 changed files with 775 additions and 1 deletions

View File

@@ -1,6 +1,6 @@
{
'name': 'Fusion Accounting Follow-up',
'version': '19.0.1.0.18',
'version': '19.0.1.0.23',
'category': 'Accounting/Accounting',
'summary': 'AI-augmented customer follow-ups (dunning) for unpaid invoices.',
'description': """
@@ -37,6 +37,23 @@ menu hides; the engine + AI tools remain available for the chat.
],
'assets': {
'web.assets_backend': [
'fusion_accounting_followup/static/src/scss/_variables.scss',
'fusion_accounting_followup/static/src/scss/followup.scss',
'fusion_accounting_followup/static/src/scss/dark_mode.scss',
'fusion_accounting_followup/static/src/services/followup_service.js',
'fusion_accounting_followup/static/src/views/followup_dashboard/followup_dashboard.js',
'fusion_accounting_followup/static/src/views/followup_dashboard/followup_dashboard.xml',
'fusion_accounting_followup/static/src/views/followup_dashboard/followup_dashboard_view.js',
'fusion_accounting_followup/static/src/components/risk_badge/risk_badge.js',
'fusion_accounting_followup/static/src/components/risk_badge/risk_badge.xml',
'fusion_accounting_followup/static/src/components/partner_card/partner_card.js',
'fusion_accounting_followup/static/src/components/partner_card/partner_card.xml',
'fusion_accounting_followup/static/src/components/aging_bucket_strip/aging_bucket_strip.js',
'fusion_accounting_followup/static/src/components/aging_bucket_strip/aging_bucket_strip.xml',
'fusion_accounting_followup/static/src/components/ai_text_panel/ai_text_panel.js',
'fusion_accounting_followup/static/src/components/ai_text_panel/ai_text_panel.xml',
'fusion_accounting_followup/static/src/components/followup_history_table/followup_history_table.js',
'fusion_accounting_followup/static/src/components/followup_history_table/followup_history_table.xml',
],
},
'installable': True,

View File

@@ -0,0 +1,15 @@
/** @odoo-module **/
import { Component } from "@odoo/owl";
export class AgingBucketStrip extends Component {
static template = "fusion_accounting_followup.AgingBucketStrip";
static props = {
aging: { type: Object },
};
bucketWidth(bucket) {
const total = this.props.aging.total_amount || 1;
return ((bucket.amount / total) * 100).toFixed(2) + "%";
}
}

View File

@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<templates xml:space="preserve">
<t t-name="fusion_accounting_followup.AgingBucketStrip">
<div class="mt-2">
<div class="fu-aging-strip">
<div t-foreach="props.aging.buckets" t-as="b" t-key="b.name"
class="bucket" t-att-data-name="b.name"
t-att-style="'width: ' + bucketWidth(b)"
t-att-title="b.name + ': $' + (b.amount or 0).toFixed(2)"/>
</div>
<div class="d-flex justify-content-between text-muted" style="font-size: 0.7rem;">
<span>Current</span>
<span>30</span>
<span>60</span>
<span>90</span>
<span>120+</span>
</div>
</div>
</t>
</templates>

View File

@@ -0,0 +1,10 @@
/** @odoo-module **/
import { Component } from "@odoo/owl";
export class AiTextPanel extends Component {
static template = "fusion_accounting_followup.AiTextPanel";
static props = {
text: { type: Object },
};
}

View File

@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<templates xml:space="preserve">
<t t-name="fusion_accounting_followup.AiTextPanel">
<div class="fu-ai-text-panel mt-3">
<h5>AI-Generated Follow-up Text</h5>
<div class="ai-subject">
Subject: <t t-esc="props.text.subject"/>
</div>
<div class="ai-body">
<t t-esc="props.text.body"/>
</div>
<div class="key-points" t-if="props.text.key_points and props.text.key_points.length">
<strong>Key points:</strong>
<ul>
<li t-foreach="props.text.key_points" t-as="point" t-key="point_index">
<t t-esc="point"/>
</li>
</ul>
</div>
<div class="text-muted mt-2" style="font-size: 0.75rem;">
Tone used: <t t-esc="props.text.tone_used or props.text.tone or 'gentle'"/>
</div>
</div>
</t>
</templates>

View File

@@ -0,0 +1,15 @@
/** @odoo-module **/
import { Component } from "@odoo/owl";
export class FollowupHistoryTable extends Component {
static template = "fusion_accounting_followup.FollowupHistoryTable";
static props = {
history: { type: Object },
};
formatDate(s) {
if (!s) return "";
return s.slice(0, 10);
}
}

View File

@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<templates xml:space="preserve">
<t t-name="fusion_accounting_followup.FollowupHistoryTable">
<div class="mt-4">
<h5>Follow-up History (<t t-esc="props.history.count or 0"/>)</h5>
<table t-if="props.history.runs and props.history.runs.length" class="fu-history-table">
<thead>
<tr>
<th>Date</th>
<th>Level</th>
<th>Tone</th>
<th>State</th>
<th class="text-end">Overdue</th>
</tr>
</thead>
<tbody>
<tr t-foreach="props.history.runs" t-as="run" t-key="run.id">
<td><t t-esc="formatDate(run.date)"/></td>
<td><t t-esc="run.level_name or '-'"/></td>
<td><t t-esc="run.tone_used or '-'"/></td>
<td><t t-esc="run.state"/></td>
<td class="text-end">
<t t-if="run.overdue_amount">$<t t-esc="run.overdue_amount.toFixed(2)"/></t>
</td>
</tr>
</tbody>
</table>
<div t-else="" class="text-muted">No history yet.</div>
</div>
</t>
</templates>

View File

@@ -0,0 +1,15 @@
/** @odoo-module **/
import { Component } from "@odoo/owl";
import { RiskBadge } from "../risk_badge/risk_badge";
export class PartnerCard extends Component {
static template = "fusion_accounting_followup.PartnerCard";
static props = {
partner: { type: Object },
selected: { type: Boolean, optional: true },
onSelect: { type: Function },
formatCurrency: { type: Function },
};
static components = { RiskBadge };
}

View File

@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8"?>
<templates xml:space="preserve">
<t t-name="fusion_accounting_followup.PartnerCard">
<div class="o_fusion_followup_card"
t-att-class="props.selected ? 'selected' : ''"
t-on-click="props.onSelect">
<div class="o_fusion_followup_card_header">
<div class="partner-name"><t t-esc="props.partner.partner_name"/></div>
<div>
<span class="fu-status-badge" t-att-data-status="props.partner.status">
<t t-esc="props.partner.status"/>
</span>
</div>
</div>
<div class="partner-numbers">
<div>
<span class="label">Overdue:</span>
<span class="value">$<t t-esc="props.formatCurrency(props.partner.overdue_amount)"/></span>
</div>
<div>
<span class="label">Lines:</span>
<span class="value"><t t-esc="props.partner.overdue_line_count or 0"/></span>
</div>
<div>
<span class="label">Risk:</span>
<RiskBadge band="props.partner.risk_band" score="props.partner.risk_score"/>
</div>
<div t-if="props.partner.last_level_name">
<span class="label">Last:</span>
<span class="value"><t t-esc="props.partner.last_level_name"/></span>
</div>
</div>
</div>
</t>
</templates>

View File

@@ -0,0 +1,11 @@
/** @odoo-module **/
import { Component } from "@odoo/owl";
export class RiskBadge extends Component {
static template = "fusion_accounting_followup.RiskBadge";
static props = {
band: { type: String, optional: true },
score: { type: Number, optional: true },
};
}

View File

@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<templates xml:space="preserve">
<t t-name="fusion_accounting_followup.RiskBadge">
<span class="fu-risk-badge" t-att-data-band="props.band || 'low'">
<t t-esc="props.band || 'low'"/>
<t t-if="props.score !== undefined"> (<t t-esc="props.score"/>)</t>
</span>
</t>
</templates>

View File

@@ -0,0 +1,51 @@
// Fusion follow-up design tokens (extends Phases 1-3 tokens for consistency).
$fu-bg-primary: #ffffff;
$fu-bg-secondary: #f9fafb;
$fu-bg-tertiary: #f3f4f6;
$fu-border: #e5e7eb;
$fu-text-primary: #111827;
$fu-text-secondary: #6b7280;
$fu-text-muted: #9ca3af;
$fu-accent: #3b82f6;
$fu-accent-bg: #eff6ff;
// Status colors
$fu-status-no-action: #6b7280;
$fu-status-action-due: #f59e0b;
$fu-status-paused: #6366f1;
$fu-status-blocked: #ef4444;
$fu-status-with-credit: #8b5cf6;
// Risk band colors
$fu-risk-low: #10b981;
$fu-risk-low-bg: #ecfdf5;
$fu-risk-medium: #f59e0b;
$fu-risk-medium-bg: #fffbeb;
$fu-risk-high: #ef4444;
$fu-risk-high-bg: #fef2f2;
$fu-risk-critical: #b91c1c;
$fu-risk-critical-bg: #fef2f2;
// Aging bucket colors (escalating intensity)
$fu-bucket-current: #10b981;
$fu-bucket-1-30: #fbbf24;
$fu-bucket-31-60: #f59e0b;
$fu-bucket-61-90: #ef4444;
$fu-bucket-91-120: #dc2626;
$fu-bucket-120-plus: #7f1d1d;
$fu-space-1: 0.25rem;
$fu-space-2: 0.5rem;
$fu-space-3: 0.75rem;
$fu-space-4: 1rem;
$fu-space-6: 1.5rem;
$fu-font-size-xs: 0.75rem;
$fu-font-size-sm: 0.875rem;
$fu-font-size-base: 1rem;
$fu-font-size-lg: 1.125rem;
$fu-font-size-xl: 1.25rem;
$fu-border-radius: 0.375rem;
$fu-border-radius-md: 0.5rem;

View File

@@ -0,0 +1,27 @@
// Variables come from _variables.scss (loaded first in the asset bundle).
[data-color-scheme="dark"] .o_fusion_followup {
background: #1f2937; color: #f9fafb;
&_header, &_card, .fu-ai-text-panel {
background: #111827; border-color: #374151; color: #f9fafb;
}
&_card {
&:hover { border-color: #60a5fa; }
&.selected { background: #1e3a8a; border-color: #60a5fa; }
.partner-numbers .label { color: #9ca3af; }
.partner-numbers .value { color: #f9fafb; }
}
.btn_fu {
background: #374151; border-color: #4b5563; color: #f9fafb;
&:hover { background: #4b5563; }
&.primary { background: #3b82f6; }
}
.fu-ai-text-panel {
.ai-subject { background: #1e3a8a; }
.ai-body { background: #1f2937; }
}
}

View File

@@ -0,0 +1,190 @@
// Variables come from _variables.scss (loaded first in the asset bundle).
.o_fusion_followup {
background: $fu-bg-secondary;
min-height: 100vh;
&_header {
background: $fu-bg-primary;
border-bottom: 1px solid $fu-border;
padding: $fu-space-4 $fu-space-6;
display: flex;
justify-content: space-between;
align-items: center;
h1 { font-size: $fu-font-size-xl; margin: 0; }
.summary {
display: flex;
gap: $fu-space-6;
font-size: $fu-font-size-sm;
color: $fu-text-secondary;
.summary-value {
font-weight: 600;
color: $fu-text-primary;
margin-left: $fu-space-1;
}
}
}
&_card {
background: $fu-bg-primary;
border: 1px solid $fu-border;
border-radius: $fu-border-radius-md;
padding: $fu-space-4;
margin-bottom: $fu-space-3;
cursor: pointer;
transition: all 200ms ease-in-out;
&:hover {
border-color: $fu-accent;
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}
&.selected {
border-color: $fu-accent;
background: $fu-accent-bg;
}
&_header {
display: flex;
justify-content: space-between;
align-items: flex-start;
margin-bottom: $fu-space-2;
.partner-name {
font-weight: 600;
font-size: $fu-font-size-base;
}
}
.partner-numbers {
display: grid;
grid-template-columns: 1fr 1fr;
gap: $fu-space-2;
font-size: $fu-font-size-sm;
color: $fu-text-secondary;
.label { font-weight: 500; margin-right: $fu-space-2; }
.value { color: $fu-text-primary; font-weight: 500; }
}
}
.btn_fu {
padding: $fu-space-2 $fu-space-4;
border-radius: $fu-border-radius;
background: $fu-bg-primary;
border: 1px solid $fu-border;
color: $fu-text-primary;
font-size: $fu-font-size-sm;
cursor: pointer;
&:hover { background: $fu-bg-tertiary; }
&.primary { background: $fu-accent; border-color: $fu-accent; color: white;
&:hover { background: darken($fu-accent, 8%); } }
&.danger { background: $fu-status-blocked; border-color: $fu-status-blocked; color: white; }
}
}
.fu-status-badge {
padding: $fu-space-1 $fu-space-2;
border-radius: $fu-border-radius;
font-size: $fu-font-size-xs;
font-weight: 500;
text-transform: uppercase;
&[data-status="no_action"] { background: lighten($fu-status-no-action, 40%); color: $fu-status-no-action; }
&[data-status="action_due"] { background: lighten($fu-status-action-due, 35%); color: $fu-status-action-due; }
&[data-status="paused"] { background: lighten($fu-status-paused, 35%); color: $fu-status-paused; }
&[data-status="blocked"] { background: lighten($fu-status-blocked, 35%); color: $fu-status-blocked; }
&[data-status="with_credit_team"] { background: lighten($fu-status-with-credit, 35%); color: $fu-status-with-credit; }
}
.fu-risk-badge {
display: inline-flex;
align-items: center;
padding: $fu-space-1 $fu-space-2;
border-radius: $fu-border-radius;
font-weight: 600;
font-size: $fu-font-size-xs;
&[data-band="low"] { background: $fu-risk-low-bg; color: $fu-risk-low; }
&[data-band="medium"] { background: $fu-risk-medium-bg; color: $fu-risk-medium; }
&[data-band="high"] { background: $fu-risk-high-bg; color: $fu-risk-high; }
&[data-band="critical"] { background: $fu-risk-critical-bg; color: $fu-risk-critical; font-weight: 700; }
}
.fu-aging-strip {
display: flex;
gap: 2px;
height: 8px;
border-radius: $fu-border-radius;
overflow: hidden;
margin: $fu-space-2 0;
.bucket {
height: 100%;
&[data-name="current"] { background: $fu-bucket-current; }
&[data-name="1_30"] { background: $fu-bucket-1-30; }
&[data-name="31_60"] { background: $fu-bucket-31-60; }
&[data-name="61_90"] { background: $fu-bucket-61-90; }
&[data-name="91_120"] { background: $fu-bucket-91-120; }
&[data-name="120_plus"] { background: $fu-bucket-120-plus; }
}
}
.fu-ai-text-panel {
background: $fu-bg-primary;
border: 1px solid $fu-border;
border-radius: $fu-border-radius-md;
padding: $fu-space-4;
h5 { margin: 0 0 $fu-space-2; font-size: $fu-font-size-base; }
.ai-subject {
font-weight: 600;
margin-bottom: $fu-space-2;
padding: $fu-space-2;
background: $fu-accent-bg;
border-radius: $fu-border-radius;
}
.ai-body {
white-space: pre-wrap;
font-family: monospace;
font-size: $fu-font-size-sm;
padding: $fu-space-3;
background: $fu-bg-secondary;
border-radius: $fu-border-radius;
max-height: 300px;
overflow-y: auto;
}
.key-points {
margin-top: $fu-space-3;
font-size: $fu-font-size-sm;
color: $fu-text-secondary;
ul { margin: 0; padding-left: $fu-space-4; }
}
}
.fu-history-table {
width: 100%;
font-size: $fu-font-size-sm;
th {
background: $fu-bg-tertiary;
padding: $fu-space-2 $fu-space-3;
text-align: left;
font-weight: 600;
color: $fu-text-secondary;
}
td {
padding: $fu-space-2 $fu-space-3;
border-bottom: 1px solid lighten($fu-border, 5%);
}
}

View File

@@ -0,0 +1,145 @@
/** @odoo-module **/
import { registry } from "@web/core/registry";
import { reactive } from "@odoo/owl";
const ENDPOINT_BASE = "/fusion/followup";
export class FollowupService {
constructor(env, services) {
this.env = env;
this.rpc = services.rpc;
this.notification = services.notification;
this.state = reactive({
partners: [],
count: 0,
total: 0,
statusFilter: null,
isLoading: false,
isProcessing: false,
selectedPartnerId: null,
selectedDetail: null,
companyId: null,
limit: 50,
offset: 0,
generatedText: null,
});
}
async loadOverdue(companyId = null) {
this.state.companyId = companyId;
this.state.isLoading = true;
try {
const result = await this.rpc(`${ENDPOINT_BASE}/list_overdue`, {
status: this.state.statusFilter,
limit: this.state.limit,
offset: this.state.offset,
company_id: companyId,
});
this.state.partners = result.partners;
this.state.count = result.count;
this.state.total = result.total;
} finally {
this.state.isLoading = false;
}
}
async selectPartner(partnerId) {
this.state.selectedPartnerId = partnerId;
this.state.selectedDetail = null;
this.state.generatedText = null;
try {
this.state.selectedDetail = await this.rpc(`${ENDPOINT_BASE}/get_partner_detail`, {
partner_id: partnerId,
});
} catch (err) {
this.notification.add(`Failed to load partner detail: ${err.message || err}`, { type: "danger" });
}
}
async generateText(partnerId, levelId = null, forceRegenerate = false) {
this.state.isProcessing = true;
try {
this.state.generatedText = await this.rpc(`${ENDPOINT_BASE}/generate_text`, {
partner_id: partnerId, level_id: levelId,
force_regenerate: forceRegenerate,
});
return this.state.generatedText;
} catch (err) {
this.notification.add(`Generate failed: ${err.message || err}`, { type: "danger" });
throw err;
} finally {
this.state.isProcessing = false;
}
}
async sendFollowup(partnerId, levelId = null, force = false) {
this.state.isProcessing = true;
try {
const result = await this.rpc(`${ENDPOINT_BASE}/send`, {
partner_id: partnerId, level_id: levelId, force: force,
});
const status = result.status || "unknown";
const type = status === "sent" ? "success" : status.startsWith("paused") ? "warning" : "info";
this.notification.add(`Send result: ${status}`, { type: type });
if (this.state.selectedPartnerId === partnerId) {
await this.selectPartner(partnerId);
}
await this.loadOverdue(this.state.companyId);
return result;
} catch (err) {
this.notification.add(`Send failed: ${err.message || err}`, { type: "danger" });
throw err;
} finally {
this.state.isProcessing = false;
}
}
async pausePartner(partnerId, untilDate = null) {
try {
const result = await this.rpc(`${ENDPOINT_BASE}/pause`, {
partner_id: partnerId, until_date: untilDate,
});
this.notification.add(`Paused until ${result.paused_until}`, { type: "info" });
if (this.state.selectedPartnerId === partnerId) {
await this.selectPartner(partnerId);
}
await this.loadOverdue(this.state.companyId);
return result;
} catch (err) {
this.notification.add(`Pause failed: ${err.message || err}`, { type: "danger" });
throw err;
}
}
async resetPartner(partnerId) {
try {
const result = await this.rpc(`${ENDPOINT_BASE}/reset`, {
partner_id: partnerId,
});
this.notification.add(`Reset`, { type: "info" });
if (this.state.selectedPartnerId === partnerId) {
await this.selectPartner(partnerId);
}
await this.loadOverdue(this.state.companyId);
return result;
} catch (err) {
this.notification.add(`Reset failed: ${err.message || err}`, { type: "danger" });
throw err;
}
}
setStatusFilter(status) {
this.state.statusFilter = status;
this.state.offset = 0;
this.loadOverdue(this.state.companyId);
}
}
export const followupService = {
dependencies: ["rpc", "notification"],
start(env, services) { return new FollowupService(env, services); },
};
registry.category("services").add("fusion_followup", followupService);

View File

@@ -0,0 +1,69 @@
/** @odoo-module **/
import { Component, useState, onWillStart } from "@odoo/owl";
import { useService } from "@web/core/utils/hooks";
import { PartnerCard } from "../../components/partner_card/partner_card";
import { AgingBucketStrip } from "../../components/aging_bucket_strip/aging_bucket_strip";
import { RiskBadge } from "../../components/risk_badge/risk_badge";
import { AiTextPanel } from "../../components/ai_text_panel/ai_text_panel";
import { FollowupHistoryTable } from "../../components/followup_history_table/followup_history_table";
export class FollowupDashboard extends Component {
static template = "fusion_accounting_followup.FollowupDashboard";
static props = { "*": true };
static components = { PartnerCard, AgingBucketStrip, RiskBadge, AiTextPanel, FollowupHistoryTable };
setup() {
this.followup = useService("fusion_followup");
this.state = useState(this.followup.state);
const companyId = this.env.services.user?.context?.allowed_company_ids?.[0];
onWillStart(async () => {
await this.followup.loadOverdue(companyId);
});
}
onSelectPartner(partnerId) {
this.followup.selectPartner(partnerId);
}
onStatusFilter(status) {
this.followup.setStatusFilter(status || null);
}
async onGenerateText() {
if (!this.state.selectedPartnerId) return;
await this.followup.generateText(this.state.selectedPartnerId);
}
async onSend() {
if (!this.state.selectedPartnerId) return;
await this.followup.sendFollowup(this.state.selectedPartnerId, null, true);
}
async onPause() {
if (!this.state.selectedPartnerId) return;
const days = parseInt(prompt("Pause for how many days?", "30"));
if (isNaN(days)) return;
const until = new Date();
until.setDate(until.getDate() + days);
await this.followup.pausePartner(
this.state.selectedPartnerId, until.toISOString().slice(0, 10));
}
async onReset() {
if (!this.state.selectedPartnerId) return;
await this.followup.resetPartner(this.state.selectedPartnerId);
}
formatCurrency(amount) {
return new Intl.NumberFormat(undefined, {
minimumFractionDigits: 2, maximumFractionDigits: 2,
}).format(amount || 0);
}
get totalOverdue() {
return this.state.partners.reduce((sum, p) => sum + (p.overdue_amount || 0), 0);
}
}

View File

@@ -0,0 +1,65 @@
<?xml version="1.0" encoding="UTF-8"?>
<templates xml:space="preserve">
<t t-name="fusion_accounting_followup.FollowupDashboard">
<div class="o_fusion_followup">
<div class="o_fusion_followup_header">
<div>
<h1>Customer Follow-ups</h1>
<div class="text-muted"><t t-esc="state.count"/> of <t t-esc="state.total"/> partners with overdue</div>
</div>
<div class="summary">
<div>Total overdue: <span class="summary-value">$<t t-esc="formatCurrency(totalOverdue)"/></span></div>
</div>
</div>
<div class="d-flex" style="gap: 0.5rem; padding: 0.75rem;">
<button class="btn_fu" t-on-click="() => this.onStatusFilter(null)"
t-att-class="state.statusFilter === null ? 'primary' : ''">All</button>
<button class="btn_fu" t-on-click="() => this.onStatusFilter('action_due')"
t-att-class="state.statusFilter === 'action_due' ? 'primary' : ''">Action Due</button>
<button class="btn_fu" t-on-click="() => this.onStatusFilter('paused')"
t-att-class="state.statusFilter === 'paused' ? 'primary' : ''">Paused</button>
<button class="btn_fu" t-on-click="() => this.onStatusFilter('blocked')"
t-att-class="state.statusFilter === 'blocked' ? 'primary' : ''">Blocked</button>
</div>
<div class="d-flex" style="gap: 1rem; padding: 1rem;">
<div style="flex: 1 1 50%;">
<div t-if="state.isLoading" class="text-center p-4 text-muted">Loading...</div>
<div t-elif="state.partners.length === 0" class="text-center p-4 text-muted">No overdue partners.</div>
<div t-else="">
<PartnerCard t-foreach="state.partners" t-as="partner" t-key="partner.partner_id"
partner="partner" selected="state.selectedPartnerId === partner.partner_id"
onSelect="() => this.onSelectPartner(partner.partner_id)"
formatCurrency="formatCurrency.bind(this)"/>
</div>
</div>
<div style="flex: 1 1 50%;">
<div t-if="state.selectedDetail">
<h3><t t-esc="state.selectedDetail.partner.name"/></h3>
<div class="text-muted">
<t t-if="state.selectedDetail.partner.email"><t t-esc="state.selectedDetail.partner.email"/></t>
</div>
<div class="mt-2">
<RiskBadge band="state.selectedDetail.partner.risk_band"
score="state.selectedDetail.partner.risk_score"/>
</div>
<AgingBucketStrip aging="state.selectedDetail.overdue.aging"/>
<div class="d-flex mt-3" style="gap: 0.5rem; flex-wrap: wrap;">
<button class="btn_fu" t-on-click="onGenerateText">Generate Text</button>
<button class="btn_fu primary" t-on-click="onSend">Send Now</button>
<button class="btn_fu" t-on-click="onPause">Pause</button>
<button class="btn_fu" t-on-click="onReset">Reset</button>
</div>
<AiTextPanel t-if="state.generatedText" text="state.generatedText"/>
<FollowupHistoryTable t-if="state.selectedDetail.history"
history="state.selectedDetail.history"/>
</div>
<div t-else="" class="p-4 text-muted">Select a partner.</div>
</div>
</div>
</div>
</t>
</templates>

View File

@@ -0,0 +1,14 @@
/** @odoo-module **/
import { registry } from "@web/core/registry";
import { FollowupDashboard } from "./followup_dashboard";
export const fusionFollowupDashboardView = {
type: "fusion_followup",
Controller: FollowupDashboard,
display_name: "Fusion Customer Follow-ups",
icon: "fa-bell",
multiRecord: true,
};
registry.category("views").add("fusion_followup", fusionFollowupDashboardView);