[MIG] bemade_full_formview_from_modal to 16.0
This commit is contained in:
parent
92c6c81807
commit
489a95314a
5 changed files with 39 additions and 44 deletions
|
|
@ -18,7 +18,7 @@
|
||||||
#
|
#
|
||||||
{
|
{
|
||||||
'name': 'Full Form from Dialog',
|
'name': 'Full Form from Dialog',
|
||||||
'version': '15.0.1.0.0',
|
'version': '16.0.1.0.0',
|
||||||
'summary': 'Allows opening the full form view from the dialog (modal) view.',
|
'summary': 'Allows opening the full form view from the dialog (modal) view.',
|
||||||
'description': 'Adds a button to open the full form view when viewing the form view for a record in a dialog.',
|
'description': 'Adds a button to open the full form view when viewing the form view for a record in a dialog.',
|
||||||
'category': 'Technical',
|
'category': 'Technical',
|
||||||
|
|
@ -29,7 +29,7 @@
|
||||||
'data': [],
|
'data': [],
|
||||||
'assets': {
|
'assets': {
|
||||||
'web.assets_backend': [
|
'web.assets_backend': [
|
||||||
'bemade_full_formview_from_modal/static/src/js/form_view_dialog.js',
|
'bemade_full_formview_from_modal/static/src/**/*',
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
'installable': True,
|
'installable': True,
|
||||||
|
|
|
||||||
|
|
@ -1,40 +0,0 @@
|
||||||
/** @odoo-module **/
|
|
||||||
|
|
||||||
import FormViewDialog from 'web.FormView';
|
|
||||||
import Dialog from 'web.Dialog';
|
|
||||||
import {patch} from '@web/core/utils/patch';
|
|
||||||
import {_t} from 'web.core';
|
|
||||||
|
|
||||||
const dom = require('web.dom')
|
|
||||||
|
|
||||||
patch(Dialog.prototype, "bemade_full_formview_from_modal.Dialog", {
|
|
||||||
init: function (parent, options) {
|
|
||||||
this._super(...arguments);
|
|
||||||
},
|
|
||||||
willStart: function () {
|
|
||||||
const self = this;
|
|
||||||
return this._super(...arguments).then(function () {
|
|
||||||
if (self.$footer) {
|
|
||||||
const $button = dom.renderButton({
|
|
||||||
attrs: {
|
|
||||||
class: 'btn btn-secondary o_form_button_open',
|
|
||||||
},
|
|
||||||
text: _t('Open'),
|
|
||||||
});
|
|
||||||
$button.on('click', function() {self._onOpen.call(self)});
|
|
||||||
self.$footer.append($button);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
},
|
|
||||||
_onOpen: function () {
|
|
||||||
this.do_action({
|
|
||||||
type: 'ir.actions.act_window',
|
|
||||||
res_model: this.options.res_model,
|
|
||||||
res_id: this.options.res_id,
|
|
||||||
views: [[false, 'form']],
|
|
||||||
target: 'current',
|
|
||||||
context: this.context,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
@ -0,0 +1,22 @@
|
||||||
|
/** @odoo-module **/
|
||||||
|
|
||||||
|
import { patch } from "@web/core/utils/patch";
|
||||||
|
import { FormController } from "@web/views/form/form_controller";
|
||||||
|
import { useService } from "@web/core/utils/hooks";
|
||||||
|
|
||||||
|
patch(FormController.prototype, "bemade_full_formview_from_modal.FormController", {
|
||||||
|
setup () {
|
||||||
|
this._super();
|
||||||
|
this.action = useService("action")
|
||||||
|
},
|
||||||
|
onOpenButtonClicked: function () {
|
||||||
|
this.action.doAction({
|
||||||
|
type: "ir.actions.act_window",
|
||||||
|
res_model: this.props.resModel,
|
||||||
|
res_id: this.props.resId,
|
||||||
|
views: [[false, "form"]],
|
||||||
|
target: "current",
|
||||||
|
context: this.props.context,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
@ -0,0 +1,13 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<templates xml:space="preserve">
|
||||||
|
<t t-inherit="web.FormViewDialog.ToMany.buttons" t-inherit-mode="extension" owl="1">
|
||||||
|
<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>
|
||||||
|
</xpath>
|
||||||
|
</t>
|
||||||
|
<t t-inherit="web.FormViewDialog.ToOne.buttons" t-inherit-mode="extension" owl="1">
|
||||||
|
<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>
|
||||||
|
</templates>
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
'name': 'Packing wizard',
|
'name': 'Packing wizard',
|
||||||
'version': '15.0.1.0.0',
|
'version': '16.0.1.0.0',
|
||||||
'category': 'Extra Tools',
|
'category': 'Extra Tools',
|
||||||
'summary': 'Allow automated packing type creation',
|
'summary': 'Allow automated packing type creation',
|
||||||
'description': """
|
'description': """
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue