From 489a95314a3e6a6111747223f8aa9615d0ac0bb9 Mon Sep 17 00:00:00 2001 From: Marc Durepos Date: Wed, 3 Jan 2024 17:25:05 -0500 Subject: [PATCH] [MIG] bemade_full_formview_from_modal to 16.0 --- .../__manifest__.py | 4 +- .../static/src/js/form_view_dialog.js | 40 ------------------- .../src/view_dialogs/form_view_dialog.js | 22 ++++++++++ .../src/view_dialogs/form_view_dialog.xml | 13 ++++++ bemade_packing_wizard/__manifest__.py | 4 +- 5 files changed, 39 insertions(+), 44 deletions(-) delete mode 100644 bemade_full_formview_from_modal/static/src/js/form_view_dialog.js create mode 100644 bemade_full_formview_from_modal/static/src/view_dialogs/form_view_dialog.js create mode 100644 bemade_full_formview_from_modal/static/src/view_dialogs/form_view_dialog.xml diff --git a/bemade_full_formview_from_modal/__manifest__.py b/bemade_full_formview_from_modal/__manifest__.py index 66d3327..2427ab3 100644 --- a/bemade_full_formview_from_modal/__manifest__.py +++ b/bemade_full_formview_from_modal/__manifest__.py @@ -18,7 +18,7 @@ # { '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.', 'description': 'Adds a button to open the full form view when viewing the form view for a record in a dialog.', 'category': 'Technical', @@ -29,7 +29,7 @@ 'data': [], 'assets': { 'web.assets_backend': [ - 'bemade_full_formview_from_modal/static/src/js/form_view_dialog.js', + 'bemade_full_formview_from_modal/static/src/**/*', ], }, 'installable': True, diff --git a/bemade_full_formview_from_modal/static/src/js/form_view_dialog.js b/bemade_full_formview_from_modal/static/src/js/form_view_dialog.js deleted file mode 100644 index fbb2b83..0000000 --- a/bemade_full_formview_from_modal/static/src/js/form_view_dialog.js +++ /dev/null @@ -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, - }) - } -}); diff --git a/bemade_full_formview_from_modal/static/src/view_dialogs/form_view_dialog.js b/bemade_full_formview_from_modal/static/src/view_dialogs/form_view_dialog.js new file mode 100644 index 0000000..06e1418 --- /dev/null +++ b/bemade_full_formview_from_modal/static/src/view_dialogs/form_view_dialog.js @@ -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, + }) + } +}); diff --git a/bemade_full_formview_from_modal/static/src/view_dialogs/form_view_dialog.xml b/bemade_full_formview_from_modal/static/src/view_dialogs/form_view_dialog.xml new file mode 100644 index 0000000..65aefe9 --- /dev/null +++ b/bemade_full_formview_from_modal/static/src/view_dialogs/form_view_dialog.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/bemade_packing_wizard/__manifest__.py b/bemade_packing_wizard/__manifest__.py index 41b136d..124c309 100644 --- a/bemade_packing_wizard/__manifest__.py +++ b/bemade_packing_wizard/__manifest__.py @@ -1,12 +1,12 @@ { 'name': 'Packing wizard', - 'version': '15.0.1.0.0', + 'version': '16.0.1.0.0', 'category': 'Extra Tools', 'summary': 'Allow automated packing type creation', 'description': """ This module allows users simply enter all the package dimensions on every packing and it will create the packing type automatically if it not exists, use it the create the package with the weight and related package type. - + You need to activate the auto create package feature on the delivery carrier to use this feature. """, 'depends': [