'Utility function that makes the query for field terms.'

@api.model
def _get_terms_query(self, field, records):

    query = '    SELECT    *    FROM    ir_translation\n                                                                                WHERE    lang=%s    AND    type=%s    AND    name=%s    AND    res_id    IN    %s    '
    name = ('%s,%s' % (field.model_name, field.name))
    params = (records.env.lang, 'model', name, tuple(records.ids))
    return (query, params)
