Browse Source

[9.0][MIG]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
pull/611/head
Zakaria Makrelouf 8 years ago
parent
commit
e88cc8b2ef
  1. 1
      web_ir_actions_act_window_message/README.rst
  2. 20
      web_ir_actions_act_window_message/__init__.py
  3. 30
      web_ir_actions_act_window_message/__openerp__.py
  4. 82
      web_ir_actions_act_window_message/static/src/js/web_ir_actions_act_window_message.js
  5. 23
      web_ir_actions_act_window_message/views/templates.xml

1
web_ir_actions_act_window_message/README.rst

@ -70,6 +70,7 @@ Contributors
------------
* Holger Brunn <hbrunn@therp.nl>
* Zakaria Makrelouf (ACSONE SA/NV) <z.makrelouf@gmail.com>
Maintainer
----------

20
web_ir_actions_act_window_message/__init__.py

@ -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/>.
#
##############################################################################

30
web_ir_actions_act_window_message/__openerp__.py

@ -1,27 +1,11 @@
# -*- 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).
{
"name": "Client side message boxes",
"version": "8.0.1.0.0",
"version": "9.0.1.0.0",
"author": "Therp BV, "
"ACSONE SA/NV, "
"Odoo Community Association (OCA)",
"license": "AGPL-3",
"category": "Hidden/Dependency",
@ -35,10 +19,4 @@
"qweb": [
'static/src/xml/web_ir_actions_act_window_message.xml',
],
"auto_install": False,
'installable': False,
"application": False,
"external_dependencies": {
'python': [],
},
}

82
web_ir_actions_act_window_message/static/src/js/web_ir_actions_act_window_message.js

@ -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();
},
}
}
});
},
}
});
}
});

23
web_ir_actions_act_window_message/views/templates.xml

@ -1,10 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<openerp>
<data>
<template id="assets_backend" name="web_ir_actions_act_window_message assets" inherit_id="web.assets_backend">
<xpath expr="." position="inside">
<script type="text/javascript" src="/web_ir_actions_act_window_message/static/src/js/web_ir_actions_act_window_message.js"></script>
</xpath>
</template>
</data>
</openerp>
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2017 Therp BV, ACSONE SA/NV
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
<odoo>
<template id="assets_backend" name="web_ir_actions_act_window_message assets" inherit_id="web.assets_backend">
<xpath expr="." position="inside">
<script type="text/javascript" src="/web_ir_actions_act_window_message/static/src/js/web_ir_actions_act_window_message.js"></script>
</xpath>
</template>
</odoo>
Loading…
Cancel
Save