When I run this query on Postgresql :
SELECT code, total FROM hr_payslip_line WHERE slip_id=1
I get :
____________________________
| code | total |
__________________________
| BASE | 57000.00 |
____________________________
And when I run this code :
sql = '''
SELECT code, total FROM hr_payslip_line WHERE slip_id=%s
''' % (slip.id)
cr.execute(sql)
for code, total in cr.fetchall() :
raise osv.except_osv(_('Info'),_('code : %s\nTotal : %s\nSlip ID : %s\nSQL : %s ' % (code, total,slip.id,sql)))
I've used the raise to catch the error I get this dialog :
Info
code : BASE
Total : None
Slip ID : 1
SQL : SELECT code, total FROM hr_payslip_line WHERE slip_id=1
The problem is that the total return None and not 57000.00 More informations : 1. I've one slip 2. I've one line 3. the field total is a stored function
Can you add
slip.id
to your debug message and post the result?The debug is updated, I have used also res = cr.fetchall() and setting res[0] get 'BASE' and res[1] get False