'Override superclass method to map the master record to the
corresponding pr_person record (only required when called
from the form handler)
@param resource: the resource the record belongs to
@param record_id: the record ID
@return: the value for the input field that corresponds
to the specified record.'

def extract(self, resource, record_id):

    if (resource.tablename == 'hrm_human_resource'):
        s3db = current.s3db
        table = resource.table
        query = (table._id == record_id)
        master = current.db(query).select(table.person_id, limitby=(0, 1)).first()
        if (not master):
            raise KeyError('Record    not    found')
        record_id = master.person_id
        resource = s3db.resource('pr_person', components=[self.selector], id=record_id)
    return super(S3SQLHRPersonLink, self).extract(resource, record_id)
