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
    • Validations
    • 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
    • Épicerie
    • 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
    • Bricoleur
    • 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
    • Devenez 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

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Comptabilité
  • Inventaire
  • PoS
  • Projet
  • MRP
All apps
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

Problem with @api.model_create_multi on res.partner in odoo.sh, Odoo 16

S'inscrire

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

Cette question a été signalée
ORModoo16features
2 Réponses
4076 Vues
Avatar
ABDOU NASSER

As we all know, @api.model_create_multi allows us to insert or create values at once from a list, instead of doing it one by one. As example, if we have:

values = [{...}, {...}]

Doing

record.create(values)

is better than

for val in values:
    record.create(val)

The other thing to take into consideration is that regarding the res.partner model, everywhere there is a create() method, it has the decorator @api.model_create_multi which allows us to pass a list of values to res.partner when we want to create records.

Now, the problem we are facing (only in odoo.sh) is that we are creating some partners from some data we take to another system via a connector. Those data are coming fine, and we have a list of all required data we are passing to the create().

If we have 5 contacts, the action we are calling will create only one contact and then one other, and then another one, etc... but in our local it's working fine, all the 5 contacts are created at once.

Here is the code: https://gist.github.com/nasser-bloopark/dfe8c5b42d6f2bd84ae37aafc0e4f468

After some investigations, we found that the issue is in the line destination_model.create(create_values).

Note that we didn't override the method create() anywhere, and we are using the OCA module partner_firstname as dependency to this custom module.

So, my question is: is there something I missed here or some other tips we can use from the ORM to fix this issue ?

0
Avatar
Ignorer
Avatar
Stanislas Gueniffey (stgu)
Meilleure réponse

Hello Abdou Nasser,
May I recommend to open a ticket ?
The code you provide seems unrelated to the issue you describe. As you expect since you say the problem only occurs in odoo.sh. Therefore it's hard to debug something like this.

Generally speaking, I would expect records to be created one by one if there's inter-dependency among the created records or if a sequence is used in their creation.

Also generally speaking, your odoo.sh instance may have less resources, for example less available threads.

I see the module partner_firstname does override the create() method, but if it works properly in local that shouldn't be the issue.

0
Avatar
Ignorer
ABDOU NASSER
Auteur

Thank you Stanislas Gueniffey
I have contacted the odoo support and waiting
For now, i have put the create() in the for loop

Avatar
Pedro M. Baeza
Meilleure réponse

Check if any of the code you have in the instance is overwriting the create method of res.partner and mangling the super calling.

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
Publications associées Réponses Vues Activité
DeprecationWarning: The longpolling-port is a deprecated alias to the gevent-port option, please use the latter Résolu
odoo16features
Avatar
Avatar
Avatar
Avatar
Avatar
5
sept. 25
25498
How to Add wizard under print button inside the form view.
odoo16features
Avatar
Avatar
Avatar
Avatar
3
août 25
3884
How to add @api.onchange in _get_view() method odoo 16
odoo16features
Avatar
Avatar
1
mai 25
3783
get all partners which are internal users or portal users odoo16
odoo16features
Avatar
Avatar
1
avr. 25
4623
How to add decoration color green with bold to a record with a single conditon
odoo16features
Avatar
Avatar
1
avr. 25
5442
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
  • Devenez 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 ภาษาไทย 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