Skip to Content
Odoo Menu
  • Log ind
  • Prøv gratis
  • Apps
    Økonomi
    • Bogføring
    • Fakturering
    • Udgifter
    • Regneark (BI)
    • Dokumenter
    • e-Signatur
    Salg
    • CRM
    • Salg
    • POS Butik
    • POS Restaurant
    • Abonnementer
    • Udlejning
    Hjemmeside
    • Hjemmesidebygger
    • e-Handel
    • Blog
    • Forum
    • LiveChat
    • e-Læring
    Forsyningskæde
    • Lagerbeholdning
    • Produktion
    • PLM
    • Indkøb
    • Vedligeholdelse
    • Kvalitet
    HR
    • Medarbejdere
    • Rekruttering
    • Fravær
    • Medarbejdersamtaler
    • Anbefalinger
    • Flåde
    Marketing
    • Markedsføring på sociale medier
    • E-mailmarketing
    • SMS-marketing
    • Arrangementer
    • Automatiseret marketing
    • Spørgeundersøgelser
    Tjenester
    • Projekt
    • Timesedler
    • Udkørende Service
    • Kundeservice
    • Planlægning
    • Aftaler
    Produktivitet
    • Dialog
    • Godkendelser
    • IoT
    • VoIP
    • Vidensdeling
    • WhatsApp
    Tredjepartsapps Odoo Studio Odoo Cloud-platform
  • Brancher
    Detailhandel
    • Boghandel
    • Tøjforretning
    • Møbelforretning
    • Dagligvarebutik
    • Byggemarked
    • Legetøjsforretning
    Mad og værtsskab
    • Bar og pub
    • Restaurant
    • Fastfood
    • Gæstehus
    • Drikkevareforhandler
    • Hotel
    Ejendom
    • Ejendomsmægler
    • Arkitektfirma
    • Byggeri
    • Ejendomsadministration
    • Havearbejde
    • Boligejerforening
    Rådgivning
    • Regnskabsfirma
    • Odoo-partner
    • Marketingbureau
    • Advokatfirma
    • Rekruttering
    • Audit & certificering
    Produktion
    • Tekstil
    • Metal
    • Møbler
    • Fødevareproduktion
    • Bryggeri
    • Firmagave
    Heldbred & Fitness
    • Sportsklub
    • Optiker
    • Fitnesscenter
    • Kosmetolog
    • Apotek
    • Frisør
    Håndværk
    • Handyman
    • IT-hardware og support
    • Solenergisystemer
    • Skomager
    • Rengøringsservicer
    • VVS- og ventilationsservice
    Andet
    • Nonprofitorganisation
    • Miljøagentur
    • Udlejning af billboards
    • Fotografi
    • Cykeludlejning
    • Softwareforhandler
    Gennemse alle brancher
  • Community
    Få mere at vide
    • Tutorials
    • Dokumentation
    • Certificeringer
    • Oplæring
    • Blog
    • Podcast
    Bliv klogere
    • Udannelselsesprogram
    • Scale Up!-virksomhedsspillet
    • Besøg Odoo
    Få softwaren
    • Download
    • Sammenlign versioner
    • Udgaver
    Samarbejde
    • Github
    • Forum
    • Arrangementer
    • Oversættelser
    • Bliv partner
    • Tjenester til partnere
    • Registrér dit regnskabsfirma
    Modtag tjenester
    • Find en partner
    • Find en bogholder
    • Kontakt en rådgiver
    • Implementeringstjenester
    • Kundereferencer
    • Support
    • Opgraderinger
    Github Youtube Twitter LinkedIn Instagram Facebook Spotify
    +1 (650) 691-3277
    Få en demo
  • Prissætning
  • Hjælp

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

  • CRM
  • e-Commerce
  • Bogføring
  • Lager
  • PoS
  • Projekt
  • MRP
All apps
Du skal være registreret for at interagere med fællesskabet.
All Posts People Emblemer
Tags (View all)
odoo accounting v14 pos v15
Om dette forum
Du skal være registreret for at interagere med fællesskabet.
All Posts People Emblemer
Tags (View all)
odoo accounting v14 pos v15
Om dette forum
Hjælp

API error on odoo 14

Tilmeld

Få besked, når der er aktivitet på dette indlæg

Dette spørgsmål er blevet anmeldt
apipython3XML-RPCv14
2 Besvarelser
3985 Visninger
Avatar
Juan

Hi everyone!
I developed the code below to read reports and data from odoo: 

import os

import xmlrpc.client

url = os.getenv('url')

db = os.getenv('db')

username = os.getenv('user')

password = os.getenv('password')

common = xmlrpc.client.ServerProxy('{}/xmlrpc/2/common'.format(url))

uid = common.authenticate(db, username, password,{})

