From 52119a79844f504a445ac3a2b75b14e6cefe1826 Mon Sep 17 00:00:00 2001 From: tarteo Date: Wed, 28 Jun 2023 15:26:57 +0200 Subject: [PATCH] web_help: Improve helpers web_help: Improve helpers fix layout issue fix layout issue --- .../components/help_button/help_button.esm.js | 13 ++++--- .../components/help_button/help_button.xml | 7 ++-- web_help/static/src/helpers.esm.js | 34 ++++++++++++++++--- web_help/static/src/trip.esm.js | 6 +++- web_help/static/src/trip.xml | 4 +-- 5 files changed, 48 insertions(+), 16 deletions(-) diff --git a/web_help/static/src/components/help_button/help_button.esm.js b/web_help/static/src/components/help_button/help_button.esm.js index 24b3a7bed..6e35d751a 100644 --- a/web_help/static/src/components/help_button/help_button.esm.js +++ b/web_help/static/src/components/help_button/help_button.esm.js @@ -2,21 +2,24 @@ import LegacyControlPanel from "web.ControlPanel"; import {ControlPanel} from "@web/search/control_panel/control_panel"; import {findTrip} from "@web_help/helpers.esm"; -import {Component, useState} from "@odoo/owl"; +import {Component, onWillStart, useState} from "@odoo/owl"; import {ActionDialog} from "@web/webclient/actions/action_dialog"; export class HelpButton extends Component { setup() { - const foundTrip = findTrip(this.props.resModel, this.props.viewType); this.state = useState({ - TripClass: foundTrip, + TripClass: null, + }); + onWillStart(async () => { + const foundTrip = await findTrip(this.props.resModel, this.props.viewType); + this.state.TripClass = foundTrip; }); } - onClick() { + async onClick() { const TripClass = this.state.TripClass; const trip = new TripClass(this.env); - trip.setup(); + await trip.setup(); trip.start(); } } diff --git a/web_help/static/src/components/help_button/help_button.xml b/web_help/static/src/components/help_button/help_button.xml index d46fdae6c..029fa32d9 100644 --- a/web_help/static/src/components/help_button/help_button.xml +++ b/web_help/static/src/components/help_button/help_button.xml @@ -3,15 +3,16 @@ - +