'Enables/Disables optional fields according to a user\'s Organisation
- must specify either field or tablename/fieldname
(e.g. for virtual fields)'

def set_org_dependent_field(self, tablename=None, fieldname=None, enable_field=True):

    enabled = False
    dependent_fields = self.org.get('dependent_fields')
    if dependent_fields:
        org_name_list = dependent_fields.get(('%s.%s' % (tablename, fieldname)), None)
        if org_name_list:
            auth = current.auth
            if auth.s3_has_role(auth.get_system_roles().ADMIN):
                enabled = True
            else:
                root_org = auth.root_org_name()
                enabled = (root_org in org_name_list)
        else:
            enabled = True
    if enable_field:
        field = current.s3db[tablename][fieldname]
        field.readable = enabled
        field.writable = enabled
    return enabled