models = xmlrpc.client.ServerProxy('{}/xmlrpc/2/object'.format(url))models.execute_kw(db, uid, password,'sale.order','check_access_rights',['read'],{'raise_exception':False})

Unfortunately, this code got this error 


Fault: Fault 1: 'Traceback (most recent call last):\n  File "/opt/odoo14/odoo/odoo/addons/base/controllers/rpc.py", line 88, in xmlrpc_2\n    response = self._xmlrpc(service)\n  File "/opt/odoo14/odoo/odoo/addons/base/controllers/rpc.py", line 68, in _xmlrpc\n    result = dispatch_rpc(service, method, params)\n  File "/opt/odoo14/odoo/odoo/http.py", line 142, in dispatch_rpc\n    result = dispatch(method, params)\n  File "/opt/odoo14/odoo/odoo/service/model.py", line 37, in dispatch\n    security.check(db,uid,passwd)\n  File "/opt/odoo14/odoo/odoo/service/security.py", line 9, in check\n    return res_users.check(db, uid, passwd)\nTypeError: \'Boolean\' object is not callable




I do a research, finding out that my UID may be a error code, however I tried with other password and I got different error. In other words, my credential are correct, but I can't use the API with my user. 

I would be grateful with any handy hand. 

Best, 
Juan Grimaldos

0
Avatar
Kassér
Avatar
shubham shiroya
Bedste svar

try this way:
import os

import xmlrpc.client


url = os.getenv('url')

db = os.getenv('db')

username = os.getenv('user')

password = os.getenv('password')


common = xmlrpc.client.ServerProxy('{}/xmlrpc/2/common'.format(url))

uid = common.authenticate(db, username, password, {})


models = xmlrpc.client.ServerProxy('{}/xmlrpc/2/object'.format(url))


# Search for sale orders

sale_orders = models.execute_kw(db, uid, password, 'sale.order', 'search', [[]])


# Read data for the first sale order

if sale_orders:

order_data = models.execute_kw(db, uid, password, 'sale.order', 'read', [sale_orders[0]])

print(order_data)

else:

print("No sale orders found.")


0
Avatar
Kassér
Avatar
Cybrosys Techno Solutions Pvt.Ltd
Bedste svar

Hi,
1- Make certain that the Odoo API version being employed is the appropriate one, specifically XML-RPC version 2, which corresponds to Odoo 14.
2- Please verify that the URL is accurately directed to the correct Odoo server and that the database name is correct.
3- Ensure that the 'username' and 'password' variables contain the accurate login credentials for the specific Odoo user intended to access the API.
4- Ensure that the 'common.authenticate' function is functioning correctly and providing a valid 'uid,' which is essential for making subsequent API calls.
5- Verify whether all the essential Python dependencies and libraries required for making XML-RPC requests have been installed.
6- Check API Call: Review the 'models.execute_kw' call and ensure that all the parameters are correct. The format should be 'models.execute_kw(db, uid, password, model, method, args, kwargs)'.
7- Exception Handling, you can add exception handling to your code to catch any errors that may occur during the API calls.

eg:-

try:
    uid = common.authenticate(db, username, password, {})
except Exception as e:
    print("Authentication Error occurred:", e)


Hope it helps

0
Avatar
Kassér
Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Tilmeld dig
Related Posts Besvarelser Visninger Aktivitet
ValueError: Compute method failed to assign Løst
python3 v14
Avatar
Avatar
Avatar
Avatar
Avatar
5
okt. 24
34117
what's the most recent Python version Odoo 14 can be built on ? Løst
python3 v14
Avatar
1
jul. 23
8781
XML-RPC API - error when adding lines to an existing order
api XML-RPC
Avatar
0
maj 23
2962
Odoo External API limitations
api XML-RPC
Avatar
Avatar
1
mar. 24
7353
Odoo 14: API : Getting product quantity by location
api v14
Avatar
Avatar
1
jan. 23
2337
Community
  • Tutorials
  • Dokumentation
  • Forum
Open Source
  • Download
  • Github
  • Runbot
  • Oversættelser
Tjenester
  • Odoo.sh-hosting
  • Support
  • Opgradere
  • Individuelt tilpasset udvikling
  • Uddannelse
  • Find en bogholder
  • Find en partner
  • Bliv partner
Om os
  • Vores virksomhed
  • Brandaktiver
  • Kontakt os
  • Stillinger
  • Arrangementer
  • Podcast
  • Blog
  • Kunder
  • Juridiske dokumenter • Privatlivspolitik
  • Sikkerhedspolitik
الْعَرَبيّة 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 er en samling open source-forretningsapps, der dækker alle dine virksomhedsbehov – lige fra CRM, e-handel og bogføring til lagerstyring, POS, projektledelse og meget mere.

Det unikke ved Odoo er, at systemet både er brugervenligt og fuldt integreret.

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