Skip to Content
Odoo Menu
  • Prijavi
  • Try it free
  • Apps
    Finance
    • Accounting
    • Invoicing
    • Expenses
    • Spreadsheet (BI)
    • Documents
    • Sign
    Sales
    • CRM
    • Sales
    • POS Shop
    • POS Restaurant
    • Subscriptions
    • Rental
    Websites
    • Website Builder
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Supply Chain
    • Inventory
    • Manufacturing
    • PLM
    • Purchase
    • Maintenance
    • Quality
    Human Resources
    • Employees
    • Recruitment
    • Time Off
    • Appraisals
    • Referrals
    • Fleet
    Marketing
    • Social Marketing
    • Email Marketing
    • SMS Marketing
    • Events
    • Marketing Automation
    • Surveys
    Services
    • Project
    • Timesheets
    • Field Service
    • Helpdesk
    • Planning
    • Appointments
    Productivity
    • Discuss
    • Approvals
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Industries
    Retail
    • Book Store
    • Clothing Store
    • Furniture Store
    • Grocery Store
    • Hardware Store
    • Toy Store
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Beverage Distributor
    • Hotel
    Real Estate
    • Real Estate Agency
    • Architecture Firm
    • Construction
    • Estate Management
    • Gardening
    • Property Owner Association
    Consulting
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Manufacturing
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Corporate Gifts
    Health & Fitness
    • Sports Club
    • Eyewear Store
    • Fitness Center
    • Wellness Practitioners
    • Pharmacy
    • Hair Salon
    Trades
    • Handyman
    • IT Hardware & Support
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Others
    • Nonprofit Organization
    • Environmental Agency
    • Billboard Rental
    • Photography
    • Bike Leasing
    • Software Reseller
    Browse all Industries
  • Community
    Learn
    • Tutorials
    • Documentation
    • Certifications
    • Training
    • Blog
    • Podcast
    Empower Education
    • Education Program
    • Scale Up! Business Game
    • Visit Odoo
    Get the Software
    • Download
    • Compare Editions
    • Releases
    Collaborate
    • Github
    • Forum
    • Events
    • Translations
    • Become a Partner
    • Services for Partners
    • Register your Accounting Firm
    Get Services
    • Find a Partner
    • Find an Accountant
    • Meet an advisor
    • Implementation Services
    • Customer References
    • Support
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Get a demo
  • Pricing
  • Help

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

  • CRM
  • e-Commerce
  • Knjigovodstvo
  • Zaloga
  • PoS
  • Projekt
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Ključne besede (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Ključne besede (View all)
odoo accounting v14 pos v15
About this forum
Pomoč

API error on odoo 14

Naroči se

Get notified when there's activity on this post

This question has been flagged
apipython3XML-RPCv14
2 Odgovori
3990 Prikazi
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
Opusti
Avatar
shubham shiroya
Best Answer

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
Opusti
Avatar
Cybrosys Techno Solutions Pvt.Ltd
Best Answer

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
Opusti
Enjoying the discussion? Don't just read, join in!

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

Prijavi
Related Posts Odgovori Prikazi Aktivnost
ValueError: Compute method failed to assign Solved
python3 v14
Avatar
Avatar
Avatar
Avatar
Avatar
5
okt. 24
34121
what's the most recent Python version Odoo 14 can be built on ? Solved
python3 v14
Avatar
1
jul. 23
8787
XML-RPC API - error when adding lines to an existing order
api XML-RPC
Avatar
0
maj 23
2971
Odoo External API limitations
api XML-RPC
Avatar
Avatar
1
mar. 24
7359
Odoo 14: API : Getting product quantity by location
api v14
Avatar
Avatar
1
jan. 23
2339
Community
  • Tutorials
  • Documentation
  • Forum
Open Source
  • Download
  • Github
  • Runbot
  • Translations
Services
  • Odoo.sh Hosting
  • Support
  • Upgrade
  • Custom Developments
  • Education
  • Find an Accountant
  • Find a Partner
  • Become a Partner
About us
  • Our company
  • Brand Assets
  • Contact us
  • Jobs
  • Events
  • Podcast
  • Blog
  • Customers
  • Legal • Privacy
  • Security
الْعَرَبيّة 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 is a suite of open source business apps that cover all your company needs: CRM, eCommerce, accounting, inventory, point of sale, project management, etc.

Odoo's unique value proposition is to be at the same time very easy to use and fully integrated.

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