Browse Source

[IMP] : - Rename the module to web_widget_color

- Remove special type (Color) and use (Char) instead of.
pull/85/head
Adil Houmadi 10 years ago
parent
commit
f3f52bb82c
  1. 49
      web_color/fields.py
  2. 12
      web_color/view/web_color_view.xml
  3. 19
      web_widget_color/README.rst
  4. 1
      web_widget_color/__init__.py
  5. 6
      web_widget_color/__openerp__.py
  6. 4
      web_widget_color/controller.py
  7. 0
      web_widget_color/doc/form_view.png
  8. 0
      web_widget_color/doc/list_view.png
  9. 0
      web_widget_color/doc/picker.png
  10. 0
      web_widget_color/static/description/icon.png
  11. 0
      web_widget_color/static/lib/jscolor/arrow.gif
  12. 0
      web_widget_color/static/lib/jscolor/cross.gif
  13. 0
      web_widget_color/static/lib/jscolor/demo.html
  14. 0
      web_widget_color/static/lib/jscolor/hs.png
  15. 0
      web_widget_color/static/lib/jscolor/hv.png
  16. 0
      web_widget_color/static/lib/jscolor/jscolor.js
  17. 0
      web_widget_color/static/src/css/widget.css
  18. 2
      web_widget_color/static/src/js/widget.js
  19. 0
      web_widget_color/static/src/xml/widget.xml
  20. 12
      web_widget_color/view/web_widget_color_view.xml

49
web_color/fields.py

@ -1,49 +0,0 @@
# -*- encoding: utf-8 -*-
############################################################################
#
# OpenERP, Open Source Web Color
# Copyright (C) 2012 Savoir-faire Linux (<http://www.savoirfairelinux.com>).
# Copyright (C) 2014 Anybox <http://anybox.fr>
# Copyright (C) 2015 Taktik SA <http://taktik.be>
#
# 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 <http://www.gnu.org/licenses/>.
#
# @author Étienne Beaudry Auger <etienne.b.auger@savoirfairelinux.com>
# @author Adil Houmadi <ah@taktik.be>
#
##############################################################################
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

12
web_color/view/web_color_view.xml

@ -1,12 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<openerp>
<data>
<template id="assets_backend" name="web_color assets" inherit_id="web.assets_backend">
<xpath expr="." position="inside">
<link rel="stylesheet" href="/web_color/static/src/css/widget.css"/>
<script type="text/javascript" src="/web_color/static/lib/jscolor/jscolor.js"></script>
<script type="text/javascript" src="/web_color/static/src/js/widget.js"></script>
</xpath>
</template>
</data>
</openerp>

