Browse Source

[ADD] Add web widget auto color module

pull/124/head
Adrien Peiffer (ACSONE) 9 years ago
parent
commit
03951e6c58
  1. 54
      web_widget_auto_color/README.rst
  2. 1
      web_widget_auto_color/__init__.py
  3. 41
      web_widget_auto_color/__openerp__.py
  4. 61
      web_widget_auto_color/static/src/js/view_list.js
  5. 8
      web_widget_auto_color/static/src/xml/templates.xml
  6. 10
      web_widget_auto_color/views/web_widget_auto_color.xml

54
web_widget_auto_color/README.rst

@ -0,0 +1,54 @@
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
:alt: License
Web Widget Auto Color
=====================
This module was written to offer a new autocolor widget which can be used on
field in trees view. Using this widget causes an identical coloration for cells
of the same value in a list view.
Installation
============
To install this module, you need to:
* Click on install button
Usage
=====
In the view declaration, put widget='autocolor' attribute in the field tag::
...
<field name="arch" type="xml">
<tree string="View name">
...
<field name="name"/>
<field name="name" widget="autocolor"/>
...
</tree>
</field>
...
Credits
=======
Contributors
------------
* Stéphane Bidoul (ACSONE) <stephane.bidoul@acsone.eu>
* Adrien Peiffer (ACSONE) <adrien.peiffer@acsone.eu>
Maintainer
----------
.. image:: http://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: http://odoo-community.org
This module is maintained by the OCA.
OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use.
To contribute to this module, please visit http://odoo-community.org.

1
web_widget_auto_color/__init__.py

@ -0,0 +1 @@
# -*- coding: utf-8 -*-

41
web_widget_auto_color/__openerp__.py

@ -0,0 +1,41 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# This file is part of web_widget_auto_color,
# an Odoo module.
#
# Copyright (c) 2015 ACSONE SA/NV (<http://acsone.eu>)
#
# web_widget_auto_color 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.
#
# web_widget_auto_color 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 web_widget_auto_color.
# If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
{
'name': "Web Widget Auto Color",
'author': "ACSONE SA/NV",
'website': "http://acsone.eu",
'category': 'web',
'version': '0.1',
'license': 'AGPL-3',
'depends': [
'web',
],
'data': [
'views/web_widget_auto_color.xml',
],
'qweb': [
'static/src/xml/templates.xml',
],
}

61
web_widget_auto_color/static/src/js/view_list.js
File diff suppressed because it is too large
View File

8
web_widget_auto_color/static/src/xml/templates.xml

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<templates id="template" xml:space="preserve">
<tr t-extend="ListView.row">
<t t-jquery="td[t-att-data-field='column.id']">
this.attr('t-att-style', "column.widget =='autocolor' and view.auto_color_cell_style(record, column)")
</t>
</tr>
</templates>

10
web_widget_auto_color/views/web_widget_auto_color.xml

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<template id="assets_backend" name="web_widget_auto_color" inherit_id="web.assets_backend">
<xpath expr="." position="inside">
<script type="text/javascript" src="/web_widget_auto_color/static/src/js/view_list.js"></script>
</xpath>
</template>
</data>
</openerp>
Loading…
Cancel
Save