3
0
Fork 0

[ADD] web_statusbar_clickable

6.1
Holger Brunn 2014-08-27 15:28:10 +02:00
parent b1ff27f646
commit ae1b94077e
6 changed files with 141 additions and 0 deletions

View File

@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# This module copyright (C) 2014 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/>.
#
##############################################################################

View File

@ -0,0 +1,56 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# This module copyright (C) 2014 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": "Clickable statusbar",
"version": "1.0",
"author": "Therp BV",
"license": "AGPL-3",
"complexity": "normal",
"description": """
This addons backports the clickable feature for statusbars in OpenERP 6.1
As with the original: Don't use this on state fields connected to a workflow,
this will mess up your workflow's state!
""",
"category": "Dependency",
"depends": [
'web',
],
"data": [
],
"js": [
'static/src/js/web_statusbar_clickable.js',
],
"css": [
'static/src/css/web_statusbar_clickable.css',
],
"qweb": [
'static/src/xml/web_statusbar_clickable.xml',
],
"test": [
],
"auto_install": False,
"installable": True,
"application": False,
"external_dependencies": {
'python': [],
},
}

View File

@ -0,0 +1,4 @@
.oe_form_status_clickable li:hover
{
cursor: pointer;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

View File

@ -0,0 +1,54 @@
//-*- coding: utf-8 -*-
//############################################################################
//
// OpenERP, Open Source Management Solution
// This module copyright (C) 2014 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/>.
//
//############################################################################
openerp.web_statusbar_clickable = function(instance)
{
instance.web.form.FieldStatus.include({
render_list: function()
{
this._super.apply(this, arguments);
if(this.node.attrs.clickable)
{
this.$element.find('ul').addClass('oe_form_status_clickable');
this.$element.find('li').click(this.on_state_clicked);
}
},
on_state_clicked: function(e)
{
var self = this,
clicked_val = jQuery(e.currentTarget).data('id');
if(clicked_val != this.value)
{
this.view.recursive_save().then(function()
{
var data = {}
data[self.name] = clicked_val;
self.view.dataset.write(
self.view.datarecord.id, data)
.then(function()
{
self.view.reload();
});
});
}
},
});
}

View File

@ -0,0 +1,7 @@
<templates>
<t t-extend="FieldStatus.content">
<t t-jquery="li">
this.attr('t-att-data-id', 'widget.to_show[i][0]')
</t>
</t>
</templates>