19
web_color/README.rst → 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. 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:: declaration as following::
_columns = { _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 OR
color = fields.Color(
color = fields.Char(
string="Color", string="Color",
required=False,
size=7,
help="Choose your color" help="Choose your color"
) )
@ -63,13 +65,12 @@ add the field as any other one. Here is a part of tree view example::
<tree string="View name"> <tree string="View name">
... ...
<field name="name"/> <field name="name"/>
<field name="color"/>
<field name="color" widget="color"/>
... ...
</tree> </tree>
</field> </field>
... ...
.. |picker| image:: ./doc/picker.png .. |picker| image:: ./doc/picker.png
.. |formview| image:: ./doc/form_view.png .. |formview| image:: ./doc/form_view.png
.. |listview| image:: ./doc/list_view.png .. |listview| image:: ./doc/list_view.png

1
web_color/__init__.py → web_widget_color/__init__.py

@ -23,5 +23,4 @@
# @author Adil Houmadi <ah@taktik.be> # @author Adil Houmadi <ah@taktik.be>
# #
############################################################################## ##############################################################################
import fields
import controller import controller

6
web_color/__openerp__.py → web_widget_color/__openerp__.py

@ -1,7 +1,7 @@
# -*- encoding: utf-8 -*- # -*- encoding: utf-8 -*-
############################################################################ ############################################################################
# #
# OpenERP, Open Source Web Color
# OpenERP, Open Source Web Widget Color
# Copyright (C) 2012 Savoir-faire Linux (<http://www.savoirfairelinux.com>). # Copyright (C) 2012 Savoir-faire Linux (<http://www.savoirfairelinux.com>).
# Copyright (C) 2014 Anybox <http://anybox.fr> # Copyright (C) 2014 Anybox <http://anybox.fr>
# Copyright (C) 2015 Taktik SA <http://taktik.be> # Copyright (C) 2015 Taktik SA <http://taktik.be>
@ -24,7 +24,7 @@
# #
############################################################################## ##############################################################################
{ {
'name': "Web Color",
'name': "Web Widget Color",
'category': "web", 'category': "web",
'description': """ 'description': """
This module aims to add a color picker to openERP/Odoo. This module aims to add a color picker to openERP/Odoo.
@ -32,7 +32,7 @@
'version': "1.0", 'version': "1.0",
'depends': ['base', 'web'], 'depends': ['base', 'web'],
'data': [ 'data': [
'view/web_color_view.xml'
'view/web_widget_color_view.xml'
], ],
'qweb': [ 'qweb': [
'static/src/xml/widget.xml', 'static/src/xml/widget.xml',

4
web_color/controller.py → web_widget_color/controller.py

@ -32,10 +32,10 @@ import mimetypes
class JsColor(http.Controller): class JsColor(http.Controller):
@http.route("/jscolor/<string:image>", type="http", auth="user") @http.route("/jscolor/<string:image>", type="http", auth="user")
def jscolor(self, image): 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( path = join(
addons_path, addons_path,
'web_color',
'web_widget_color',
'static', 'static',
'lib', 'lib',
'jscolor', 'jscolor',

0
web_color/doc/form_view.png → web_widget_color/doc/form_view.png

Before

Width: 307  |  Height: 62  |  Size: 1.8 KiB

After

Width: 307  |  Height: 62  |  Size: 1.8 KiB

0
web_color/doc/list_view.png → web_widget_color/doc/list_view.png

Before

Width: 570  |  Height: 217  |  Size: 14 KiB

After

Width: 570  |  Height: 217  |  Size: 14 KiB

0
web_color/doc/picker.png → web_widget_color/doc/picker.png

Before

Width: 266  |  Height: 179  |  Size: 5.9 KiB

After

Width: 266  |  Height: 179  |  Size: 5.9 KiB

0
web_color/static/description/icon.png → web_widget_color/static/description/icon.png

Before

Width: 64  |  Height: 64  |  Size: 3.4 KiB

After

Width: 64  |  Height: 64  |  Size: 3.4 KiB

0
web_color/static/lib/jscolor/arrow.gif → web_widget_color/static/lib/jscolor/arrow.gif

Before

Width: 7  |  Height: 11  |  Size: 66 B

After

Width: 7  |  Height: 11  |  Size: 66 B

0
web_color/static/lib/jscolor/cross.gif → web_widget_color/static/lib/jscolor/cross.gif

Before

Width: 15  |  Height: 15  |  Size: 83 B

After

Width: 15  |  Height: 15  |  Size: 83 B

0
web_color/static/lib/jscolor/demo.html → web_widget_color/static/lib/jscolor/demo.html

0
web_color/static/lib/jscolor/hs.png → web_widget_color/static/lib/jscolor/hs.png

Before

Width: 181  |  Height: 101  |  Size: 2.6 KiB

After

Width: 181  |  Height: 101  |  Size: 2.6 KiB

0
web_color/static/lib/jscolor/hv.png → web_widget_color/static/lib/jscolor/hv.png

Before

Width: 181  |  Height: 101  |  Size: 2.8 KiB

After

Width: 181  |  Height: 101  |  Size: 2.8 KiB

0
web_color/static/lib/jscolor/jscolor.js → web_widget_color/static/lib/jscolor/jscolor.js

0
web_color/static/src/css/widget.css → web_widget_color/static/src/css/widget.css

2
web_color/static/src/js/widget.js → 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'); instance.web.form.widgets.add('color', 'instance.web.form.FieldColor');

0
web_color/static/src/xml/widget.xml → web_widget_color/static/src/xml/widget.xml

12
web_widget_color/view/web_widget_color_view.xml

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<openerp>
<data>
<template id="assets_backend" name="web_widget_color assets" inherit_id="web.assets_backend">
<xpath expr="." position="inside">
<link rel="stylesheet" href="/web_widget_color/static/src/css/widget.css"/>
<script type="text/javascript" src="/web_widget_color/static/lib/jscolor/jscolor.js"></script>
<script type="text/javascript" src="/web_widget_color/static/src/js/widget.js"></script>
</xpath>
</template>
</data>
</openerp>
Loading…
Cancel
Save