Se rendre au contenu
Odoo Menu
  • Se connecter
  • Essai gratuit
  • Applications
    Finance
    • Comptabilité
    • Facturation
    • Notes de frais
    • Feuilles de calcul (BI)
    • Documents
    • Signature
    Ventes
    • CRM
    • Ventes
    • PdV Boutique
    • PdV Restaurant
    • Abonnements
    • Location
    Sites web
    • Site Web
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Chaîne d'approvisionnement
    • Inventaire
    • Fabrication
    • PLM
    • Achats
    • Maintenance
    • Qualité
    Ressources Humaines
    • Employés
    • Recrutement
    • Congés
    • Évaluations
    • Recommandations
    • Parc automobile
    Marketing
    • Marketing Social
    • E-mail Marketing
    • SMS Marketing
    • Événements
    • Marketing Automation
    • Sondages
    Services
    • Projet
    • Feuilles de temps
    • Services sur Site
    • Assistance
    • Planification
    • Rendez-vous
    Productivité
    • Discussion
    • Intelligence artificielle
    • Internet des Objets
    • VoIP
    • Connaissances
    • WhatsApp
    Applications tierces Odoo Studio Plateforme Cloud d'Odoo
  • Industries
    Commerce de détail
    • Librairie
    • Magasin de vêtements
    • Magasin de meubles
    • Supermarché
    • Quincaillerie
    • Magasin de jouets
    Restauration & Hôtellerie
    • Bar et Pub
    • Restaurant
    • Fast-food
    • Maison d’hôtes
    • Distributeur de boissons
    • Hôtel
    Immobilier
    • Agence immobilière
    • Cabinet d'architecture
    • Construction
    • Gestion immobilière
    • Jardinage
    • Association de copropriétaires
    Consultance
    • Cabinet d'expertise comptable
    • Partenaire Odoo
    • Agence Marketing
    • Cabinet d'avocats
    • Aquisition de talents
    • Audit & Certification
    Fabrication
    • Textile
    • Métal
    • Meubles
    • Alimentation
    • Brasserie
    • Cadeaux d'entreprise
    Santé & Fitness
    • Club de sports
    • Opticien
    • Salle de fitness
    • Praticiens bien-être
    • Pharmacie
    • Salon de coiffure
    Commerce
    • Homme à tout faire
    • Matériel informatique & support
    • Systèmes photovoltaïques
    • Cordonnier
    • Services de nettoyage
    • Services CVC
    Autres
    • Organisation à but non lucratif
    • Agence environnementale
    • Location de panneaux d'affichage
    • Photographie
    • Leasing de vélos
    • Revendeur de logiciel
    Parcourir toutes les industries
  • Communauté
    Apprenez
    • Tutoriels
    • Documentation
    • Certifications
    • Formation
    • Blog
    • Podcast
    Renforcer l'éducation
    • Programme éducatif
    • Business Game Scale-Up!
    • Rendez-nous visite
    Obtenir le logiciel
    • Téléchargement
    • Comparez les éditions
    • Versions
    Collaborer
    • Github
    • Forum
    • Événements
    • Traductions
    • Devenir partenaire
    • Services pour partenaires
    • Enregistrer votre cabinet comptable
    Nos Services
    • Trouver un partenaire
    • Trouver un comptable
    • Rencontrer un conseiller
    • Services de mise en œuvre
    • Références clients
    • Assistance
    • Mises à niveau
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Obtenir une démonstration
  • Tarification
  • Aide
Vous devez être inscrit pour interagir avec la communauté.
Toutes les publications Personnes Badges
Étiquettes (Voir toutl)
odoo accounting v14 pos v15
À propos de ce forum
Vous devez être inscrit pour interagir avec la communauté.
Toutes les publications Personnes Badges
Étiquettes (Voir toutl)
odoo accounting v14 pos v15
À propos de ce forum
Aide

[ERROR RESTORE Odoo 18] ValueError: Expected singleton: website()

S'inscrire

Recevez une notification lorsqu'il y a de l'activité sur ce poste

Cette question a été signalée
2 Réponses
533 Vues
Avatar
Vo Nguyen Phuc Ngan
I backed up a zipped database from another computer and sent it to mine. When I tried to restore the database, after about 5 minutes it reported that a database with the same name already existed. I tried refreshing (F5) and saw that the database had been restored. When I clicked on it, I got an error:

File "d:\study\python_code\odoo_18\odoo-18.0\addons\website\models\models.py", line 6271, in ensure_one
raise ValueError("Expected singleton: %s" % self)

ValueError: Expected singleton: website()

