I have a one2many field in Odoo and I need to populate lines with following method:
def add_lines(self, cr, uid, ids, context=None):
val = {'value': {'kh_lines_a1': [], 'kh_lines_a2': []}}
account_move_obj = self.pool.get('account.move')
line_ids = account_move_obj.search(cr, uid, [('vat_subject', '=', True)], context=context)
for line in account_move_obj.browse(cr, uid, line_ids, context=context):
res = {
'name': line.name,
"date": "2015-01-01"
}
val['value']['kh_lines_a1'].append(res)
return val
The result should be that new 'kh_lines_a1' are created according to the result from line search, but no data is returned.
As variables are returned correctly I guess there is something I missed with the "return" stuff.
Tried to change the dictionary paradigm but no success.