+4 votes

how to add a field related on odoo 
I would like to add a text field on stock.move related to stock.picking origin field 
I tried this :

    'sourcebl': fields.related('picking_id', 'origin',  type='char', relation='stock.picking', string='Class Description', store=True, readonly=True),

do you have any Idea

closed with the note: problem fixed
in Back-end by (10.5k points)
closed by | 37 views

1 Answer

+2 votes

'origin', AFAIK, is a char field, so you do not need relation.  I'm not really sure but the store and readonly maybe conflicting as well.  I don't think you really need to store this field.  So:

_columns={ 'sourcebl': fields.related('picking_id', 'origin', type='char', string='Class Description', readonly=True), }

by (4.6k points)
what about the new api ?
204 questions
180 answers
214,110 users