This question has been flagged
1 Reply
2257 Views

i want to get value from collecting_line from this code :

 

                    collecting_line = []

                    collecting_line.append({
                                                 'collecting_id','=',collecting_id,
                                                 'categ','=',nilai_browse.name,
                                                 'kpb_ke','=',nilai_browse_jasa.kpb_ke,
                                                 'jasa','=',nilai_browse_jasa.jasa,
                                                 'oli','=',nilai_browse_jasa.oli
                                                 }) 

                   self.write(cr, uid, collecting_id, {
                              'collecting_line':collecting_line
                              }, context=context)

i try to print collecting_line and the output like this [set([u'A', 1, 196, 'categ', 'oli', 2220.0, 'kpb_ke', 'jasa', 33330.0, 'collecting_id', '='])

how to get that value ? because i have to insert it in one to many field , but it didn't work. Normally i didn't see [set()] but now it appears

 

 

Avatar
Discard
Best Answer

If you want to write in one2many field, try the following:

collecting_line=[]

collecting_line.append((0,0,{ 'collecting_id':collecting_id,
                 'categ':nilai_browse.name,
                 'kpb_ke':nilai_browse_jasa.kpb_ke,
                 'jasa':nilai_browse_jasa.jasa,
                 'oli':nilai_browse_jasa.oli}))

self.write(cr, uid, collecting_id, {
              'collecting_line':collecting_line
              }, context=context)

  • set() is function for working on collection, specifically on unordered collection, used to remov duplicate items.

Hope this helps !!.

 

Avatar
Discard