Odoo Help


How to address fields.related correctly?

Jochen Miller
on 6/11/14, 9:43 AM 1,016 views

I've some problems to address fields.related correctly.

class custom_purchase_order(osv.Model):

_inherit = 'purchase.order'
_columns = {
'x_custom_field_p_o': fields.char('Custom Field', size=64, readonly=False, ondelete='set null', select=True),


class custom_stock_picking_in(osv.Model):
_inherit = 'stock.picking.in'
_columns = {

    'x_custom_field_s_p_i': fields.related('purchase_id', 'x_custom_field_p_o', type='char', relation='purchase.order', readonly=True, store=True, string='Custom Field from Purchase Order'),


I only want to show the value of the custom_field_p_o in Incoming Shipments. (It should match to the Purchase ID / Order ID)

I don't get it work.

ERROR: value = value[field] or False TypeError: 'int' object has no attribute '__getitem__'

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 6/11/14, 9:43 AM
Seen: 1016 times
Last updated: 3/16/15, 8:10 AM