diff --git a/web_statusbar_clickable/__init__.py b/web_statusbar_clickable/__init__.py new file mode 100644 index 00000000..9dd152f9 --- /dev/null +++ b/web_statusbar_clickable/__init__.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# This module copyright (C) 2014 Therp BV (). +# +# 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 . +# +############################################################################## diff --git a/web_statusbar_clickable/__openerp__.py b/web_statusbar_clickable/__openerp__.py new file mode 100644 index 00000000..511fe3fc --- /dev/null +++ b/web_statusbar_clickable/__openerp__.py @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# This module copyright (C) 2014 Therp BV (). +# +# 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 . +# +############################################################################## +{ + "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': [], + }, +} diff --git a/web_statusbar_clickable/static/src/css/web_statusbar_clickable.css b/web_statusbar_clickable/static/src/css/web_statusbar_clickable.css new file mode 100644 index 00000000..fdd21967 --- /dev/null +++ b/web_statusbar_clickable/static/src/css/web_statusbar_clickable.css @@ -0,0 +1,4 @@ +.oe_form_status_clickable li:hover +{ + cursor: pointer; +} diff --git a/web_statusbar_clickable/static/src/img/icon.png b/web_statusbar_clickable/static/src/img/icon.png new file mode 100644 index 00000000..f1006195 Binary files /dev/null and b/web_statusbar_clickable/static/src/img/icon.png differ diff --git a/web_statusbar_clickable/static/src/js/web_statusbar_clickable.js b/web_statusbar_clickable/static/src/js/web_statusbar_clickable.js new file mode 100644 index 00000000..d54abc80 --- /dev/null +++ b/web_statusbar_clickable/static/src/js/web_statusbar_clickable.js @@ -0,0 +1,54 @@ +//-*- coding: utf-8 -*- +//############################################################################ +// +// OpenERP, Open Source Management Solution +// This module copyright (C) 2014 Therp BV (). +// +// 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 . +// +//############################################################################ + +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(); + }); + }); + } + }, + }); +} diff --git a/web_statusbar_clickable/static/src/xml/web_statusbar_clickable.xml b/web_statusbar_clickable/static/src/xml/web_statusbar_clickable.xml new file mode 100644 index 00000000..34f0e9e1 --- /dev/null +++ b/web_statusbar_clickable/static/src/xml/web_statusbar_clickable.xml @@ -0,0 +1,7 @@ + + + + this.attr('t-att-data-id', 'widget.to_show[i][0]') + + +