mirror of
https://github.com/OCA/web.git
synced 2025-02-22 13:21:25 +02:00
web_ir_actions_act_window_message: Migration to V9
* Update the module version to 9.0. * Align file header to the OCA Guidelines. * Migrate Javascript file to the V9 API. * Refresh the view before closing the dialog when clicking on close button
This commit is contained in:
committed by
Jasmin Solanki
parent
42f829b568
commit
2454873100
@@ -1,59 +1,51 @@
|
||||
//-*- coding: utf-8 -*-
|
||||
//############################################################################
|
||||
//
|
||||
// OpenERP, Open Source Management Solution
|
||||
// This module copyright (C) 2015 Therp BV <http://therp.nl>.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
//############################################################################
|
||||
/* Copyright 2017 Therp BV, ACSONE SA/NV
|
||||
* * License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). */
|
||||
|
||||
odoo.define('web.web_ir_actions_act_window_message', function (require) {
|
||||
"use strict";
|
||||
|
||||
var ActionManager = require('web.ActionManager'),
|
||||
core = require('web.core'),
|
||||
_ = require('_'),
|
||||
Model = require('web.Model'),
|
||||
Dialog = require('web.Dialog');
|
||||
|
||||
var _t = core._t;
|
||||
|
||||
ActionManager.include({
|
||||
ir_actions_act_window_message: function(action, options){
|
||||
|
||||
openerp.web_ir_actions_act_window_message = function(instance)
|
||||
{
|
||||
instance.web.ActionManager.include({
|
||||
ir_actions_act_window_message: function(action, options)
|
||||
{
|
||||
var self = this,
|
||||
buttons = [];
|
||||
|
||||
if(action.close_button_title !== false)
|
||||
{
|
||||
buttons.push({
|
||||
text: action.close_button_title ||
|
||||
instance.web._t('Close'),
|
||||
click: function() { dialog.close() },
|
||||
text: action.close_button_title || _t('Close'),
|
||||
click: function() {
|
||||
// refresh the view before closing the dialog
|
||||
self.inner_widget.active_view
|
||||
.controller.recursive_reload();
|
||||
dialog.close()
|
||||
},
|
||||
oe_link_class: 'oe_highlight',
|
||||
})
|
||||
}
|
||||
|
||||
var dialog = new instance.web.Dialog(
|
||||
var dialog = new Dialog(
|
||||
this,
|
||||
{
|
||||
_.extend({
|
||||
size: 'medium',
|
||||
title: action.title,
|
||||
$content: $('<div>', {
|
||||
text: action.message,
|
||||
}),
|
||||
buttons: buttons.concat(
|
||||
this.ir_actions_act_window_message_get_buttons(
|
||||
action, function() { dialog.close() })
|
||||
),
|
||||
},
|
||||
jQuery(instance.web.qweb.render(
|
||||
'web_ir_actions_act_window_message',
|
||||
{
|
||||
'this': this,
|
||||
'action': action,
|
||||
}))
|
||||
)
|
||||
}, options)
|
||||
);
|
||||
return dialog.open();
|
||||
},
|
||||
ir_actions_act_window_message_get_buttons: function(action, close_func)
|
||||
@@ -67,9 +59,8 @@ openerp.web_ir_actions_act_window_message = function(instance)
|
||||
oe_link_class: button_definition.oe_link_class ||
|
||||
'oe_highlight',
|
||||
click: function() {
|
||||
if(button_definition.type == 'method')
|
||||
{
|
||||
(new instance.web.Model(button_definition.model))
|
||||
if(button_definition.type == 'method'){
|
||||
(new Model(button_definition.model))
|
||||
.call(
|
||||
button_definition.method,
|
||||
button_definition.args,
|
||||
@@ -94,14 +85,13 @@ openerp.web_ir_actions_act_window_message = function(instance)
|
||||
}
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
else{
|
||||
self.do_action(button_definition);
|
||||
}
|
||||
close_func();
|
||||
},
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user