Browse Source

[IMP][web_widget_auto_color] Replace widget by simple autocolor attribute

pull/124/head
Adrien Peiffer (ACSONE) 10 years ago
parent
commit
edbefd1305
  1. 10
      web_widget_auto_color/README.rst
  2. 4
      web_widget_auto_color/static/src/js/view_list.js
  3. 2
      web_widget_auto_color/static/src/xml/templates.xml

10
web_widget_auto_color/README.rst

@ -4,9 +4,9 @@
Web Widget Auto Color 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.
This module was written to offer a new autocolor attribute which can be used on
field in trees view. Using this attribute causes an identical coloration for
cells of the same value in a list view.
Installation Installation
============ ============
@ -18,14 +18,14 @@ To install this module, you need to:
Usage Usage
===== =====
In the view declaration, put widget='autocolor' attribute in the field tag::
In the view declaration, put autocolor="1" attribute in the field tag::
... ...
<field name="arch" type="xml"> <field name="arch" type="xml">
<tree string="View name"> <tree string="View name">
... ...
<field name="name"/> <field name="name"/>
<field name="name" widget="autocolor"/>
<field name="name2" autocolor="1"/>
... ...
</tree> </tree>
</field> </field>

4
web_widget_auto_color/static/src/js/view_list.js

@ -54,8 +54,4 @@ openerp.web_widget_auto_color = function(instance) {
return style return style
} }
}); });
instance.web.form.widgets.add('autocolor', 'instance.web.form.AbstractField');
}; };

2
web_widget_auto_color/static/src/xml/templates.xml

@ -2,7 +2,7 @@
<templates id="template" xml:space="preserve"> <templates id="template" xml:space="preserve">
<tr t-extend="ListView.row"> <tr t-extend="ListView.row">
<t t-jquery="td[t-att-data-field='column.id']"> <t t-jquery="td[t-att-data-field='column.id']">
this.attr('t-att-style', "column.widget =='autocolor' and view.auto_color_cell_style(render_cell(record, column))")
this.attr('t-att-style', "column.autocolor == '1' and view.auto_color_cell_style(render_cell(record, column), column)")
</t> </t>
</tr> </tr>
</templates> </templates>
Loading…
Cancel
Save