Skip to Content
Menu
This question has been flagged
1 Reply
2817 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؟؟؟؟؟؟؟؟؟

Avatar
Discard
Best Answer

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 []

Avatar
Discard
Author

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

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