Merge branch 'dev_odex25_ensan' of https://github.com/expsa/odex25-standard-modules into notes_7

This commit is contained in:
Nossibaelhadi 2025-11-09 16:03:00 +03:00
commit 33b85ab655
1 changed files with 40 additions and 12 deletions

View File

@ -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 = $('<button/>', {
text: _t('Add'),
@ -33,19 +61,19 @@ odoo.define('odex_takaful.custom_dialog', function (require) {
self.$footer.append(closeBtn);
}
if(self.$modal){
if (self.$modal) {
self.$modal.find('.modal-header button.close').hide();
self.$modal.find('.modal-header .modal-title').css("width","100%");
self.$modal.find('.modal-header .modal-title').css("width", "100%");
}
if(self.$el){
if (self.$el) {
self.$el.find('.o_cp_top_left').hide();
self.$el.find('.o_cp_bottom_left').hide();
self.$el.find('.o_cp_top_right').css("width","100%");
self.$el.find('.o_cp_bottom_right').css("width","100%");
self.$el.find('.o_cp_top_right').css("width", "100%");
self.$el.find('.o_cp_bottom_right').css("width", "100%");
}
if(context.sponsorship_id){
if (context.sponsorship_id) {
$('#cspid').remove();
$('body').append(`<input type="hidden" id="cspid" value="${context.sponsorship_id}"/>`)
}