Hello,
I am working with the product.product
class that inherits by delegation from product.template
. I want to access field uos_id
from the parent class. The field is defined as fields.many2one('product.uom', 'Unit of Sale',help='Some text')
.
I tried to access the fields as follows:
product_obj = self.pool.get('product.product')
product = product_obj.browse(cr, uid, product_id, context=context2)
uom = product.uos_id
The code crashes some lines further because (I guess) the variable is empty. I suspect the issue is in the way I access the many2one field because when I use field uos_coeff from the parent class, it works fine (the field is defined as a fields.float('Unit of Measure -> UOS Coeff', digits_compute= dp.get_precision('Product UoS'), help='Coefficient')
Any idea of what's wrong?
Fixed: the proper syntax is uom = product.uos_id.id