[IMP] : - Rename the module to web_widget_color
- Remove special type (Color) and use (Char) instead of.9.0
|
@ -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
|
|
@ -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>
|
|
@ -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::
|
|||
<tree string="View name">
|
||||
...
|
||||
<field name="name"/>
|
||||
<field name="color"/>
|
||||
<field name="color" widget="color"/>
|
||||
...
|
||||
</tree>
|
||||
</field>
|
||||
...
|
||||
|
||||
|
||||
.. |picker| image:: ./doc/picker.png
|
||||
.. |formview| image:: ./doc/form_view.png
|
||||
.. |listview| image:: ./doc/list_view.png
|
|
@ -23,5 +23,4 @@
|
|||
# @author Adil Houmadi <ah@taktik.be>
|
||||
#
|
||||
##############################################################################
|
||||
import fields
|
||||
import controller
|
|
@ -1,7 +1,7 @@
|
|||
# -*- 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) 2014 Anybox <http://anybox.fr>
|
||||
# Copyright (C) 2015 Taktik SA <http://taktik.be>
|
||||
|
@ -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',
|
|
@ -32,10 +32,10 @@ import mimetypes
|
|||
class JsColor(http.Controller):
|
||||
@http.route("/jscolor/<string:image>", 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',
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 5.9 KiB After Width: | Height: | Size: 5.9 KiB |
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 3.4 KiB |
Before Width: | Height: | Size: 66 B After Width: | Height: | Size: 66 B |
Before Width: | Height: | Size: 83 B After Width: | Height: | Size: 83 B |
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 2.6 KiB |
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 2.8 KiB |
|
@ -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');
|
||||
|
|
@ -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>
|