-1
Avatar
Ignorer
Codesphere Tech

Hello,
It is not restored completely.. Remove that existing database and try to restore again and also check logs while restoring the database.

Avatar
Jainesh Shah(Aktiv Software)
Meilleure réponse

Hi Vo Nguyen Phuc Ngan,


This looks like a website module configuration issue in Odoo 18 — the restored database has a conflict with the website records. 

What's causing this error?

When you restored the database, Odoo found multiple website records where it expected only one (a "singleton"). This commonly happens when:

  • The source and destination databases had different website configurations
  • The restore process duplicated website records


How to fix it
Option 1: Fix via Odoo Debug Mode

  1. Go to Settings → activate Developer Mode (add ?debug=1 to URL)
  2. Navigate to Website → Configuration → Websites
  3. Delete or archive any duplicate website entries, keeping only one

Option 2: Fix via PostgreSQL directly

 sql

-- Connect to your database
psql -d YOUR_DATABASE_NAME

-- Check website records
SELECT id, name, domain, active FROM website;

-- If duplicates exist, deactivate all but the first
UPDATE website SET active = false WHERE id NOT IN (
   SELECT MIN(id) FROM website
);

 

Option 3: Fix via Odoo Shell (Recommended)


Open a terminal in your Odoo directory and run:

python odoo-bin shell -d YOUR_DATABASE_NAME 

Then in the shell:

 python

# Check how many website records exist
websites = env['website'].search([])
print(len(websites), websites)

# If there are duplicates, deactivate extras (keep only the first one)
for w in websites[1:]:
   w.write({'active': False})

env.cr.commit()

 

After fixing

Restart your Odoo server 

 bash

# Stop the server, then: python odoo-bin -d YOUR_DATABASE_NAME -u website 


Quick question 

When you run the shell command and check len(websites), how many records do you see? That'll confirm whether duplicates are the root cause.

 

If you have any questions, feel free to reach out.

Hope this helps!

 

Thanks and Regards,

Email: odoo@aktivsoftware.com

0
Avatar
Ignorer
Avatar
Sangar
Meilleure réponse

Hi Vo Nguyen Phuc Ngan,

The error you’re seeing:

ValueError: Expected singleton: website()

happens because Odoo is trying to process multiple records where it expects only one. In this case, the website model expects a single website record, but after restoring the database, there might be duplicate website records or an empty record set.

Why it happens after restoring a database:

Restoring the database may have created duplicate entries in website or related models.

Odoo’s website code often uses .ensure_one() to make sure only one record is being processed.

If it finds zero or more than one record, it throws this error.

How to fix it:

Step 1: Check the website records

Activate Developer Mode in Odoo.

Go to Website → Configuration → Websites.

Check if there are multiple websites listed or an empty one.

Step 2: Keep only one active website

Delete duplicates or empty websites.

Make sure exactly one website is active and properly configured.

Step 3: Check website_id in other models

Sometimes models like ir.config_parameter or website.page may reference a deleted or duplicate website.

You can check in Settings → Technical → Database Structure → Models → website if needed.

Step 4: Restart Odoo

After cleaning duplicates, restart the Odoo server.

Refresh the page and open your restored database.

Optional: If you are comfortable with PostgreSQL, you can verify duplicates directly:

SELECT id, name FROM website;

Keep only the correct one

Make a backup before deleting anything!

Hope it will solve your issue.

0
Avatar
Ignorer
Vous appréciez la discussion ? Ne vous contentez pas de lire, rejoignez-nous !

Créez un compte dès aujourd'hui pour profiter de fonctionnalités exclusives et échanger avec notre formidable communauté !

S'inscrire
Communauté
  • Tutoriels
  • Documentation
  • Forum
Open Source
  • Téléchargement
  • Github
  • Runbot
  • Traductions
Services
  • Hébergement Odoo.sh
  • Assistance
  • Migration
  • Développements personnalisés
  • Éducation
  • Trouver un comptable
  • Trouver un partenaire
  • Devenir partenaire
À propos
  • Notre société
  • Actifs de la marque
  • Contactez-nous
  • Emplois
  • Événements
  • Podcast
  • Blog
  • Clients
  • Informations légales • Confidentialité
  • Sécurité.
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk Slovenščina Español (América Latina) Español Svenska ภาษาไทย Türkçe українська Tiếng Việt

Odoo est une suite d'applications open source couvrant tous les besoins de votre entreprise : CRM, eCommerce, Comptabilité, Inventaire, Point de Vente, Gestion de Projet, etc.

Le positionnement unique d'Odoo est d'être à la fois très facile à utiliser et totalement intégré.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now