[REF] *: tree: use semantics decoration-{class} attributes

instead of deprecated colors and fonts attributes
This commit is contained in:
Aaron Bohy
2015-08-12 15:06:39 +02:00
parent 8fb1446203
commit 1c8ca666c7
6 changed files with 26 additions and 14 deletions
@@ -25,7 +25,7 @@
<field name="name">account.supplier.payment.tree</field>
<field name="model">account.payment</field>
<field name="arch" type="xml">
<tree colors="blue:state=='draft'; #707070:state=='sent'; #A0A0A0:state=='reconciled'" edit="false">
<tree decoration-info="state=='draft'" decoration-muted="state=='reconciled'" edit="false">
<field name="payment_date"/>
<field name="name"/>
<field name="journal_id"/>
+1 -1
View File
@@ -667,7 +667,7 @@
<field name="name">crm.lead.next.activity.tree</field>
<field name="model">crm.lead</field>
<field name="arch" type="xml">
<tree string="Next Activity" create="false" colors="red:date_action and (date_action &lt; current_date)" default_order="date_action">
<tree string="Next Activity" create="false" decoration-danger="date_action and (date_action &lt; current_date)" default_order="date_action">
<field name="name"/>
<field name="date_action"/>
<field name="next_activity_id"/>
@@ -133,7 +133,7 @@
<field name="name">hr.equipment.request.tree</field>
<field name="model">hr.equipment.request</field>
<field name="arch" type="xml">
<tree string="maintenance Request" fonts="bold:message_unread==True">
<tree string="maintenance Request" decoration-bf="message_unread==True">
<field name="message_unread" invisible="1"/>
<field name="name"/>
<field name="request_date" groups="base.group_no_one"/>
@@ -313,7 +313,7 @@
<field name="name">hr.equipment.tree</field>
<field name="model">hr.equipment</field>
<field name="arch" type="xml">
<tree string="Assign To Employee" fonts="bold:message_unread==True">
<tree string="Assign To Employee" decoration-bf="message_unread==True">
<field name="message_unread" invisible="1"/>
<field name="name"/>
<field name="employee_id" string="Employee"/>
@@ -242,7 +242,7 @@
<field name="model">account.analytic.account</field>
<field eval="10" name="priority"/>
<field name="arch" type="xml">
<tree toolbar="1" colors="grey:state=='close';" string="Analytic Accounts">
<tree toolbar="1" decoration-muted="state=='close'" string="Analytic Accounts">
<field name="complete_name"/>
<field name="manager_id"/>
<field name="contract_type"/>
+3 -3
View File
@@ -731,7 +731,7 @@
<field name="recompute_pack_op" invisible="1"/>
<field name="pack_operation_ids" invisible="1"/>
<field name="pack_operation_product_ids" options="{'reload_on_button': True}" context="{'default_picking_id': id, 'default_location_id': location_id, 'default_location_dest_id': location_dest_id}">
<tree editable="bottom" colors="grey:result_package_id;red:qty_done&gt;product_qty;green:qty_done==product_qty and state!='done'">
<tree editable="bottom" decoration-muted="result_package_id" decoration-danger="qty_done&gt;product_qty" decoration-success="qty_done==product_qty and state!='done'">
<field name="package_id" groups="stock.group_tracking_lot" invisible="1"/>
<field name="product_id" on_change="product_id_change(product_id, product_uom_id, product_qty)" required="1" attrs="{'readonly': [('fresh_record', '=', False)]}"/>
<field name="fresh_record" invisible="1"/>
@@ -756,7 +756,7 @@
</field>
<field name="picking_type_entire_packs" invisible="1"/>
<field name="pack_operation_pack_ids" options="{'reload_on_button': True}" attrs="{'invisible': [('pack_operation_pack_ids', '=', []), ('picking_type_entire_packs', '=', False)]}" context="{'default_picking_id': id, 'default_location_id': location_id, 'default_location_dest_id': location_dest_id, 'default_picking_id': id}" groups="stock.group_tracking_lot">
<tree editable="bottom" colors="grey:qty_done&gt;0;">
<tree editable="bottom" decoration-muted="qty_done&gt;0">
<field name="package_id" required="1" string="Package To Move"/>
<field name="picking_id" invisible="1"/>
<field name="location_id" domain="[('id', 'child_of', parent.location_id)]" invisible="1"/>
@@ -1165,7 +1165,7 @@
<field name="model">stock.move</field>
<field eval="4" name="priority"/>
<field name="arch" type="xml">
<tree decoration-muted="scrapped == True" colors="grey:scrapped == True" string="Stock Moves" editable="bottom">
<tree decoration-muted="scrapped == True" string="Stock Moves" editable="bottom">
<field name="product_id" on_change="onchange_product_id(product_id,location_id,location_dest_id, parent.partner_id)"/>
<field name="name" invisible="1"/>
<field name="product_uom_qty" on_change="onchange_quantity(product_id, product_uom_qty, product_uom, product_uos)"/>
+18 -6
View File
@@ -974,19 +974,31 @@ Tree views can take supplementary attributes to further customize their
behavior:
``colors``
mappings of colors to conditions. If the condition evaluates to ``True``,
the corresponding color is applied to the row:
.. deprecated:: 9.0
replaced by ``decoration-{$name}``
``decoration-{$name}``
allow changing the style of a row's text based on the corresponding
record's attributes.
Values are Python expressions. For each record, the expression is evaluated
with the record's attributes as context values and if ``true``, the
corresponding style is applied to the row. Other context values are
``uid`` (the id of the current user) and ``current_date`` (the current date
as a string of the form ``yyyy-MM-dd``).
``{$name}`` can be ``bf`` (``font-weight: bold``), ``it``
(``font-style: italic``), or any bootstrap contextual color (``danger``,
``info``, ``muted``, ``primary``, ``success`` or ``warning``).
.. code-block:: xml
<tree string="Idea Categories" colors="blue:state=='draft';red:state=='trashed'">
<tree string="Idea Categories" decoration-info="state=='draft'"
decoration-danger="state=='trashed'">
<field name="name"/>
<field name="state"/>
</tree>
Clauses are separated by ``;``, the color and condition are separated by
``:``.
``editable``
Either ``"top"`` or ``"bottom"``. Makes the tree view editable in-place
(rather than having to go through the form view), the value is the