mirror of https://github.com/OCA/web.git
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 buttonpull/2389/head
parent
462646c76d
commit
ad0ef9267c
|
@ -70,6 +70,7 @@ Contributors
|
||||||
------------
|
------------
|
||||||
|
|
||||||
* Holger Brunn <hbrunn@therp.nl>
|
* Holger Brunn <hbrunn@therp.nl>
|
||||||
|
* Zakaria Makrelouf (ACSONE SA/NV) <z.makrelouf@gmail.com>
|
||||||
|
|
||||||
Maintainer
|
Maintainer
|
||||||
----------
|
----------
|
||||||
|
|
|
@ -1,20 +0,0 @@
|
||||||
# -*- 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/>.
|
|
||||||
#
|
|
||||||
##############################################################################
|
|
|
@ -1,27 +1,11 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
##############################################################################
|
# Copyright 2017 Therp BV, ACSONE SA/NV
|
||||||
#
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
# 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/>.
|
|
||||||
#
|
|
||||||
##############################################################################
|
|
||||||
{
|
{
|
||||||
"name": "Client side message boxes",
|
"name": "Client side message boxes",
|
||||||
"version": "8.0.1.0.0",
|
"version": "9.0.1.0.0",
|
||||||
"author": "Therp BV, "
|
"author": "Therp BV, "
|
||||||
|
"ACSONE SA/NV, "
|
||||||
"Odoo Community Association (OCA)",
|
"Odoo Community Association (OCA)",
|
||||||
"license": "AGPL-3",
|
"license": "AGPL-3",
|
||||||
"category": "Hidden/Dependency",
|
"category": "Hidden/Dependency",
|
||||||
|
@ -35,10 +19,4 @@
|
||||||
"qweb": [
|
"qweb": [
|
||||||
'static/src/xml/web_ir_actions_act_window_message.xml',
|
'static/src/xml/web_ir_actions_act_window_message.xml',
|
||||||
],
|
],
|
||||||
"auto_install": False,
|
|
||||||
'installable': False,
|
|
||||||
"application": False,
|
|
||||||
"external_dependencies": {
|
|
||||||
'python': [],
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,59 +1,51 @@
|
||||||
//-*- coding: utf-8 -*-
|
/* Copyright 2017 Therp BV, ACSONE SA/NV
|
||||||
//############################################################################
|
* * License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). */
|
||||||
//
|
|
||||||
// OpenERP, Open Source Management Solution
|
odoo.define('web.web_ir_actions_act_window_message', function (require) {
|
||||||
// This module copyright (C) 2015 Therp BV <http://therp.nl>.
|
"use strict";
|
||||||
//
|
|
||||||
// This program is free software: you can redistribute it and/or modify
|
var ActionManager = require('web.ActionManager'),
|
||||||
// it under the terms of the GNU Affero General Public License as
|
core = require('web.core'),
|
||||||
// published by the Free Software Foundation, either version 3 of the
|
_ = require('_'),
|
||||||
// License, or (at your option) any later version.
|
Model = require('web.Model'),
|
||||||
//
|
Dialog = require('web.Dialog');
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
var _t = core._t;
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU Affero General Public License for more details.
|
ActionManager.include({
|
||||||
//
|
ir_actions_act_window_message: function(action, options){
|
||||||
// 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/>.
|
|
||||||
//
|
|
||||||
//############################################################################
|
|
||||||
|
|
||||||
openerp.web_ir_actions_act_window_message = function(instance)
|
|
||||||
{
|
|
||||||
instance.web.ActionManager.include({
|
|
||||||
ir_actions_act_window_message: function(action, options)
|
|
||||||
{
|
|
||||||
var self = this,
|
var self = this,
|
||||||
buttons = [];
|
buttons = [];
|
||||||
|
|
||||||
if(action.close_button_title !== false)
|
if(action.close_button_title !== false)
|
||||||
{
|
{
|
||||||
buttons.push({
|
buttons.push({
|
||||||
text: action.close_button_title ||
|
text: action.close_button_title || _t('Close'),
|
||||||
instance.web._t('Close'),
|
click: function() {
|
||||||
click: function() { dialog.close() },
|
// refresh the view before closing the dialog
|
||||||
|
self.inner_widget.active_view
|
||||||
|
.controller.recursive_reload();
|
||||||
|
dialog.close()
|
||||||
|
},
|
||||||
oe_link_class: 'oe_highlight',
|
oe_link_class: 'oe_highlight',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
var dialog = new instance.web.Dialog(
|
var dialog = new Dialog(
|
||||||
this,
|
this,
|
||||||
{
|
_.extend({
|
||||||
size: 'medium',
|
size: 'medium',
|
||||||
title: action.title,
|
title: action.title,
|
||||||
|
$content: $('<div>', {
|
||||||
|
text: action.message,
|
||||||
|
}),
|
||||||
buttons: buttons.concat(
|
buttons: buttons.concat(
|
||||||
this.ir_actions_act_window_message_get_buttons(
|
this.ir_actions_act_window_message_get_buttons(
|
||||||
action, function() { dialog.close() })
|
action, function() { dialog.close() })
|
||||||
),
|
),
|
||||||
},
|
}, options)
|
||||||
jQuery(instance.web.qweb.render(
|
);
|
||||||
'web_ir_actions_act_window_message',
|
|
||||||
{
|
|
||||||
'this': this,
|
|
||||||
'action': action,
|
|
||||||
}))
|
|
||||||
)
|
|
||||||
return dialog.open();
|
return dialog.open();
|
||||||
},
|
},
|
||||||
ir_actions_act_window_message_get_buttons: function(action, close_func)
|
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_link_class: button_definition.oe_link_class ||
|
||||||
'oe_highlight',
|
'oe_highlight',
|
||||||
click: function() {
|
click: function() {
|
||||||
if(button_definition.type == 'method')
|
if(button_definition.type == 'method'){
|
||||||
{
|
(new Model(button_definition.model))
|
||||||
(new instance.web.Model(button_definition.model))
|
|
||||||
.call(
|
.call(
|
||||||
button_definition.method,
|
button_definition.method,
|
||||||
button_definition.args,
|
button_definition.args,
|
||||||
|
@ -94,14 +85,13 @@ openerp.web_ir_actions_act_window_message = function(instance)
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else
|
else{
|
||||||
{
|
|
||||||
self.do_action(button_definition);
|
self.do_action(button_definition);
|
||||||
}
|
}
|
||||||
close_func();
|
close_func();
|
||||||
},
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
}
|
||||||
});
|
});
|
||||||
}
|
});
|
||||||
|
|
|
@ -1,10 +1,13 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<openerp>
|
<!-- Copyright 2017 Therp BV, ACSONE SA/NV
|
||||||
<data>
|
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
|
||||||
<template id="assets_backend" name="web_ir_actions_act_window_message assets" inherit_id="web.assets_backend">
|
|
||||||
<xpath expr="." position="inside">
|
<odoo>
|
||||||
<script type="text/javascript" src="/web_ir_actions_act_window_message/static/src/js/web_ir_actions_act_window_message.js"></script>
|
|
||||||
</xpath>
|
<template id="assets_backend" name="web_ir_actions_act_window_message assets" inherit_id="web.assets_backend">
|
||||||
</template>
|
<xpath expr="." position="inside">
|
||||||
</data>
|
<script type="text/javascript" src="/web_ir_actions_act_window_message/static/src/js/web_ir_actions_act_window_message.js"></script>
|
||||||
</openerp>
|
</xpath>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
</odoo>
|
Loading…
Reference in New Issue