'Return default names for the table and columns of a custom many2many field.'

@api.model
def _custom_many2many_names(self, model_name, comodel_name):

    rel1 = self.env[model_name]._table
    rel2 = self.env[comodel_name]._table
    table = ('x_%s_%s_rel' % tuple(sorted([rel1, rel2])))
    if (rel1 == rel2):
        return (table, 'id1', 'id2')
    else:
        return (table, ('%s_id' % rel1), ('%s_id' % rel2))
