updates to full_formview_from_modal

This commit is contained in:
Marc Durepos 2024-06-03 07:48:37 -04:00
parent 39fd3b7995
commit f864093eb8
2 changed files with 10 additions and 15 deletions

View file

@ -3,7 +3,7 @@
import { patch } from "@web/core/utils/patch";
import { useService } from "@web/core/utils/hooks";
import { X2ManyFieldDialog } from "@web/views/fields/relational_utils"
import { FormViewDialog } from "@web/views/view_dialogs/form_view_dialog"
import { FormViewDialog } from "@web/views/view_dialogs/form_view_dialog"
patch(X2ManyFieldDialog.prototype, {
setup () {
@ -27,13 +27,13 @@ patch(FormViewDialog.prototype, {
setup () {
super.setup();
this.action = useService('action')
this.env.dialogData.onOpenButtonClicked = this.onOpenButtonClicked.bind(this);
this.onOpenButtonClicked = this.onOpenButtonClicked.bind(this);
},
onOpenButtonClicked: function () {
onOpenButtonClicked() {
this.action.doAction({
type: "ir.actions.act_window",
res_model: this.record.resModel,
res_id: this.record.resId,
res_model: this.props.resModel,
res_id: this.props.resId,
views: [[false, "form"]],
target: "current",
context: this.props.context,

View file

@ -2,17 +2,12 @@
<templates xml:space="preserve">
<t t-inherit="web.X2ManyFieldDialog" t-inherit-mode="extension">
<xpath expr="//t[@t-set-slot='footer']" position="inside">
<button class="btn btn-primary" t-on-click="onOpenButtonClicked">Open</button>
<button class="btn btn-primary" t-on-click="() => this.onOpenButtonClicked()">Open</button>
</xpath>
</t>
<t t-inherit="web.FormViewDialog.ToMany.buttons" t-inherit-mode="extension">
<xpath expr="//button[hasclass('o_form_button_save_new')]" position="after">
<button class="btn btn-secondary o_form_button_open" t-on-click="onOpenButtonClicked">Open</button>
</xpath>
</t>
<t t-inherit="web.FormViewDialog.ToOne.buttons" t-inherit-mode="extension">
<xpath expr="//button[hasclass('o_form_button_save')]" position="after">
<button class="btn btn-secondary o_form_button_open" t-on-click="onOpenButtonClicked">Open</button>
</xpath>
<t t-inherit="web.FormViewDialog" t-inherit-mode="extension">
<t t-set-slot="footer" position="inside">
<button class="btn btn-secondary o_form_button_open" t-on-click="() => this.onOpenButtonClicked()">Open</button>
</t>
</t>
</templates>