Browse Source
Merge pull request #33 from hbrunn/6.1-web_statusbar_clickable
Merge pull request #33 from hbrunn/6.1-web_statusbar_clickable
[ADD] web_statusbar_clickablepull/155/head
Yannick Vaucher
10 years ago
6 changed files with 141 additions and 0 deletions
-
20web_statusbar_clickable/__init__.py
-
56web_statusbar_clickable/__openerp__.py
-
4web_statusbar_clickable/static/src/css/web_statusbar_clickable.css
-
BINweb_statusbar_clickable/static/src/img/icon.png
-
54web_statusbar_clickable/static/src/js/web_statusbar_clickable.js
-
7web_statusbar_clickable/static/src/xml/web_statusbar_clickable.xml
@ -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/>. |
|||
# |
|||
############################################################################## |
@ -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': [], |
|||
}, |
|||
} |
@ -0,0 +1,4 @@ |
|||
.oe_form_status_clickable li:hover |
|||
{ |
|||
cursor: pointer; |
|||
} |
After Width: 80 | Height: 80 | Size: 7.8 KiB |
@ -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(); |
|||
}); |
|||
}); |
|||
} |
|||
}, |
|||
}); |
|||
} |
@ -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> |
Write
Preview
Loading…
Cancel
Save
Reference in new issue