'Return a valid xml_id for the record ``self``.'

def __export_xml_id(self):

    if (not self._is_an_ordinary_table()):
        raise Exception(('You    can    not    export    the    column    ID    of    model    %s,    because    the    table    %s    is    not    an    ordinary    table.' % (self._name, self._table)))
    ir_model_data = self.sudo().env['ir.model.data']
    data = ir_model_data.search([('model', '=', self._name), ('res_id', '=', self.id)])
    if data:
        if data[0].module:
            return ('%s.%s' % (data[0].module, data[0].name))
        else:
            return data[0].name
    else:
        postfix = 0
        name = ('%s_%s' % (self._table, self.id))
        while ir_model_data.search([('module', '=', '__export__'), ('name', '=', name)]):
            postfix += 1
            name = ('%s_%s_%s' % (self._table, self.id, postfix))
        ir_model_data.create({'model': self._name, 'res_id': self.id, 'module': '__export__', 'name': name})
        return ('__export__.' + name)
