diff --git a/odex25_ensan/odex_takaful/static/src/js/donation_catalog_button.js b/odex25_ensan/odex_takaful/static/src/js/donation_catalog_button.js index 036751162..be72f6e64 100644 --- a/odex25_ensan/odex_takaful/static/src/js/donation_catalog_button.js +++ b/odex25_ensan/odex_takaful/static/src/js/donation_catalog_button.js @@ -7,24 +7,52 @@ odoo.define('odex_takaful.custom_dialog', function (require) { const _t = core._t; const ActionManager = require('web.ActionManager'); + ActionManager.include({ + //---------------------------------------------------------------------- + // Public + //---------------------------------------------------------------------- + + /** + * Returns the action of the controller currently opened in a dialog, + * i.e. a target='new' action, if any. + * + * @returns {Object|null} + */ + getCurrentActionInDialog: function () { + if (this.currentDialogController) { + return this.actions[this.currentDialogController.actionID]; + } + return null; + }, + /** + * Returns the controller currently opened in a dialog, if any. + * + * @returns {Object|null} + */ + getCurrentControllerInDialog: function () { + return this.currentDialogController; + }, + }); + Dialog.include({ /** * @override */ - open: function() { + open: function () { var self = this; - this.opened(function() { + this.opened(function () { setTimeout(function () { var parent = self.getParent(); if (parent instanceof ActionManager) { + var action = parent.getCurrentActionInDialog(); if (action) { - if(action.context){ + if (action.context) { let context = action.context; - if(context.action_code){ - if(context.action_code === 'donation_items'){ - + if (context.action_code) { + if (context.action_code === 'donation_items') { + if (self.$footer) { const closeBtn = $('