Modify _last_history function

The old method, using a many2one and _read_flat(), returned the wrong date if there were more than 1000 history lines.