Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

How to move data from line to line

By
yusuf
on 4/19/15, 11:43 PM 597 views

Hi all,


i have problems, how to move data from line to another line

i have object "ta.input.nilai" when i save from this object automatic data from "ta.input.nilai" move to object "ta.nilai"

this is syntax "ta.input.nilai"


class ta_input_nilai_dosen (osv.osv):

_name='ta.input.nilai'

_description=' Input Nilai'

def input_nilai(self,cr,uid,ids,context=None):

val = self.browse(cr,uid,ids,context={})[0]

obj_nilai=self.pool.get('ta.nilai')

obj_line=self.pool.get('ta.nilai.line')

print "==================================",obj_nilai

move_list=[]

nilai_id=obj_nilai.create(cr,uid,{

'dosen_id':val.dosen_id.id,

'name':val.name,

'semester_kurikulum':val.semester_kurikulum,

'thn_akademik':val.thn_akademik.id,

'thn_kurikulum_id':val.thn_kurikulum_id.id

})

for x in val.input_nilai_lines:

print"====================================",x.mahasiswa_id.name,

move_list.append(obj_line.create(cr,uid, {

'mahasiswa_id': x.mahasiswa_id.id,

'mata_kuliah_id': x.mata_kuliah_id.id,

'hari': x.hari,

'ruang_id': x.ruang_id.id,

'absen': x.absen,

'tugas': x.tugas,

'formatif': x.formatif,

'uts': x.uts,

'uas': x.uas,

'huruf':x.huruf,

'angka':x.angka,

}))


_columns={

'dosen_id':fields.many2one('ta.dosen','Dosen'),

'name':fields.selection([('ganjil','Ganjil'),

('genap','Genap')],string='Semester Periode'),

'semester_kurikulum':fields.selection([('1','1'),('2','2'),

('3','3'),('4','4'),

('5','5'),('6','6')],string='Semester Kurikulum'),

'thn_akademik':fields.many2one('ta.periode.akademik',string='Thn Akademik'),

'thn_kurikulum_id':fields.many2one('ta.kurikulum',string='Tahun Kurikulum'),

'input_nilai_lines':fields.one2many('ta.input.nilai.line','input_nilai_id','Input Nilai'),

}


def create(self, cr, uid, vals, context=None):

res = super(ta_input_nilai_dosen, self).create(cr, uid, vals, context=context)

self.input_nilai(cr, uid, res, [res])

return res


and this code "ta.nilai"


class ta_nilai(osv.osv):

_name='ta.nilai'

_rec_name='name'

_columns={

'dosen_id':fields.many2one('ta.dosen','Dosen'),

'name':fields.selection([('ganjil','Ganjil'),

('genap','Genap')],string='Semester Periode'),

'semester_kurikulum':fields.selection([('1','1'),('2','2'),

('3','3'),('4','4'),

('5','5'),('6','6')],string='Semester Kurikulum'),

'thn_akademik':fields.many2one('ta.periode.akademik',string='Thn Akademik'),

'thn_kurikulum_id':fields.many2one('ta.kurikulum',string='Tahun Kurikulum'),

'nilai_line':fields.one2many('ta.nilai.line','nilai_id','Nilai')

}


    but data from "ta.input.nilai.line" not move to "ta.nilai.line"

i hope anybody can help me ,

i am sorry for bad my english languange,

thanks



Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 4/19/15, 11:43 PM
Seen: 597 times
Last updated: 4/19/15, 11:43 PM