'Adds missing table select and join clause(s) to ``query`` for reaching
the field coming from an \'_inherits\' parent table (no duplicates).
:param alias: name of the initial SQL alias
:param fname: name of inherited field to reach
:param query: query object on which the JOIN should be added
:return: qualified name of field, to be used in SELECT clause'

@api.model
def _inherits_join_calc(self, alias, fname, query, implicit=True, outer=False):

    (model, field) = (self, self._fields[fname])
    while field.inherited:
        parent_model = self.env[field.related_field.model_name]
        parent_fname = field.related[0]
        (parent_alias, _) = query.add_join((alias, parent_model._table, parent_fname, 'id', parent_fname), implicit=implicit, outer=outer)
        (model, alias, field) = (parent_model, parent_alias, field.related_field)
    if (field.translate is True):
        return model._generate_translated_field(alias, fname, query)
    else:
        return ('"%s"."%s"' % (alias, fname))
