I added a one2many field by custom module like this :
from openerp.osv import fields, orm
class AccountVoucher(orm.Model):
_inherit = 'account.voucher'
_name = 'account.voucher'
_columns = {
'bls_to_pay': fields.one2many('stock.picking.out','bl_id','BLS to pay'),
}
Obviously I added on stock.picking.out (and stock.picking) a many2one field 'bl_id' like this :
'bl_id': fields.many2one('account.voucher','Bls to pay'),
On the XML Side, I have my one2many field getting his values by an on change method, depending on the selected partner ( I made an onchange method on partner_id field ).
Now, when I select a partner, there are values displayed on the one2many field, I want to get the one2many fiel values, how this can be possible ?
I Know that a one2many field is a logical field, so data are stored on the stock.picking.out model, on the foreign key ( many2one ), I want to know how to access the one2many field values displayed via the foreign key many2one ?
What do you want to do with the values? do you want to sum them up?
I want just one field from the one2many relation, I want to display all its values on a selection field on the same view. it's like copying a column on a selection field.
For that I'm trying another solution explained in my topic here : https://www.odoo.com/forum/help-1/question/functionnal-field-type-selection-issue-openerpv7-70178