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

odoo9: How to make a loop in web report

By
Drees Far
on 5/16/16, 9:59 AM 203 views

Hello everybody!!!!!!

I am creating a new report to print in odoo9.

In fact, i want to print the payslip for a group of employees.

The problem is that the loop that i have maid is browsing the data of the employees and showing them in the same time.

which means that in the payslip of the first employee i found all the data of the other employees.

SO that, i  want to correct the loop. 

here is the function:

def get_payslip_lines(self, obj):

payslip_line = self.pool.get('hr.payslip.line')

res = []

ids = []

for id in range(len(obj)):

if obj[id].appears_on_payslip is True:

ids.append(obj[id].id)

if ids:

res = payslip_line.browse(self.cr, self.uid, ids)

return res

And the xml:

           <tr t-foreach="get_payslip_lines(o.line_ids)" t-as="p">


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: 5/16/16, 9:59 AM
Seen: 203 times
Last updated: 5/16/16, 9:59 AM