I am creating a new report with RML in OpenERP. Here is my Python function:
def get_employee_lines(self, context=None):
print ('--------------------MOMO----------------------')
res_list=[]
payslip_line = self.pool.get('hr.payslip')
print payslip_line
obj_ids = payslip_line.search(self.cr, self.uid, [])
print obj_ids
for res in payslip_line.read(self.cr, self.uid, obj_ids, ['id', 'employee_id'], context=False):
print res['employee_id'][1]
obj = {}
obj['name'] = res['employee_id'][1]
res_list.append(obj)
return res_list
and my RML:
<tr>
<td>
<para style="P9">NOM EMPLOYÉ</para>
</td>
<td>
<para style="P7">[[ repeatIn(get_employee_lines(), 'o') ]]</para>
<para style="P7">[[ o['name'] ]]</para>
</td>
</tr>
I want to put each employee in a new cell which means td.
Finally i have found it. Here is the answer. First, i had to change the version of my OpenOffice which is v4.1.X. Second, i used [[ repeatIn(get_employee_lines(example.company_id,example.date_start,example.date_end), 'o', 'td') ]] which Loop on every line and make a new table cell for each line.
So here is the right answer:
<tr>
<td>
<para style="P8">NOM EMPLOYÉ</para>
</td>
<td>
<para style="P7">[[ repeatIn(get_employee_lines(example.company_id,example.date_start,example.d ate_end), 'o', 'td') ]]</para>
<para style="P7">[[ o['name'] ]]</para>
</td>
</tr>*
Best Regards.