合并企业版代码(未测试,先提交到测试分支)

This commit is contained in:
qihao.gong@jikimo.com
2023-04-14 17:42:23 +08:00
parent 7a7b3d7126
commit d28525526a
1300 changed files with 513579 additions and 5426 deletions

View File

@@ -0,0 +1,63 @@
/** @odoo-module */
import { useService } from "@web/core/utils/hooks";
import { StudioApprovalInfos } from "@web_studio/approval/approval_infos";
const { useState, Component, onWillUnmount, useRef } = owl;
function useOpenExternal() {
const closeFns = [];
function open(_open) {
const close = _open();
closeFns.push(close);
return close;
}
onWillUnmount(() => {
closeFns.forEach((cb) => cb());
});
return open;
}
export class StudioApproval extends Component {
setup() {
this.dialog = useService("dialog");
this.popover = useService("popover");
this.rootRef = useRef("root");
this.openExternal = useOpenExternal();
const approval = this.props.approval;
this.approval = approval;
this.state = useState(approval.state);
}
toggleApprovalInfo() {
if (this.isOpened) {
this.closeInfos();
this.closeInfos = null;
return;
}
const onClose = () => {
this.isOpened = false;
};
if (this.env.isSmall) {
this.closeInfos = this.openExternal(() =>
this.dialog.add(StudioApprovalInfos, { approval: this.approval }, { onClose })
);
} else {
this.closeInfos = this.openExternal(() =>
this.popover.add(
this.rootRef.el,
StudioApprovalInfos,
{ approval: this.approval, isPopover: true },
{ onClose }
)
);
}
}
getEntry(ruleId) {
return this.state.entries.find((e) => e.rule_id[0] === ruleId);
}
}
StudioApproval.template = "StudioApproval";