Initial commit: Odoo 18.0-20251222 extra-addons
Some checks failed
pre-commit / pre-commit (push) Has been cancelled
tests / Detect unreleased dependencies (push) Has been cancelled
tests / test with OCB (push) Has been cancelled
tests / test with Odoo (push) Has been cancelled

This commit is contained in:
tocmo0nlord
2026-03-13 20:43:25 +00:00
parent 36e847a7df
commit adbe430761
9472 changed files with 1265727 additions and 0 deletions

View File

@@ -0,0 +1,81 @@
import {Component, onMounted} from "@odoo/owl";
import {ActionDialog} from "@web/webclient/actions/action_dialog";
import {Dialog} from "@web/core/dialog/dialog";
import {SelectCreateDialog} from "@web/views/view_dialogs/select_create_dialog";
import {patch} from "@web/core/utils/patch";
import {useService} from "@web/core/utils/hooks";
export class ExpandButton extends Component {
setup() {
this.orm = useService("orm");
this.last_size = this.props.getsize();
this.config = this.orm.call(
"ir.config_parameter",
"get_web_dialog_size_config"
);
onMounted(() => {
var self = this;
this.config.then(function (r) {
if (r.default_maximize) {
self.dialog_button_extend();
}
});
});
}
dialog_button_extend() {
this.props.setsize("dialog_full_screen");
this.render();
}
dialog_button_restore() {
this.props.setsize(this.last_size);
this.render();
}
}
ExpandButton.template = "web_dialog_size.ExpandButton";
patch(Dialog.prototype, {
setup() {
super.setup();
this.setSize = this.setSize.bind(this);
this.getSize = this.getSize.bind(this);
},
setSize(size) {
this.props.size = size;
this.render();
},
getSize() {
return this.props.size;
},
});
patch(SelectCreateDialog.prototype, {
setup() {
super.setup();
this.setSize = this.setSize.bind(this);
this.getSize = this.getSize.bind(this);
},
setSize(size) {
this.props.size = size;
this.render();
},
getSize() {
return this.props.size;
},
});
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);

View File

@@ -0,0 +1,16 @@
.modal {
.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;
}
}
}

View File

@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8" ?>
<templates>
<t t-name="web_dialog_size.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-window-restore" />
</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-window-maximize" />
</button>
</t>
</templates>

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8" ?>
<templates xml:space="preserve">
<t t-inherit="web.SelectCreateDialog" t-inherit-mode="extension" owl="1">
<xpath expr="//Dialog" position="attributes">
<attribute name="size">props.size</attribute>
</xpath>
</t>
</templates>

View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8" ?>
<templates xml:space="preserve">
<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>
</templates>