Odoo Help

0

in rml report: when output function is null,i has error?

By
sama
on 1/30/16, 1:18 AM 864 views

    def _function(self, fromDate, toDate):

sql = "select * from \

(select (sum(aml.credit)-sum(aml.debit)) as s,rp.name \

from account_move_line as aml \

join res_partner as rp on aml.partner_id=rp.id \

where aml.account_id=200 and aml.date BETWEEN \'%s\' AND \'%s\' \

group by rp.name order by s desc) as f " %(fromDate, toDate)

self.cr.execute(sql)

return self.cr.fetchall()


report.rml:

    <blockTable colWidths="181.0,216.0" style="Table36">

<tr>

<td>

<para style="P8">[[ repeatIn(function(data['form']['fromDate'], data['form']['toDate']),'ol') ]]</para>

<para style="P9">[[ol[0] ]]</para>

</td>

<td>

<para style="P9">[[ol[1] ]]</para>

</td>

</tr>

</blockTable> 






How do I fix this error code؟؟؟؟؟؟؟؟؟

0
Axel Mendoza
On 1/30/16, 6:42 AM

You need to check if you have something to return and if not then you could return an empty list to do the trick like:

return self.cr.fetchall() or []

thanks,but i has error: TypeError: cannot concatenate 'str' and 'tuple' objects please help me.....

sama
on 1/30/16, 7:24 AM

It's a good practice to post all your error log to get helped

Axel Mendoza
on 1/30/16, 1:47 PM

About This Community

This platform 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.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)

Stats

Asked: 1/30/16, 1:18 AM
Seen: 864 times
Last updated: 1/30/16, 6:42 AM