'Update the realm entity of the organisation after removing an
organisation type (otherwise type-dependent realm rules won\'t
take effect)
@param form: the Row'

@staticmethod
def org_organisation_organisation_type_ondelete(row):

    try:
        record_id = row.id
    except AttributeError:
        return
    table = current.s3db.org_organisation_organisation_type
    row = current.db((table.id == record_id)).select(table.deleted_fk, limitby=(0, 1)).first()
    if (row and row.deleted_fk):
        try:
            deleted_fk = json.loads(row.deleted_fk)
        except ValueError:
            return
        organisation_id = deleted_fk.get('organisation_id')
        current.auth.set_realm_entity('org_organisation', organisation_id, force_update=True)
