Odoo Help


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.


How to use get_lines in creating iteration for reports in Odoo

Drees Far
on 8/21/15, 8:13 AM 793 views

hello friends:

I want to create a new report in my OpenERP.


class journal_paie(report_sxw.rml_parse):

  def __init__(self, cr, uid, name, context):
        super(journal_paie, self).__init__(cr, uid, name, context)
        'get_lines': self.get_lines,

    def get_lines(self,cr,uid, context=None):
        if not context:
            context = None
    ret = []

    print ('--------------------Test Me-------------------')
        obj = self.pool.get('hr.employee')
        obj_ids = obj.search(cr, uid, [])
        res = obj.read(cr, uid, obj_ids, ['id', 'name_related','momo_matricule'], context)
    for r in res :
        if r['name_related'] != 'Administrator' :
            line_data = dict()
            line_data['name']= r['name_related']
            print "------------ journal paie get_lines "
            print r['name_related']
        return ret


                      'addons/test_example/report/journal_paie.mako', header="False",


<%lines = get_lines(payslip,cr,uid,'gross')


%for line in lines:

<tr style='height:8.5pt'>

<td width=13 style='width:9.55pt;border:none;border-right:solid windowtext 1.0pt;

background:#DDEBF7;padding:0cm 3.5pt 0cm 3.5pt;height:8.5pt'>

<p class=MsoNormal style='margin-bottom:0cm;margin-bottom:.0001pt;line-height:

normal'><span style='font-size:8.0pt;font-family:"Arial","sans-serif";

color:black'> </span></p>





How can i call a function in my mako file.

Because i want it to show me all the employees in my company.

Please help.


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)


Asked: 8/21/15, 8:13 AM
Seen: 793 times
Last updated: 8/21/15, 8:13 AM