Skip to content

Commit

Permalink
Merge pull request #33 from hbrunn/6.1-web_statusbar_clickable
Browse files Browse the repository at this point in the history
[ADD] web_statusbar_clickable
  • Loading branch information
yvaucher committed Oct 24, 2014
2 parents ebdc6d7 + ae1b940 commit 72df485
Show file tree
Hide file tree
Showing 6 changed files with 141 additions and 0 deletions.
20 changes: 20 additions & 0 deletions web_statusbar_clickable/__init__.py
Original file line number Diff line number Diff line change
@@ -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/>.
#
##############################################################################
56 changes: 56 additions & 0 deletions web_statusbar_clickable/__openerp__.py
Original file line number Diff line number Diff line change
@@ -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': [],
},
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.oe_form_status_clickable li:hover
{
cursor: pointer;
}
Binary file added web_statusbar_clickable/static/src/img/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
54 changes: 54 additions & 0 deletions web_statusbar_clickable/static/src/js/web_statusbar_clickable.js
Original file line number Diff line number Diff line change
@@ -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();
});
});
}
},
});
}
Original file line number Diff line number Diff line change
@@ -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>

0 comments on commit 72df485

Please sign in to comment.