Fix issue 1966: Avoid inserting duplicate archive records with record versioning #568

same patch from https://github.com/web2py/web2py/pull/568