Skip to content

Commit

Permalink
[IMP] base_onboarding: UX block UI instantaneously when activating bu…
Browse files Browse the repository at this point in the history
…ndles
  • Loading branch information
tarteo committed Jan 23, 2025
1 parent 2657089 commit 1baa590
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
14 changes: 14 additions & 0 deletions base_onboarding/static/src/js/backend.esm.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { WebClient } from "@web/webclient/webclient";
import { onMounted } from "@odoo/owl";
import { patch } from "@web/core/utils/patch";
import { useService } from "@web/core/utils/hooks";
import { ViewButton } from '@web/views/view_button/view_button';


patch(WebClient.prototype, "base_onboarding", {
Expand All @@ -25,3 +26,16 @@ patch(WebClient.prototype, "base_onboarding", {
});
}
});

patch(ViewButton.prototype, "base_onboarding", {
setup() {
this._super();
this.uiService = useService("ui");
},
onClick(ev) {
if (this.props.className && this.props.className.includes("base_onboarding_instant_block")) {
this.uiService.block();
}
this._super(ev);
}
});
4 changes: 2 additions & 2 deletions base_onboarding/wizards/onboarding_wizard_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@
<field name="summary"/>
</p>
<div class="oe_module_action d-flex flex-wrap justify-content-between">
<button type="object" class="btn btn-primary btn-sm" context="{'onboarding_wizard': True}" name="button_immediate_install" states="uninstalled" groups="base.group_system">
<button type="object" class="btn btn-primary btn-sm base_onboarding_instant_block" context="{'onboarding_wizard': True}" name="button_immediate_install" states="uninstalled" groups="base.group_system">
Activate
</button>
<button type="object" class="btn btn-secondary btn-sm" context="{'onboarding_wizard': True}" name="button_immediate_uninstall" states="installed" groups="base.group_system">
<button type="object" class="btn btn-secondary btn-sm base_onboarding_instant_block" context="{'onboarding_wizard': True}" name="button_immediate_uninstall" states="installed" groups="base.group_system">
Deactivate
</button>
<button states="to remove" type="object" class="btn btn-sm btn-secondary" name="button_uninstall_cancel" groups="base.group_system">
Expand Down

0 comments on commit 1baa590

Please sign in to comment.