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
    Food & Hospitality
    • 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
    • Brewery
    • Cadeaux d'entreprise
    Santé & Fitness
    • Club de sports
    • Opticien
    • Salle de fitness
    • Praticiens bien-être
    • Pharmacie
    • Salon de coiffure
    Trades
    • Bricoleur
    • Matériel informatique et 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
    Browse all 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 for Partners
    • 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

ver.14: error while testing Python XML-RPC client

S'inscrire

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

Cette question a été signalée
v14python3.6xml-rpc
1 Répondre
7266 Vues
Avatar
SmithJohn45

error while testing Python xml-rpc client, data for res.partner showing successfully, but for products it is showing error, below are my python file and output on terminal. please help to resolve what mistake i made here.

Python file:

url = 'http://192.168.18.71:8069'
db = 'odb'
username = 'odoouser@myhost.com'
password = 'admin'
import xmlrpc.client

common = xmlrpc.client.ServerProxy('{}/xmlrpc/2/common'.format(url))
uid = common.authenticate(db, username, password, {})
version = common.version()
print("details...", version)
print("User ID = ", uid)
models = xmlrpc.client.ServerProxy('{}/xmlrpc/2/object'.format(url))
#
# test to get res.partner data
#
partners = models.execute_kw(db, uid, password, 'res.partner', 'search', [[['is_company', '=', False]]], {'offset': 10, 'limit': 10})
partners_rec = models.execute_kw(db, uid, password, 'res.partner', 'read', [partners], {'fields': ['id', 'name']})
print("partners data start here....")
for partner in partners_rec:
    print(partner)
print("partner data end here....")
print(" ")
#
# test to get product.template data
#
products = models.execute_kw(db, uid, password, 'product.template', {'offset': 10, 'limit': 10})
products_rec = models.execute_kw(db, uid, password, 'product.template', 'read', [products], {'fields': ['id', 'name']})
print("products data start here....")
for prod in products_rec:
    print(prod)
print("products data end here....")
print(" ")

Output:

details... {'server_version': '14.0', 'server_version_info': [14, 0, 0, 'final', 0, ''], 'server_serie': '14.0', 'protocol_version': 1}
User ID =  2
partners data start here....
{'id': 20, 'name': 'Edwin Hansen'}
{'id': 22, 'name': 'Jesse Brown'}
{'id': 31, 'name': 'Oscar Morgan'}
{'id': 23, 'name': 'Soham Palmer'}
{'id': 54, 'name': 'JohnSmith'}
{'id': 34, 'name': 'Lorraine Douglas'}
{'id': 50, 'name': 'Maqsood Sb.'}
{'id': 42, 'name': 'Mark Demo'}
{'id': 41, 'name': 'Mitchell Admin'}
{'id': 44, 'name': 'Jeff Lawson'}
partner data end here....
 
Traceback (most recent call last):
  File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/odoo/odoo-dev/odoo/odoo_xmlrpc.py", line 28, in <module>
    products = models.execute_kw(db, uid, password, 'product.template', {'offset': 10, 'limit': 10})
  File "/usr/lib/python3.6/xmlrpc/client.py", line 1112, in __call__
    return self.__send(self.__name, args)
  File "/usr/lib/python3.6/xmlrpc/client.py", line 1452, in __request
    verbose=self.__verbose
  File "/usr/lib/python3.6/xmlrpc/client.py", line 1154, in request
    return self.single_request(host, handler, request_body, verbose)
  File "/usr/lib/python3.6/xmlrpc/client.py", line 1170, in single_request
    return self.parse_response(resp)
  File "/usr/lib/python3.6/xmlrpc/client.py", line 1342, in parse_response
    return u.close()
  File "/usr/lib/python3.6/xmlrpc/client.py", line 656, in close
    raise Fault(**self._stack[0])
xmlrpc.client.Fault: <Fault 1: 'Traceback (most recent call last):\n  File "/home/odoo/odoo-dev/odoo/odoo/addons/base/controllers/rpc.py", line 69, in xmlrpc_2\n    response = self._xmlrpc(service)\n  File "/home/odoo/odoo-dev/odoo/odoo/addons/base/controllers/rpc.py", line 49, in _xmlrpc\n    result = dispatch_rpc(service, method, params)\n  File "/home/odoo/odoo-dev/odoo/odoo/http.py", line 140, in dispatch_rpc\n    result = dispatch(method, params)\n  File "/home/odoo/odoo-dev/odoo/odoo/service/model.py", line 41, in dispatch\n    res = fn(db, uid, *params)\nTypeError: execute_kw() missing 1 required positional argument: \'args\'\n'>


0
Avatar
Ignorer
Avatar
SmithJohn45
Auteur Meilleure réponse

problem resolved... modified line below --  added 'search', [[]]  --: 

products = models.execute_kw(db, uid, password, 'product.template', 'search', [[]])
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é
Odoo14 alternative for Automated Translations through Gengo API module
v14
Avatar
Avatar
Avatar
Avatar
3
sept. 25
3660
Odoo Community v14 Slow on High-End Servers, Fast on i5/i7 PCs
v14
Avatar
0
août 25
1092
How to Managing Birthdate and Age in Odoo
v14
Avatar
Avatar
1
août 25
3448
Update Initial Stock of Product using XMLRPC API [Odoo14] Résolu
v14
Avatar
Avatar
Avatar
2
juil. 25
9024
"AttributeError: 'NoneType' object has no attribute 'CompileError'" configuring document Layout - Odoo 14
v14
Avatar
Avatar
Avatar
2
juil. 25
5359
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