From f3f52bb82c5129156db691640dd19ce2459b259a Mon Sep 17 00:00:00 2001 From: Adil Houmadi Date: Thu, 19 Feb 2015 13:37:34 +0100 Subject: [PATCH] [IMP] : - Rename the module to web_widget_color - Remove special type (Color) and use (Char) instead of. --- web_color/fields.py | 49 ------------------ web_color/view/web_color_view.xml | 12 ----- {web_color => web_widget_color}/README.rst | 19 +++---- {web_color => web_widget_color}/__init__.py | 1 - .../__openerp__.py | 6 +-- {web_color => web_widget_color}/controller.py | 4 +- .../doc/form_view.png | Bin .../doc/list_view.png | Bin .../doc/picker.png | Bin .../static/description/icon.png | Bin .../static/lib/jscolor/arrow.gif | Bin .../static/lib/jscolor/cross.gif | Bin .../static/lib/jscolor/demo.html | 0 .../static/lib/jscolor/hs.png | Bin .../static/lib/jscolor/hv.png | Bin .../static/lib/jscolor/jscolor.js | 0 .../static/src/css/widget.css | 0 .../static/src/js/widget.js | 2 +- .../static/src/xml/widget.xml | 0 .../view/web_widget_color_view.xml | 12 +++++ 20 files changed, 28 insertions(+), 77 deletions(-) delete mode 100644 web_color/fields.py delete mode 100644 web_color/view/web_color_view.xml rename {web_color => web_widget_color}/README.rst (81%) rename {web_color => web_widget_color}/__init__.py (97%) rename {web_color => web_widget_color}/__openerp__.py (92%) rename {web_color => web_widget_color}/controller.py (92%) rename {web_color => web_widget_color}/doc/form_view.png (100%) rename {web_color => web_widget_color}/doc/list_view.png (100%) rename {web_color => web_widget_color}/doc/picker.png (100%) rename {web_color => web_widget_color}/static/description/icon.png (100%) rename {web_color => web_widget_color}/static/lib/jscolor/arrow.gif (100%) rename {web_color => web_widget_color}/static/lib/jscolor/cross.gif (100%) rename {web_color => web_widget_color}/static/lib/jscolor/demo.html (100%) rename {web_color => web_widget_color}/static/lib/jscolor/hs.png (100%) rename {web_color => web_widget_color}/static/lib/jscolor/hv.png (100%) rename {web_color => web_widget_color}/static/lib/jscolor/jscolor.js (100%) rename {web_color => web_widget_color}/static/src/css/widget.css (100%) rename {web_color => web_widget_color}/static/src/js/widget.js (97%) rename {web_color => web_widget_color}/static/src/xml/widget.xml (100%) create mode 100644 web_widget_color/view/web_widget_color_view.xml diff --git a/web_color/fields.py b/web_color/fields.py deleted file mode 100644 index 7883815d..00000000 --- a/web_color/fields.py +++ /dev/null @@ -1,49 +0,0 @@ -# -*- encoding: utf-8 -*- -############################################################################ -# -# OpenERP, Open Source Web Color -# Copyright (C) 2012 Savoir-faire Linux (). -# Copyright (C) 2014 Anybox -# Copyright (C) 2015 Taktik SA -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU 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 General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . -# -# @author Étienne Beaudry Auger -# @author Adil Houmadi -# -############################################################################## -from openerp import fields -from openerp.osv import fields as fields_osv - - -class Color(fields.Char): - type = 'color' - - def __init__(self, *args, **kwargs): - super(Color, self).__init__(*args, **kwargs) - self.size = 7 - - -fields.Color = Color - - -class color(fields_osv.char): - _type = 'color' - - def __init__(self, *args, **kwargs): - kwargs['size'] = 7 - super(color, self).__init__(*args, **kwargs) - - -fields_osv.color = color \ No newline at end of file diff --git a/web_color/view/web_color_view.xml b/web_color/view/web_color_view.xml deleted file mode 100644 index cb2b3f45..00000000 --- a/web_color/view/web_color_view.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/web_color/README.rst b/web_widget_color/README.rst similarity index 81% rename from web_color/README.rst rename to web_widget_color/README.rst index 2b9729a8..fb15ffe0 100644 --- a/web_color/README.rst +++ b/web_widget_color/README.rst @@ -1,5 +1,5 @@ =========================== -OpenERP web_color module +OpenERP web_widget_color module =========================== This module aims to add a color picker to openERP/Odoo. @@ -41,16 +41,18 @@ It adds a new data type ``color``. To apply it, simply change the field declaration as following:: _columns = { - 'color': fields.color( - u"Couleur", - help=u"Toutes couleur valid css, exemple blue ou #f57900"), - + 'color': fields.char( + u"Couleur", + size=7, + help=u"Toutes couleur valid css, exemple blue ou #f57900" + ), + } OR - color = fields.Color( + color = fields.Char( string="Color", - required=False, + size=7, help="Choose your color" ) @@ -63,13 +65,12 @@ add the field as any other one. Here is a part of tree view example:: ... - + ... ... - .. |picker| image:: ./doc/picker.png .. |formview| image:: ./doc/form_view.png .. |listview| image:: ./doc/list_view.png diff --git a/web_color/__init__.py b/web_widget_color/__init__.py similarity index 97% rename from web_color/__init__.py rename to web_widget_color/__init__.py index cb63920d..5c39b313 100644 --- a/web_color/__init__.py +++ b/web_widget_color/__init__.py @@ -23,5 +23,4 @@ # @author Adil Houmadi # ############################################################################## -import fields import controller \ No newline at end of file diff --git a/web_color/__openerp__.py b/web_widget_color/__openerp__.py similarity index 92% rename from web_color/__openerp__.py rename to web_widget_color/__openerp__.py index 668def5a..cfaa76b8 100644 --- a/web_color/__openerp__.py +++ b/web_widget_color/__openerp__.py @@ -1,7 +1,7 @@ # -*- encoding: utf-8 -*- ############################################################################ # -# OpenERP, Open Source Web Color +# OpenERP, Open Source Web Widget Color # Copyright (C) 2012 Savoir-faire Linux (). # Copyright (C) 2014 Anybox # Copyright (C) 2015 Taktik SA @@ -24,7 +24,7 @@ # ############################################################################## { - 'name': "Web Color", + 'name': "Web Widget Color", 'category': "web", 'description': """ This module aims to add a color picker to openERP/Odoo. @@ -32,7 +32,7 @@ 'version': "1.0", 'depends': ['base', 'web'], 'data': [ - 'view/web_color_view.xml' + 'view/web_widget_color_view.xml' ], 'qweb': [ 'static/src/xml/widget.xml', diff --git a/web_color/controller.py b/web_widget_color/controller.py similarity index 92% rename from web_color/controller.py rename to web_widget_color/controller.py index 3b766877..f1526f5c 100644 --- a/web_color/controller.py +++ b/web_widget_color/controller.py @@ -32,10 +32,10 @@ import mimetypes class JsColor(http.Controller): @http.route("/jscolor/", type="http", auth="user") def jscolor(self, image): - addons_path = http.addons_manifest['web_color']['addons_path'] + addons_path = http.addons_manifest['web_widget_color']['addons_path'] path = join( addons_path, - 'web_color', + 'web_widget_color', 'static', 'lib', 'jscolor', diff --git a/web_color/doc/form_view.png b/web_widget_color/doc/form_view.png similarity index 100% rename from web_color/doc/form_view.png rename to web_widget_color/doc/form_view.png diff --git a/web_color/doc/list_view.png b/web_widget_color/doc/list_view.png similarity index 100% rename from web_color/doc/list_view.png rename to web_widget_color/doc/list_view.png diff --git a/web_color/doc/picker.png b/web_widget_color/doc/picker.png similarity index 100% rename from web_color/doc/picker.png rename to web_widget_color/doc/picker.png diff --git a/web_color/static/description/icon.png b/web_widget_color/static/description/icon.png similarity index 100% rename from web_color/static/description/icon.png rename to web_widget_color/static/description/icon.png diff --git a/web_color/static/lib/jscolor/arrow.gif b/web_widget_color/static/lib/jscolor/arrow.gif similarity index 100% rename from web_color/static/lib/jscolor/arrow.gif rename to web_widget_color/static/lib/jscolor/arrow.gif diff --git a/web_color/static/lib/jscolor/cross.gif b/web_widget_color/static/lib/jscolor/cross.gif similarity index 100% rename from web_color/static/lib/jscolor/cross.gif rename to web_widget_color/static/lib/jscolor/cross.gif diff --git a/web_color/static/lib/jscolor/demo.html b/web_widget_color/static/lib/jscolor/demo.html similarity index 100% rename from web_color/static/lib/jscolor/demo.html rename to web_widget_color/static/lib/jscolor/demo.html diff --git a/web_color/static/lib/jscolor/hs.png b/web_widget_color/static/lib/jscolor/hs.png similarity index 100% rename from web_color/static/lib/jscolor/hs.png rename to web_widget_color/static/lib/jscolor/hs.png diff --git a/web_color/static/lib/jscolor/hv.png b/web_widget_color/static/lib/jscolor/hv.png similarity index 100% rename from web_color/static/lib/jscolor/hv.png rename to web_widget_color/static/lib/jscolor/hv.png diff --git a/web_color/static/lib/jscolor/jscolor.js b/web_widget_color/static/lib/jscolor/jscolor.js similarity index 100% rename from web_color/static/lib/jscolor/jscolor.js rename to web_widget_color/static/lib/jscolor/jscolor.js diff --git a/web_color/static/src/css/widget.css b/web_widget_color/static/src/css/widget.css similarity index 100% rename from web_color/static/src/css/widget.css rename to web_widget_color/static/src/css/widget.css diff --git a/web_color/static/src/js/widget.js b/web_widget_color/static/src/js/widget.js similarity index 97% rename from web_color/static/src/js/widget.js rename to web_widget_color/static/src/js/widget.js index a8a3de55..8b3401ce 100644 --- a/web_color/static/src/js/widget.js +++ b/web_widget_color/static/src/js/widget.js @@ -1,4 +1,4 @@ -openerp.web_color = function (instance) { +openerp.web_widget_color = function (instance) { instance.web.form.widgets.add('color', 'instance.web.form.FieldColor'); diff --git a/web_color/static/src/xml/widget.xml b/web_widget_color/static/src/xml/widget.xml similarity index 100% rename from web_color/static/src/xml/widget.xml rename to web_widget_color/static/src/xml/widget.xml diff --git a/web_widget_color/view/web_widget_color_view.xml b/web_widget_color/view/web_widget_color_view.xml new file mode 100644 index 00000000..7c2c8d0f --- /dev/null +++ b/web_widget_color/view/web_widget_color_view.xml @@ -0,0 +1,12 @@ + + + + + + \ No newline at end of file