合并企业版代码(未测试,先提交到测试分支)
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
/** @odoo-module */
|
||||
import { browser } from "@web/core/browser/browser";
|
||||
import { Dialog } from "@web/core/dialog/dialog";
|
||||
import { useChildRef, useService } from "@web/core/utils/hooks";
|
||||
|
||||
const { Component, useExternalListener } = owl;
|
||||
|
||||
export class PromoteStudioDialog extends Component {
|
||||
setup() {
|
||||
this.ormService = useService("orm");
|
||||
this.uiService = useService("ui");
|
||||
|
||||
this.modalRef = useChildRef();
|
||||
|
||||
useExternalListener(window, "mousedown", this.onWindowMouseDown);
|
||||
}
|
||||
|
||||
async onClickInstallStudio() {
|
||||
this.disableClick = true;
|
||||
this.uiService.block();
|
||||
const modules = await this.ormService.searchRead(
|
||||
"ir.module.module",
|
||||
[["name", "=", "web_studio"]],
|
||||
["id"]
|
||||
);
|
||||
await this.ormService.call("ir.module.module", "button_immediate_install", [
|
||||
[modules[0].id],
|
||||
]);
|
||||
// on rpc call return, the framework unblocks the page
|
||||
// make sure to keep the page blocked until the reload ends.
|
||||
this.uiService.unblock();
|
||||
browser.localStorage.setItem("openStudioOnReload", "main");
|
||||
browser.location.reload();
|
||||
}
|
||||
|
||||
/**
|
||||
* Close the dialog on outside click.
|
||||
*/
|
||||
onWindowMouseDown(ev) {
|
||||
const dialogContent = this.modalRef.el.querySelector(".modal-content");
|
||||
if (!this.disableClick && !dialogContent.contains(ev.target)) {
|
||||
this.props.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
PromoteStudioDialog.template = "web_enterprise.PromoteStudioDialog";
|
||||
PromoteStudioDialog.components = { Dialog };
|
||||
@@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<template>
|
||||
|
||||
<t t-name="web_enterprise.PromoteStudioDialog" owl="1">
|
||||
<Dialog title="title" header="false" modalRef="modalRef">
|
||||
<div class="modal-studio">
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close" tabindex="-1" t-on-click="props.close"></button>
|
||||
<h2 class="modal-title">Add new fields and much more with <b>Odoo Studio</b></h2>
|
||||
<div class="o_video_embed">
|
||||
<div class="ratio ratio-16x9">
|
||||
<iframe class="embed-responsive-item" t-attf-src="https://www.youtube.com/embed/xCvFZrrQq7k?autoplay=1" frameborder="0" allowfullscreen="true"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<t t-set-slot="footer">
|
||||
<div class="o_install_studio_btn">
|
||||
<button class="btn btn-primary btn-block o_install_studio" t-on-click.stop="onClickInstallStudio"><b>Install Odoo Studio</b></button>
|
||||
</div>
|
||||
</t>
|
||||
</div>
|
||||
</Dialog>
|
||||
</t>
|
||||
|
||||
</template>
|
||||
Reference in New Issue
Block a user