'On-delete routine for HR records'

@staticmethod
def hrm_human_resource_ondelete(row):

    db = current.db
    htable = db.hrm_human_resource
    if (row and ('id' in row)):
        record = db((htable.id == row.id)).select(htable.deleted, htable.deleted_fk, htable.person_id, limitby=(0, 1)).first()
    else:
        return
    if record.deleted:
        try:
            fk = json.loads(record.deleted_fk)
            person_id = fk.get('person_id', None)
        except:
            return
        if person_id:
            current.s3db.pr_update_affiliations(htable, record)
