fix(tk_construction_management): chatter migration + chart NaN guard + remove debug logs

- 12 oe_chatter <div> blocks migrated to <chatter/> (Odoo 18 modern pattern)
  Removes Missing widget: mail_followers/mail_activity/mail_thread warnings.
- renderGraph guards against empty/all-zero series. ApexCharts was producing
  M NaN NaN SVG paths when total=0 in donut/pie charts. Now shows No data.
- Removed two leftover console.log(..., dasdsa) debug calls in
  static/src/js/construction_dashboard.js.

User-visible: chatter renders cleanly, no SVG NaN console errors, no
debug noise.
This commit is contained in:
OdooSky v3
2026-05-09 10:16:07 +02:00
parent bd01d44be5
commit 07cf26467a
11 changed files with 22 additions and 63 deletions

View File

@@ -45,8 +45,6 @@ export class ConstructionDashboard extends Component {
// args: [false, false],
// });
const result = await this.orm.call("tk.construction.dashboard", "get_construction_state", [false, false]);
console.log(result,'dasdsa');
this.state.stats = result;
this.state.sites = Object.entries(result.con_sites || {}).map(([id, name]) => ({ id, name }));
this.renderCharts(result);
@@ -82,7 +80,6 @@ export class ConstructionDashboard extends Component {
this.state.stats = data;
this.renderCharts(data);
console.log(this.state.stats,'dasdsa');
}
openAction(name, resModel, domain = []) {
@@ -221,6 +218,16 @@ export class ConstructionDashboard extends Component {
renderGraph(el, options) {
if (!el) return;
el.innerHTML = "";
// NaN-guard: ApexCharts emits 'M NaN NaN A NaN' SVG warnings when series is
// empty or all zeros (donut/pie divide by total=0). Show 'No data' instead.
const series = options.series || [];
const hasData = series.some((s) =>
typeof s === 'number' ? s > 0 : (s && s.data && s.data.length > 0)
);
if (!hasData) {
el.innerHTML = '<div class="text-muted text-center p-4">No data</div>';
return;
}
const chart = new ApexCharts(el, options);
chart.render();
}