python - How to store this type of values in odoo? -


i have following requirements

class a:    _name='a'    _columns={          'store'=fields.one2many('b','link1','history'),        } class b:    _name='b'    _columns={            'name'=fields.char('employee names'),            'age'=fields.char('age'),            'link1': fields.many2one('a','link'),    } 

this module has one2many field has 2 fields 'name','age' .this values stored below module

class y:    _name='y'    _columns={         'detail': fields.one2many('z','link','details'),      }  class z:     _name='z'     _columns={           'name1': fields.char('name'),           'age2': fields.char('age'),           'link': fields.many2one('y','link'),        } 

in module store few names , age . , wanted button in module has function store value 'a' module .data has append keeping track of history

to store value a model have create them.

def track(self, cr, uid, ids, context=none):   values = []   obj in self.browse(cr, uid, ids, context):      line in obj.detail:         values.append([0, 0, {'name': line.name1,                               'age':line.age2,                                                                               'link1': line.link.id}                       ])      self.pool.get('a').create(cr, uid, {'store': values}) 

Comments

Popular posts from this blog

java - Run spring boot application error: Cannot instantiate interface org.springframework.context.ApplicationListener -

python - pip wont install .WHL files -

Excel VBA "Microsoft Windows Common Controls 6.0 (SP6)" Location Changes -