【发布时间】:2014-06-16 11:21:02
【问题描述】:
我继承了 product.product 以获得可用的产品,所以:
'qty_stock': fields.related('rented_product_id', 'qty_available', type='float', relation='product.product', string="En stosck", readonly=True),
'qty_1': fields.related('rented_product_id', 'incoming_qty', type='integer', relation='product.product', string="Résrver", readonly=True),
'qty_2': fields.related('rented_product_id', 'outgoing_qty', type='integer', relation='product.product', string="Sortant", readonly=True),
'qty_state': fields.selection([('libre','Libre'),('louee','Louée'),('reserver','Réservée')], 'Status', readonly=True
我想在字段 'qty_state' 中显示:
if 'qty_1' > 0 and 'qty_2 < 0 : display 'reserver'
if 'qty_1' > 0 and 'qty_2 = 0 : display 'louee'
if 'qty_1' = 0 and 'qty_2 = 0 : display 'libre'
请帮忙
【问题讨论】: