summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/views
diff options
context:
space:
mode:
authorjem-odoo <jem@openerp.com>2019-09-02 07:15:35 +0000
committerjem-odoo <jem@openerp.com>2019-09-05 20:11:28 +0000
commitba05c66e092e0810679af33fe97270e6a46da8c6 (patch)
treee3f2ae74f037a8dc50dd64265880ab71ba24e070 /addons/web/static/src/js/views
parent1b24f60a5ce26cebe9ae7306a01c02ac4c0f420f (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/views')
-rw-r--r--addons/web/static/src/js/views/form/form_controller.js9
1 files changed, 8 insertions, 1 deletions
diff --git a/addons/web/static/src/js/views/form/form_controller.js b/addons/web/static/src/js/views/form/form_controller.js
index e6c50848c4a..3ecd38cfe45 100644
--- a/addons/web/static/src/js/views/form/form_controller.js
+++ b/addons/web/static/src/js/views/form/form_controller.js
@@ -577,7 +577,14 @@ var FormController = BasicController.extend({
return;
}
- def.then(this._enableButtons.bind(this)).guardedCatch(this._enableButtons.bind(this));
+ // Kind of hack for FormViewDialog: button on footer should trigger the dialog closing
+ // if the `close` attribute is set
+ def.then(function () {
+ self._enableButtons();
+ if (attrs.close) {
+ self.trigger_up('close_dialog');
+ }
+ }).guardedCatch(this._enableButtons.bind(this));
},
/**
* Called when the user wants to create a new record -> @see createRecord