Converted account report old to new api

Hello

I have converted postgres report old to new API.

thanks.
First of all its gives error: global name 'ids' not defined.
Second, 'self' already contains browse record(s).