Community mailing list archives

community@mail.odoo.com

Re: related property field

by
OpenERP Master
- 02/27/2015 00:39:10
I retract my question. I assumed the application would be able to detect my string field without explicitly defining the arg. without string= I face the error however this is the correct way.

'product_unit_cost': fields.related('product_id', 'standard_price', string="Unit Cost", type="float"),

On Thu, Feb 26, 2015 at 11:01 PM, OpenERP Master <openerpmaster@gmail.com> wrote:
It possible to have a related field that is a property? For instance, I want to display the unit cost on the stock move tree which will be sourced from product template. This field used to be float now its property. When I load my view I get

  File "/usr/local/openerp/odoo/openerp/osv/fields.py", line 1432, in _fnct_read
    value = value[field][:1]
TypeError: 'float' object has no attribute '__getitem__

if I removed the [:1] it works, either a bug or what.