mirror of
https://github.com/guohuadeng/app-odoo.git
synced 2025-02-23 04:11:36 +02:00
update odoo customize, misc
This commit is contained in:
@@ -77,8 +77,11 @@
|
||||
'app_odoo_customize/static/src/js/user_menu.js',
|
||||
'app_odoo_customize/static/src/js/ribbon.js',
|
||||
'app_odoo_customize/static/src/js/dialog.js',
|
||||
'app_odoo_customize/static/src/js/web_dialog_size.js',
|
||||
'app_odoo_customize/static/src/webclient/*.js',
|
||||
'app_odoo_customize/static/src/webclient/*.xml',
|
||||
'app_odoo_customize/static/src/xml/res_config_edition.xml',
|
||||
'app_odoo_customize/static/src/xml/web_dialog_size.xml',
|
||||
],
|
||||
},
|
||||
'pre_init_hook': 'pre_init_hook',
|
||||
@@ -130,7 +133,7 @@
|
||||
35. Fixed for odoo 14.
|
||||
36. Add refresh translate for multi module.
|
||||
37. Easy noupdate manage for External Identifiers(xml_id)
|
||||
38. Add Draggable Dialog enable.
|
||||
38. Add Draggable and sizeable Dialog enable.
|
||||
39. Only erp manager can see debug menu..
|
||||
40. Fix support for enterprise version.
|
||||
41. Fix odoo bug, when click Preferences menu not hide in mobile.
|
||||
@@ -183,7 +186,7 @@
|
||||
35. 优化至odoo14适用
|
||||
36. 可为多个模块强制更新翻译
|
||||
37. noupdate字段的快速管理,主要针对 xml_id
|
||||
38. 对话框可拖拽
|
||||
38. 对话框可拖拽,可缩放,自动大屏优化
|
||||
39. 只有系统管理员可以操作快速debug
|
||||
40. 增强对企业版的支持
|
||||
41. 修正odoo原生移动端菜单bug,点击个人设置时,原菜单不隐藏等
|
||||
|
||||
@@ -293,6 +293,18 @@
|
||||
<div class="oe_demo oe_screenshot img img-fluid">
|
||||
<img src="setmodule2.png"/>
|
||||
</div>
|
||||
<h4 class="oe_slogan">Easy Export translate follow your language</h4>
|
||||
<div class="oe_demo oe_screenshot img img-fluid">
|
||||
<img src="setmodule3.png"/>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<section class="oe_container container">
|
||||
<div class="oe_row oe_spaced">
|
||||
<h1 class="text-danger text-center"> Add Draggable and sizeable Dialog enable.</h1>
|
||||
<div class="oe_demo oe_screenshot img img-fluid">
|
||||
<img src="setdialog.gif"/>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
|
||||
BIN
app_odoo_customize/static/description/setdialog.gif
Normal file
BIN
app_odoo_customize/static/description/setdialog.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.8 MiB |
BIN
app_odoo_customize/static/description/setmodule3.png
Normal file
BIN
app_odoo_customize/static/description/setmodule3.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 147 KiB |
@@ -1,18 +1,92 @@
|
||||
/** @odoo-module **/
|
||||
|
||||
import { Dialog } from "@web/core/dialog/dialog";
|
||||
import {ActionDialog} from "@web/webclient/actions/action_dialog";
|
||||
import {Component, onMounted} from "@odoo/owl";
|
||||
import {SelectCreateDialog} from "@web/views/view_dialogs/select_create_dialog";
|
||||
import { patch } from "@web/core/utils/patch";
|
||||
import { session } from "@web/session";
|
||||
|
||||
export class ExpandButton extends Component {
|
||||
setup() {
|
||||
this.last_size = this.props.getsize();
|
||||
}
|
||||
|
||||
dialog_button_extend() {
|
||||
this.props.setsize("dialog_full_screen");
|
||||
this.render();
|
||||
}
|
||||
|
||||
dialog_button_restore() {
|
||||
this.props.setsize(this.last_size);
|
||||
this.render();
|
||||
}
|
||||
}
|
||||
|
||||
ExpandButton.template = "app_odoo_customize.ExpandButton";
|
||||
|
||||
Object.assign(ActionDialog.components, {ExpandButton});
|
||||
SelectCreateDialog.components = Object.assign(SelectCreateDialog.components || {}, {
|
||||
ExpandButton,
|
||||
});
|
||||
Dialog.components = Object.assign(Dialog.components || {}, {ExpandButton});
|
||||
// Patch annoying validation method
|
||||
Dialog.props.size.validate = (s) => ["sm", "md", "lg", "xl", "dialog_full_screen"].includes(s);
|
||||
|
||||
//处理 owl patch
|
||||
patch(Dialog.prototype, "app_odoo_customize.Dialog", {
|
||||
setup() {
|
||||
this._super.apply(this, arguments);
|
||||
const app_system_name = session.app_system_name || "odooApp";
|
||||
this.title = app_system_name;
|
||||
this.setSize = this.setSize.bind(this);
|
||||
this.getSize = this.getSize.bind(this);
|
||||
|
||||
owl.onMounted(() => {
|
||||
this.setDrag();
|
||||
});
|
||||
},
|
||||
|
||||
setSize(size) {
|
||||
this.props.size = size;
|
||||
this.render();
|
||||
},
|
||||
|
||||
getSize() {
|
||||
return this.props.size;
|
||||
},
|
||||
|
||||
setDrag() {
|
||||
var $dl = $('#' + this.id + ' .modal-dialog .modal-content');
|
||||
if ($dl)
|
||||
$dl.draggable({
|
||||
handle: ".modal-header"
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
patch(SelectCreateDialog.prototype, "app_odoo_customize.SelectCreateDialog", {
|
||||
setup() {
|
||||
this._super.apply(this, arguments);
|
||||
const app_system_name = session.app_system_name || "odooApp";
|
||||
this.title = app_system_name;
|
||||
this.setSize = this.setSize.bind(this);
|
||||
this.getSize = this.getSize.bind(this);
|
||||
|
||||
owl.onMounted(() => {
|
||||
this.setDrag();
|
||||
});
|
||||
},
|
||||
|
||||
setSize(size) {
|
||||
this.props.size = size;
|
||||
this.render();
|
||||
},
|
||||
|
||||
getSize() {
|
||||
return this.props.size;
|
||||
},
|
||||
|
||||
setDrag() {
|
||||
var $dl = $('#' + this.id + ' .modal-dialog .modal-content');
|
||||
if ($dl)
|
||||
|
||||
56
app_odoo_customize/static/src/js/web_dialog_size.js
Normal file
56
app_odoo_customize/static/src/js/web_dialog_size.js
Normal file
@@ -0,0 +1,56 @@
|
||||
odoo.define("app_odoo_customize.web_dialog_size", function (require) {
|
||||
"use strict";
|
||||
|
||||
var Dialog = require("web.Dialog");
|
||||
|
||||
Dialog.include({
|
||||
willStart: function () {
|
||||
var self = this;
|
||||
return this._super.apply(this, arguments).then(function () {
|
||||
self.$modal
|
||||
.find(".dialog_button_extend")
|
||||
.on("click", self.proxy("_extending"));
|
||||
self.$modal
|
||||
.find(".dialog_button_restore")
|
||||
.on("click", self.proxy("_restore"));
|
||||
});
|
||||
},
|
||||
|
||||
opened: function () {
|
||||
return this._super.apply(this, arguments).then(
|
||||
function () {
|
||||
if (this.$modal) {
|
||||
this.$modal.find(">:first-child").draggable({
|
||||
handle: ".modal-header",
|
||||
helper: false,
|
||||
});
|
||||
}
|
||||
}.bind(this)
|
||||
);
|
||||
},
|
||||
|
||||
close: function () {
|
||||
if (this.$modal) {
|
||||
var draggable = this.$modal.find(">:first-child").draggable("instance");
|
||||
if (draggable) {
|
||||
this.$modal.find(">:first-child").draggable("destroy");
|
||||
}
|
||||
}
|
||||
return this._super.apply(this, arguments);
|
||||
},
|
||||
|
||||
_extending: function () {
|
||||
var dialog = this.$modal.find(".modal-dialog");
|
||||
dialog.addClass("dialog_full_screen");
|
||||
dialog.find(".dialog_button_extend").hide();
|
||||
dialog.find(".dialog_button_restore").show();
|
||||
},
|
||||
|
||||
_restore: function () {
|
||||
var dialog = this.$modal.find(".modal-dialog");
|
||||
dialog.removeClass("dialog_full_screen");
|
||||
dialog.find(".dialog_button_restore").hide();
|
||||
dialog.find(".dialog_button_extend").show();
|
||||
},
|
||||
});
|
||||
});
|
||||
@@ -4,4 +4,20 @@
|
||||
cursor: move;
|
||||
}
|
||||
}
|
||||
|
||||
.modal-dialog_full_screen {
|
||||
@include media-breakpoint-up(sm) {
|
||||
max-width: 100%;
|
||||
width: calc(100% - 50px);
|
||||
}
|
||||
}
|
||||
|
||||
.dialog_button_restore,
|
||||
.dialog_button_extend {
|
||||
margin-left: auto;
|
||||
|
||||
+ .btn-close {
|
||||
margin: -8px -8px -8px 0px;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<templates xml:space="preserve">
|
||||
<!--owl 处理继承继承-->
|
||||
<t t-inherit="web.UserMenu" t-inherit-mode="extension" owl="1">
|
||||
<xpath expr="//td[hasclass('client-line-email')]" position="after">
|
||||
<t t-jquery="a[data-menu='documentation']" t-operation="before">
|
||||
<switch-lang/>
|
||||
<a role="menuitem" href="#" data-menu="debug" class="dropdown-item">Activate the developer mode</a>
|
||||
<a role="menuitem" href="#" data-menu="debugassets" class="dropdown-item">Activate the developer mode (with assets)</a>
|
||||
<a role="menuitem" href="#" data-menu="quitdebug" class="dropdown-item">Deactivate the developer mode</a>
|
||||
<div role="separator" class="dropdown-divider"/>
|
||||
<a role="menuitem" href="#" data-menu="documentation_dev" class="dropdown-item">Developer Manual</a>
|
||||
</t>
|
||||
</xpath>
|
||||
</t>
|
||||
</templates>
|
||||
@@ -1,10 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<templates xml:space="preserve">
|
||||
<t t-extend="res_config_edition">
|
||||
<t t-jquery=".user-heading h3" t-operation="replace">
|
||||
<h3>
|
||||
odooAi <t t-esc="widget.server_version"/> (odooai.cn Edition)
|
||||
<t t-inherit="web.res_config_edition" t-inherit-mode="extension" owl="1">
|
||||
<xpath expr="//div[hasclass('user-heading')]//h3" position="replace">
|
||||
<h3 class="px-0">
|
||||
Odoo <t t-esc="serverVersion"/> (<a target="_blank" href="https://www.odooai.cn" style="text-decoration: underline;">odooai.cn</a> Edition)
|
||||
</h3>
|
||||
</t>
|
||||
</xpath>
|
||||
</t>
|
||||
</templates>
|
||||
|
||||
59
app_odoo_customize/static/src/xml/web_dialog_size.xml
Normal file
59
app_odoo_customize/static/src/xml/web_dialog_size.xml
Normal file
@@ -0,0 +1,59 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<templates xml:space="preserve">
|
||||
<!--begin 旧widget模式-->
|
||||
<t t-extend="web.DialogWidget">
|
||||
<t t-jquery="button.btn-close" t-operation="inner">
|
||||
<i class="fa fa-close" />
|
||||
</t>
|
||||
<t t-jquery="button.btn-close" t-operation="before">
|
||||
<button type="button" class="dialog_button_extend btn btn-secondary">
|
||||
<i class="fa fa-expand" />
|
||||
</button>
|
||||
<button type="button" class="dialog_button_restore btn btn-secondary">
|
||||
<i class="fa fa-compress" />
|
||||
</button>
|
||||
</t>
|
||||
</t>
|
||||
<!--end 旧widget模式-->
|
||||
|
||||
<t t-inherit="web.ActionDialog.header" t-inherit-mode="extension" owl="1">
|
||||
<xpath expr="//button[hasclass('btn-close')]" position="before">
|
||||
<ExpandButton getsize="getSize" setsize="setSize" t-if="!isFullscreen" />
|
||||
</xpath>
|
||||
</t>
|
||||
|
||||
<t t-inherit="web.Dialog.header" t-inherit-mode="extension" owl="1">
|
||||
<xpath expr="//button[hasclass('btn-close')]" position="before">
|
||||
<ExpandButton
|
||||
getsize="getSize"
|
||||
setsize="setSize"
|
||||
t-if="!isFullscreen and getSize and setSize"
|
||||
/>
|
||||
</xpath>
|
||||
</t>
|
||||
|
||||
<t t-inherit="web.SelectCreateDialog" t-inherit-mode="extension" owl="1">
|
||||
<xpath expr="//Dialog" position="attributes">
|
||||
<attribute name="size">props.size</attribute>
|
||||
</xpath>
|
||||
</t>
|
||||
<!--扩展按键-->
|
||||
<t t-name="app_odoo_customize.ExpandButton" owl="1">
|
||||
<button
|
||||
t-if="props.getsize() == 'dialog_full_screen'"
|
||||
type="button"
|
||||
class="btn btn-secondary dialog_button_extend"
|
||||
t-on-click="dialog_button_restore"
|
||||
>
|
||||
<i class="fa fa-compress" />
|
||||
</button>
|
||||
<button
|
||||
t-if="props.getsize() != 'dialog_full_screen'"
|
||||
type="button"
|
||||
class="btn btn-secondary dialog_button_restore"
|
||||
t-on-click="dialog_button_extend"
|
||||
>
|
||||
<i class="fa fa-expand" />
|
||||
</button>
|
||||
</t>
|
||||
</templates>
|
||||
@@ -1,13 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<templates xml:space="preserve">
|
||||
<!-- <t t-extend="res_config_edition">-->
|
||||
<!-- <t t-jquery=".user-heading h3" t-operation="replace">-->
|
||||
<!-- <h3>-->
|
||||
<!-- odooApp <t t-esc="widget.server_version"/> (odooai.cn Edition)-->
|
||||
<!-- </h3>-->
|
||||
<!-- </t>-->
|
||||
<!-- <t t-jquery=".user-o_web_settings_compact_subtitle small" t-operation="replace">-->
|
||||
<!-- <small><a target="_blank" href="http://www.gnu.org/licenses/lgpl.html" style="text-decoration: underline;">GNU LGPL Licensed</a></small>-->
|
||||
<!-- </t>-->
|
||||
<!-- </t>-->
|
||||
<t t-inherit="web.res_config_edition" t-inherit-mode="extension" owl="1">
|
||||
<xpath expr="//div[hasclass('user-heading')]//h3" position="replace">
|
||||
<h3 class="px-0">
|
||||
Odoo <t t-esc="serverVersion"/> (<a target="_blank" href="https://www.odooai.cn" style="text-decoration: underline;">odooai.cn</a> Edition)
|
||||
</h3>
|
||||
</xpath>
|
||||
</t>
|
||||
</templates>
|
||||
|
||||
Reference in New Issue
Block a user