Fix deprecation colors attibute on xml view

This commit is contained in:
resteve 2015-08-17 23:16:44 +02:00
parent 6a44579843
commit 3938959d59
3 changed files with 13 additions and 2 deletions

View File

@ -3,6 +3,7 @@
# the full copyright notices and license terms.
from trytond.pool import Pool, PoolMeta
from trytond.transaction import Transaction
from trytond.pyson import If, Eval, Less
__all__ = ['Template', 'Product']
__metaclass__ = PoolMeta
@ -11,6 +12,11 @@ __metaclass__ = PoolMeta
class Template:
__name__ = 'product.template'
@classmethod
def view_attributes(cls):
return [('/tree', 'colors',
If(Less(Eval('quantity', 1), 1), 'red', 'black'))]
def sum_product(self, name):
Location = Pool().get('stock.location')
@ -26,6 +32,11 @@ class Template:
class Product:
__name__ = 'product.product'
@classmethod
def view_attributes(cls):
return [('/tree', 'colors',
If(Less(Eval('quantity', 1), 1), 'red', 'black'))]
@classmethod
def get_quantity(cls, products, name):
Location = Pool().get('stock.location')

View File

@ -1,7 +1,7 @@
<?xml version="1.0"?>
<!-- This file is part product_qty module for Tryton.
The COPYRIGHT file at the top level of this repository contains the full copyright notices and license terms. -->
<tree string="Products" colors="If(Less(Eval('quantity', 1), 1), 'red', 'black')">
<tree string="Products">
<field name="rec_name"/>
<field name="quantity"/>
<field name="forecast_quantity"/>

View File

@ -1,7 +1,7 @@
<?xml version="1.0"?>
<!-- This file is part product_qty module for Tryton.
The COPYRIGHT file at the top level of this repository contains the full copyright notices and license terms. -->
<tree string="Products" colors="If(Less(Eval('quantity', 1), 1), 'red', 'black')">
<tree string="Products">
<field name="name"/>
<field name="list_price"/>
<field name="cost_price"/>