activate js and xml templates for FormViewDialog component
This commit is contained in:
parent
c5062b6b2b
commit
39fd3b7995
2 changed files with 29 additions and 10 deletions
|
|
@ -3,6 +3,7 @@
|
||||||
import { patch } from "@web/core/utils/patch";
|
import { patch } from "@web/core/utils/patch";
|
||||||
import { useService } from "@web/core/utils/hooks";
|
import { useService } from "@web/core/utils/hooks";
|
||||||
import { X2ManyFieldDialog } from "@web/views/fields/relational_utils"
|
import { X2ManyFieldDialog } from "@web/views/fields/relational_utils"
|
||||||
|
import { FormViewDialog } from "@web/views/view_dialogs/form_view_dialog"
|
||||||
|
|
||||||
patch(X2ManyFieldDialog.prototype, {
|
patch(X2ManyFieldDialog.prototype, {
|
||||||
setup () {
|
setup () {
|
||||||
|
|
@ -21,3 +22,21 @@ patch(X2ManyFieldDialog.prototype, {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
patch(FormViewDialog.prototype, {
|
||||||
|
setup () {
|
||||||
|
super.setup();
|
||||||
|
this.action = useService('action')
|
||||||
|
this.env.dialogData.onOpenButtonClicked = this.onOpenButtonClicked.bind(this);
|
||||||
|
},
|
||||||
|
onOpenButtonClicked: function () {
|
||||||
|
this.action.doAction({
|
||||||
|
type: "ir.actions.act_window",
|
||||||
|
res_model: this.record.resModel,
|
||||||
|
res_id: this.record.resId,
|
||||||
|
views: [[false, "form"]],
|
||||||
|
target: "current",
|
||||||
|
context: this.props.context,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
|
||||||
|
|
@ -5,14 +5,14 @@
|
||||||
<button class="btn btn-primary" t-on-click="onOpenButtonClicked">Open</button>
|
<button class="btn btn-primary" t-on-click="onOpenButtonClicked">Open</button>
|
||||||
</xpath>
|
</xpath>
|
||||||
</t>
|
</t>
|
||||||
<!-- <t t-inherit="web.FormViewDialog.ToMany.buttons" t-inherit-mode="extension">-->
|
<t t-inherit="web.FormViewDialog.ToMany.buttons" t-inherit-mode="extension">
|
||||||
<!-- <xpath expr="//button[hasclass('o_form_button_save_new')]" position="after">-->
|
<xpath expr="//button[hasclass('o_form_button_save_new')]" position="after">
|
||||||
<!-- <button class="btn btn-secondary o_form_button_open" t-on-click="_onOpen">Open</button>-->
|
<button class="btn btn-secondary o_form_button_open" t-on-click="onOpenButtonClicked">Open</button>
|
||||||
<!-- </xpath>-->
|
</xpath>
|
||||||
<!-- </t>-->
|
</t>
|
||||||
<!-- <t t-inherit="web.FormViewDialog.ToOne.buttons" t-inherit-mode="extension">-->
|
<t t-inherit="web.FormViewDialog.ToOne.buttons" t-inherit-mode="extension">
|
||||||
<!-- <xpath expr="//button[hasclass('o_form_button_save')]" position="after">-->
|
<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>-->
|
<button class="btn btn-secondary o_form_button_open" t-on-click="onOpenButtonClicked">Open</button>
|
||||||
<!-- </xpath>-->
|
</xpath>
|
||||||
<!-- </t>-->
|
</t>
|
||||||
</templates>
|
</templates>
|
||||||
Loading…
Reference in a new issue