以下のコードは、テキストボックスにestates [0].idのみを示しています。フィールドにすべての値をロードする必要があります。そのようなことを行う方法。反復してフィールド値に追加する方法。
def on_change_company(self, cr, uid, ids, company_id, context=None):
if not company_id:
return {'value': {
'bpl_estate_id': False
}}
company = self.pool.get('bpl.company.n.registration').browse(cr, uid, company_id, context=context)
estates = company.estates
if estates:
return {
'value': {
'bpl_estate_id': estates[0].id
}
}
else:
return {
'value': {
'bpl_estate_id': 0
}
}