When press the button need list all employee and some data of this.
I create an module class prepare_adv() and other adv(), the second are as One2many fields in the first.
in prepare_adv have a button that onclick need list in adv() all of employees and some datas of this.
This is the function of button that need save the recors in adv() and them view in prepare_adv():
def onclick(self, cr, uid, ids, context=None):
employee_obj = self.pool.get('hr.employee')
contract_obj = self.pool.get('hr.contract')
res = {}
for advances in self.browse(cr,uid,ids,context=context):
res[advances.id] = {
'id_intern': 0,
'employee_name': 0,
'wage_base': 0,
}
for empl in employee_obj.browse(cr,uid,ids,context=context):
res[advances.id]['wage_base'] = contract_obj.browse(cr,uid,empl.id).wage
res[advances.id]['id_intern'] = empl.id_inter
res[advances.id]['employee_name'] = empl.id
lines = [(0,0,res)]
self.write(cr, uid, [advances.id], {'advancs': lines,}, context=context)
return True
This no save nothing of records. What i do wrong ?
Some can help me please...