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 External - help

Tilmeld

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

Dette spørgsmål er blevet anmeldt
apiodoo16features
3 Besvarelser
5138 Visninger
Avatar
akram.mokhtar@raiftextile.com

how to configure api correctly on odoo cloud?

i did it on  prem and it work fine but on cloud it does not

here is my python code :

import xmlrpc.client

import pandas as pd

from tabulate import tabulate



# Odoo API information

url = 'myurl'

db = 'mydatabsename'

username = 'myuser​'

password = 'my api key'


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

common.version()

print(common.version())


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

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


print(models)


try:

    # Change the model to 'sale.order.line' and adjust the query as needed

    records = models.execute_kw(

        db, uid, password, 'sale.order.line', 'search_read',

        [[('state', '=', 'sale')]],

        {'fields': ['id','order_id','product_template_id', 'product_id','display_name', 'product_uom_qty', 'price_unit', 'product_uom', 'write_date', 'name' ,'qty_delivered'],

         'limit': 100, 'order': 'write_date desc'}

    )


    # Extract relevant fields and flatten the data

    data = []

    for record in records:

        product_info = models.execute_kw(

            db, uid, password, 'product.product', 'read',

            [[record['product_id'][0]]],

            {'fields': ['name']}

        )[0]


        data.append({

            'Date': record['write_date'],

            'Sales Order Number': record['order_id'],

            'Product': record['name'],

            #'Product': product_info.get('name', ''),

            #'Product Full Name': record['display_name'],

            'Quantity': record['product_uom_qty'],

            'Price Per Unit': record['price_unit'],

            'Qty Delivered': record['qty_delivered']

            #'Unit': record['product_uom']

        })


    df = pd.DataFrame(data)


    # Print the table

    print(tabulate(df, headers='keys', tablefmt='fancy_grid', showindex=False))


    # Export to Excel file

    excel_file_path = 'sales_order_lines_with_details.xlsx'

    df.to_excel(excel_file_path, index=False)

    print(f"Sales order lines with details exported to {excel_file_path}")


except xmlrpc.client.Fault as e:

    print(f"Error executing Odoo API method: {e}")

finally:

    print("Script execution completed.")

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

Hi,
Here are some general steps you can take to troubleshoot and ensure proper configuration:

  1. Credentials Check:
    • Verify URL, database, username, and password correctness.
  2. API Access Rights:
    • Confirm the specified user has necessary API access rights.
  3. Update URL Handling:
    • Construct and pass the full API endpoint URL to ServerProxy.
  4. SSL Handling:
    • Handle SSL correctly, consider additional parameters for HTTPS.
  5. Print Responses:
    • Print responses, especially from common.authenticate, for error messages.
  6. Firewall and Security:
    • Ensure no restrictions in firewall or security groups.
  7. Version Compatibility:
    • Confirm script compatibility with the Odoo version on the cloud.
  8. Exception Handling:
    • Catch relevant exceptions for detailed error messages.
  9. Check Odoo Logs:
    • Inspect Odoo logs for API call-related errors or warnings

You can also refer to How to Handle External APIs in Odoo 16


Hope it helps

0
Avatar
Kassér
Avatar
akram.mokhtar@raiftextile.com
Forfatter Bedste svar

when i triger this 

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

it give me :
{'server_version': '16.0+e', 'server_version_info': [16, 0, 0, 'final', 0, 'e'], 'server_serie': '16.0', 'protocol_version': 1}
but when i trigger the other script ,it give me only

0
Avatar
Kassér
akram.mokhtar@raiftextile.com
Forfatter

<Fault 3: 'Access Denied'>

akram.mokhtar@raiftextile.com
Forfatter

this script too in the video :
import xmlrpc.client

url = 'myurl_cloud_odoo'

db = 'db-test-10928066'

username = 'myuser'
password = 'myapi'

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

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

if uid:
print("authentication success")
else:
print("authentication failed")

it give me authentication failed
so what is the permission needed to accept the api external on cloud
when i tried it on onprem it works perfect

Avatar
Niyas Raphy (Walnut Software Solutions)
Bedste svar

Hi,

When the script is triggered against the cloud server, did you receive any error ? Did you get chance to cross how far the code execution goes.

It will be better, if you update the post along with error details that you receive.

For more about odoo external api, see: external api in odoo

Thanks

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
Api External - can i use it on Test Enviroment as "This database is neutralized. "
api odoo16features
Avatar
0
mar. 24
2020
Problem insert data into relational table with api
api odoo16features
Avatar
Avatar
1
maj 23
3117
[16.0] call button_validate() method error on Odoo 16
api route odoo16features
Avatar
Avatar
1
feb. 24
2848
ODOO 16 - download report from external API
api report odoo16features
Avatar
0
jan. 24
2149
Odoo Api Login
api XML-RPC odoo16features
Avatar
0
aug. 24
2423
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