diff --git a/fusion_accounting_assets/__manifest__.py b/fusion_accounting_assets/__manifest__.py index 7bc8ffa0..1ed59efb 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.20', + 'version': '19.0.1.0.21', 'category': 'Accounting/Accounting', 'summary': 'AI-augmented asset management with depreciation schedules.', 'description': """ @@ -41,6 +41,9 @@ menu hides; the engine + AI tools remain available for the chat. 'fusion_accounting_assets/static/src/scss/assets.scss', 'fusion_accounting_assets/static/src/scss/dark_mode.scss', 'fusion_accounting_assets/static/src/services/assets_service.js', + 'fusion_accounting_assets/static/src/views/asset_dashboard/asset_dashboard.js', + 'fusion_accounting_assets/static/src/views/asset_dashboard/asset_dashboard.xml', + 'fusion_accounting_assets/static/src/views/asset_dashboard/asset_dashboard_view.js', ], }, 'installable': True, diff --git a/fusion_accounting_assets/static/src/views/asset_dashboard/asset_dashboard.js b/fusion_accounting_assets/static/src/views/asset_dashboard/asset_dashboard.js new file mode 100644 index 00000000..7ff4048a --- /dev/null +++ b/fusion_accounting_assets/static/src/views/asset_dashboard/asset_dashboard.js @@ -0,0 +1,47 @@ +/** @odoo-module **/ + +import { Component, useState, onWillStart } from "@odoo/owl"; +import { useService } from "@web/core/utils/hooks"; +import { AssetCard } from "../../components/asset_card/asset_card"; +import { AssetDetailPanel } from "../../components/asset_detail_panel/asset_detail_panel"; +import { AnomalyStrip } from "../../components/anomaly_strip/anomaly_strip"; + +export class AssetDashboard extends Component { + static template = "fusion_accounting_assets.AssetDashboard"; + static props = { "*": true }; + static components = { AssetCard, AssetDetailPanel, AnomalyStrip }; + + setup() { + this.assets = useService("fusion_assets"); + this.state = useState(this.assets.state); + + const companyId = this.env.services.user?.context?.allowed_company_ids?.[0]; + + onWillStart(async () => { + await this.assets.loadAssets(companyId); + await this.assets.fetchAnomalies(); + }); + } + + onSelectAsset(id) { + this.assets.selectAsset(id); + } + + onStateFilter(state) { + this.assets.setStateFilter(state || null); + } + + formatCurrency(amount) { + return new Intl.NumberFormat(undefined, { + minimumFractionDigits: 2, maximumFractionDigits: 2, + }).format(amount || 0); + } + + get totalCost() { + return this.state.assets.reduce((sum, a) => sum + a.cost, 0); + } + + get totalBookValue() { + return this.state.assets.reduce((sum, a) => sum + a.book_value, 0); + } +} diff --git a/fusion_accounting_assets/static/src/views/asset_dashboard/asset_dashboard.xml b/fusion_accounting_assets/static/src/views/asset_dashboard/asset_dashboard.xml new file mode 100644 index 00000000..12b6f71f --- /dev/null +++ b/fusion_accounting_assets/static/src/views/asset_dashboard/asset_dashboard.xml @@ -0,0 +1,56 @@ + + + + +
+
+
+

Asset Management

+
+ of assets +
+
+
+
Cost: $
+
Book Value: $
+
+
+ +
+ + + + + +
+ + + +
+
+
Loading...
+
No assets found.
+
+ +
+
+
+ +
Select an asset to see details.
+
+
+
+
+ +
diff --git a/fusion_accounting_assets/static/src/views/asset_dashboard/asset_dashboard_view.js b/fusion_accounting_assets/static/src/views/asset_dashboard/asset_dashboard_view.js new file mode 100644 index 00000000..1194f080 --- /dev/null +++ b/fusion_accounting_assets/static/src/views/asset_dashboard/asset_dashboard_view.js @@ -0,0 +1,14 @@ +/** @odoo-module **/ + +import { registry } from "@web/core/registry"; +import { AssetDashboard } from "./asset_dashboard"; + +export const fusionAssetDashboardView = { + type: "fusion_assets", + Controller: AssetDashboard, + display_name: "Fusion Asset Management", + icon: "fa-cubes", + multiRecord: true, +}; + +registry.category("views").add("fusion_assets", fusionAssetDashboardView);