7 fix 1331394

Moved from https://code.launchpad.net/~agilebg/purchase-report/7_fix_1331394/+merge/223799
It fixes https://bugs.launchpad.net/purchase-report/+bug/1331394