diff --git a/fusion_accounting_assets/__manifest__.py b/fusion_accounting_assets/__manifest__.py index c861e57f..8b3f90fd 100644 --- a/fusion_accounting_assets/__manifest__.py +++ b/fusion_accounting_assets/__manifest__.py @@ -1,6 +1,6 @@ { 'name': 'Fusion Accounting Assets', - 'version': '19.0.1.0.25', + 'version': '19.0.1.0.26', 'category': 'Accounting/Accounting', 'summary': 'AI-augmented asset management with depreciation schedules.', 'description': """ @@ -52,6 +52,10 @@ menu hides; the engine + AI tools remain available for the chat. 'fusion_accounting_assets/static/src/components/depreciation_board/depreciation_board.xml', 'fusion_accounting_assets/static/src/components/disposal_dialog/disposal_dialog.js', 'fusion_accounting_assets/static/src/components/disposal_dialog/disposal_dialog.xml', + 'fusion_accounting_assets/static/src/components/ai_useful_life_panel/ai_useful_life_panel.js', + 'fusion_accounting_assets/static/src/components/ai_useful_life_panel/ai_useful_life_panel.xml', + 'fusion_accounting_assets/static/src/components/anomaly_strip/anomaly_strip.js', + 'fusion_accounting_assets/static/src/components/anomaly_strip/anomaly_strip.xml', ], }, 'installable': True, diff --git a/fusion_accounting_assets/static/src/components/ai_useful_life_panel/ai_useful_life_panel.js b/fusion_accounting_assets/static/src/components/ai_useful_life_panel/ai_useful_life_panel.js new file mode 100644 index 00000000..84763365 --- /dev/null +++ b/fusion_accounting_assets/static/src/components/ai_useful_life_panel/ai_useful_life_panel.js @@ -0,0 +1,41 @@ +/** @odoo-module **/ + +import { Component, useState } from "@odoo/owl"; +import { useService } from "@web/core/utils/hooks"; + +export class AiUsefulLifePanel extends Component { + static template = "fusion_accounting_assets.AiUsefulLifePanel"; + static props = { + description: { type: String, optional: true }, + amount: { type: Number, optional: true }, + onSelect: { type: Function, optional: true }, + }; + + setup() { + this.assets = useService("fusion_assets"); + this.state = useState({ + suggestion: null, + isLoading: false, + descInput: this.props.description || '', + amountInput: this.props.amount || '', + }); + } + + async onSuggest() { + this.state.isLoading = true; + try { + this.state.suggestion = await this.assets.suggestUsefulLife( + this.state.descInput, + parseFloat(this.state.amountInput) || null, + ); + } finally { + this.state.isLoading = false; + } + } + + onUseSuggestion() { + if (this.state.suggestion && this.props.onSelect) { + this.props.onSelect(this.state.suggestion); + } + } +} diff --git a/fusion_accounting_assets/static/src/components/ai_useful_life_panel/ai_useful_life_panel.xml b/fusion_accounting_assets/static/src/components/ai_useful_life_panel/ai_useful_life_panel.xml new file mode 100644 index 00000000..8b651bbe --- /dev/null +++ b/fusion_accounting_assets/static/src/components/ai_useful_life_panel/ai_useful_life_panel.xml @@ -0,0 +1,38 @@ + + + + +
+
AI Suggest Useful Life
+
+ + +
+
+ + +
+ + +
+
Suggested life: years
+
Method:
+
+ + (confidence: %) +
+ +
+
+
+ +
diff --git a/fusion_accounting_assets/static/src/components/anomaly_strip/anomaly_strip.js b/fusion_accounting_assets/static/src/components/anomaly_strip/anomaly_strip.js new file mode 100644 index 00000000..5b6362f6 --- /dev/null +++ b/fusion_accounting_assets/static/src/components/anomaly_strip/anomaly_strip.js @@ -0,0 +1,17 @@ +/** @odoo-module **/ + +import { Component } from "@odoo/owl"; + +export class AnomalyStrip extends Component { + static template = "fusion_accounting_assets.AnomalyStrip"; + static props = { + anomaly: { type: Object }, + }; + + formatNumber(n) { + if (n === null || n === undefined) return ""; + return new Intl.NumberFormat(undefined, { + minimumFractionDigits: 0, maximumFractionDigits: 1, + }).format(n); + } +} diff --git a/fusion_accounting_assets/static/src/components/anomaly_strip/anomaly_strip.xml b/fusion_accounting_assets/static/src/components/anomaly_strip/anomaly_strip.xml new file mode 100644 index 00000000..0b8578c6 --- /dev/null +++ b/fusion_accounting_assets/static/src/components/anomaly_strip/anomaly_strip.xml @@ -0,0 +1,19 @@ + + + + +
+ + + + + : + % + + + + +
+
+ +