Here is my python function:
def get_lines(self, payslip,cr,uid, context=None):
ret = []
obj = self.pool.get('hr.employee')
obj_ids = obj.search(cr, uid, [])
res = obj.read(cr, uid, obj_ids, ['id'], context)
for r in res :
if r['name_related'] != 'Administrator' :
line_data = dict()
line_data['name']= r['name_related']
print r['name_related']
ret.append(line_data)
return ret
And in my mako:
%for obj in objects:
<% lines = obj.get_lines(payslip) %>
%for line in lines:
<tr style='height:20.65pt'>
<td width=31.9 style='width:31.9pt;border:none;border-bottom:solid windowtext 1.0pt;
background:#FCE4D6;padding:0cm 3.5pt 0cm 3.5pt;height:14.65pt'>
<p class=MsoNormal align=center style='margin-bottom:0cm;margin-bottom:.0001pt;
text-align:center;line-height:normal'><b><span style='font-size:8.0pt;
font-family:"Arial","sans-serif";color:black'>Nom Employé</span></b></p>
</td>
<td width=31.9 style='width:31.9pt;border:none;border-bottom:solid windowtext 1.0pt;
background:#FCE4D6;padding:0cm 3.5pt 0cm 3.5pt;height:14.65pt'>
<p class=MsoNormal align=center style='margin-bottom:0cm;margin-bottom:.0001pt;
text-align:center;line-height:normal'><b><span style='font-size:8.0pt;
font-family:"Arial","sans-serif";color:black'> ${line}</span></b></p>
</td>
</tr>
%endfor
%endfor
And i get this:
AttributeError: 'Undefined' object has no attribute 'get_lines'