diff options
| author | jem-odoo <jem@openerp.com> | 2019-09-02 07:15:35 +0000 |
|---|---|---|
| committer | jem-odoo <jem@openerp.com> | 2019-09-05 20:11:28 +0000 |
| commit | ba05c66e092e0810679af33fe97270e6a46da8c6 (patch) | |
| tree | e3f2ae74f037a8dc50dd64265880ab71ba24e070 /addons/web/static/src/js/core | |
| parent | 1b24f60a5ce26cebe9ae7306a01c02ac4c0f420f (diff) | |
[IMP] web: formview auto close dialog
Sometimes when using a form view in a modal (e.i.: in a gantt view), we might
want to have some button in the footer. We expect clicking on buttons to close
the dialog but nothing happens, since the webclient does not know that this is
a modal.
To do so, we provide the `close='1'` attribute on the button, in form view.
This will trigger the event closing the modal.
This is done with the benediction of aab-odoo
Task-2024216
closes odoo/odoo#36493
Signed-off-by: Jérome Maes (jem) <jem@openerp.com>
Diffstat (limited to 'addons/web/static/src/js/core')
| -rw-r--r-- | addons/web/static/src/js/core/dialog.js | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/addons/web/static/src/js/core/dialog.js b/addons/web/static/src/js/core/dialog.js index 047df634ba2..cd76ec770bb 100644 --- a/addons/web/static/src/js/core/dialog.js +++ b/addons/web/static/src/js/core/dialog.js @@ -21,6 +21,7 @@ var Dialog = Widget.extend({ xmlDependencies: ['/web/static/src/xml/dialog.xml'], custom_events: _.extend({}, Widget.prototype.custom_events, { focus_control_button: '_onFocusControlButton', + close_dialog: '_onCloseDialog', }), events: _.extend({}, Widget.prototype.events, { 'keydown .modal-footer button': '_onFooterButtonKeyDown', @@ -317,6 +318,13 @@ var Dialog = Widget.extend({ // Handlers //-------------------------------------------------------------------------- /** + * @private + */ + _onCloseDialog: function (ev) { + ev.stopPropagation(); + this.close(); + }, + /** * Moves the focus to the first button primary in the footer of the dialog * * @private |
