From 877bb986f4e56c20bb21b41cc43f3f19f3e067a1 Mon Sep 17 00:00:00 2001 From: Markus Schneider Date: Mon, 22 Sep 2014 18:09:36 +0200 Subject: [PATCH 1/2] add "web_list_html_widget" module --- web_list_html_widget/__init__.py | 20 +++++++++ web_list_html_widget/__openerp__.py | 44 +++++++++++++++++++ .../static/src/js/view_list.js | 10 +++++ 3 files changed, 74 insertions(+) create mode 100644 web_list_html_widget/__init__.py create mode 100644 web_list_html_widget/__openerp__.py create mode 100644 web_list_html_widget/static/src/js/view_list.js diff --git a/web_list_html_widget/__init__.py b/web_list_html_widget/__init__.py new file mode 100644 index 00000000..11c88e1d --- /dev/null +++ b/web_list_html_widget/__init__.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2014 initOS GmbH & Co. KG (). +# +# 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_list_html_widget/__openerp__.py b/web_list_html_widget/__openerp__.py new file mode 100644 index 00000000..8ba168e4 --- /dev/null +++ b/web_list_html_widget/__openerp__.py @@ -0,0 +1,44 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2010-2013 OpenERP s.a. (). +# Copyright (C) 2014 initOS GmbH & Co. KG (). +# Author Thomas Rehn +# +# 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": "HTML widget for list/tree views", + "version": "0.1", + "depends": ["web"], + 'author': 'initOS GmbH & Co. KG', + "category": "", + 'license': 'AGPL-3', + "description": """This module allows to use a widget="html" for fields in +list(tree) views. + +*WARNING* The content of the field will be rendered without HTML escaping and +without any other security measure.""", + 'data': [ + ], + 'demo': [ + ], + 'test': [ + ], + 'js': ['static/src/js/view_list.js'], + 'installable': True, + 'auto_install': False, +} diff --git a/web_list_html_widget/static/src/js/view_list.js b/web_list_html_widget/static/src/js/view_list.js new file mode 100644 index 00000000..d8f0b56b --- /dev/null +++ b/web_list_html_widget/static/src/js/view_list.js @@ -0,0 +1,10 @@ +openerp.web_list_html_widget = function(instance){ + instance.web.list.columns.map['field.html'] = 'instance.web.list.HtmlColumn'; + + instance.web.list.HtmlColumn = instance.web.list.Column.extend({ + _format: function (row_data, options) { + return instance.web.format_value( + row_data[this.id].value, this, options.value_if_empty); + } + }); +}; From 6eec5631fcd04df80972886112e80b3b54c96f66 Mon Sep 17 00:00:00 2001 From: Markus Schneider Date: Sat, 25 Oct 2014 16:11:45 +0200 Subject: [PATCH 2/2] add tranlsation file --- .../i18n/web_list_html_widget.pot | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 web_list_html_widget/i18n/web_list_html_widget.pot diff --git a/web_list_html_widget/i18n/web_list_html_widget.pot b/web_list_html_widget/i18n/web_list_html_widget.pot new file mode 100644 index 00000000..b099b985 --- /dev/null +++ b/web_list_html_widget/i18n/web_list_html_widget.pot @@ -0,0 +1,16 @@ +# Translation of OpenERP Server. +# This file contains the translation of the following modules: +# +msgid "" +msgstr "" +"Project-Id-Version: OpenERP Server 7.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2014-10-25 14:09+0000\n" +"PO-Revision-Date: 2014-10-25 16:10+0100\n" +"Last-Translator: M\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: \n" +