Ir al contenido
Odoo Menú
  • Identificarse
  • Pruébalo gratis
  • Aplicaciones
    Finanzas
    • Contabilidad
    • Facturación
    • Gastos
    • Hoja de cálculo (BI)
    • Documentos
    • Firma electrónica
    Ventas
    • CRM
    • Ventas
    • TPV para tiendas
    • TPV para restaurantes
    • Suscripciones
    • Alquiler
    Sitios web
    • Creador de sitios web
    • Comercio electrónico
    • Blog
    • Foro
    • Chat en directo
    • eLearning
    Cadena de suministro
    • Inventario
    • Fabricación
    • PLM
    • Compra
    • Mantenimiento
    • Calidad
    Recursos Humanos
    • Empleados
    • Reclutamiento
    • Ausencias
    • Evaluación
    • Referencias
    • Flota
    Marketing
    • Marketing social
    • Marketing por correo electrónico
    • Marketing por SMS
    • Eventos
    • Automatización de marketing
    • Encuestas
    Servicios
    • Proyecto
    • Partes de horas
    • Servicio de campo
    • Servicio de asistencia
    • Planificación
    • Citas
    Productividad
    • Conversaciones
    • Aprobaciones
    • IoT
    • VoIP
    • Información
    • WhatsApp
    Aplicaciones de terceros Studio de Odoo Plataforma de Odoo Cloud
  • Industrias
    Comercio al por menor
    • Librería
    • Tienda de ropa
    • Tienda de muebles
    • Tienda de ultramarinos
    • Ferretería
    • Juguetería
    Food & Hospitality
    • Bar y taberna
    • Restaurante
    • Comida rápida
    • Guest House
    • Distribuidor de bebidas
    • Hotel
    Real Estate
    • Real Estate Agency
    • Estudio de arquitectura
    • Construcción
    • Gestión inmobiliaria
    • Jardinería
    • Asociación de propietarios
    Consulting
    • Accounting Firm
    • Partner de Odoo
    • Agencia de marketing
    • Bufete de abogados
    • Adquisición de talentos
    • Auditorías y certificaciones
    Fabricación
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Regalos de empresas
    Salud y bienestar
    • Club deportivo
    • Óptica
    • Gimnasio
    • Terapeutas
    • Farmacia
    • Peluquería
    Trades
    • Handyman
    • Hardware y asistencia informática
    • Solar Energy Systems
    • Zapatero
    • Servicios de limpieza
    • HVAC Services
    Others
    • Nonprofit Organization
    • Agencia de protección del medio ambiente
    • Alquiler de paneles publicitarios
    • Estudio fotográfico
    • Alquiler de bicicletas
    • Distribuidor de software
    Browse all Industries
  • Comunidad
    Aprender
    • Tutoriales
    • Documentación
    • Certificaciones
    • Formación
    • Blog
    • Podcast
    Potenciar la educación
    • Programa de formación
    • Scale Up! El juego empresarial
    • Visita Odoo
    Obtener el software
    • Descargar
    • Comparar ediciones
    • Versiones
    Colaborar
    • GitHub
    • Foro
    • Eventos
    • Traducciones
    • Convertirse en partner
    • Services for Partners
    • Registrar tu empresa contable
    Obtener servicios
    • Encontrar un partner
    • Encontrar un asesor fiscal
    • Contacta con un experto
    • Servicios de implementación
    • Referencias de clientes
    • Ayuda
    • Actualizaciones
    GitHub YouTube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Solicitar una demostración
  • Precios
  • Ayuda

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

  • CRM
  • e-Commerce
  • Contabilidad
  • Inventario
  • PoS
  • Proyecto
  • MRP
All apps
Debe estar registrado para interactuar con la comunidad.
Todas las publicaciones Personas Insignias
Etiquetas (Ver todo)
odoo accounting v14 pos v15
Acerca de este foro
Debe estar registrado para interactuar con la comunidad.
Todas las publicaciones Personas Insignias
Etiquetas (Ver todo)
odoo accounting v14 pos v15
Acerca de este foro
Ayuda

Api External - help

Suscribirse

Reciba una notificación cuando haya actividad en esta publicación

Se marcó esta pregunta
apiodoo16features
3 Respuestas
5171 Vistas
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
Descartar
Avatar
Cybrosys Techno Solutions Pvt.Ltd
Mejor respuesta

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
Descartar
Avatar
akram.mokhtar@raiftextile.com
Autor Mejor respuesta

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
Descartar
akram.mokhtar@raiftextile.com
Autor

<Fault 3: 'Access Denied'>

akram.mokhtar@raiftextile.com
Autor

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)
Mejor respuesta

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
Descartar
¿Le interesa esta conversación? ¡Participe en ella!

Cree una cuenta para poder utilizar funciones exclusivas e interactuar con la comunidad.

Inscribirse
Publicaciones relacionadas Respuestas Vistas Actividad
Api External - can i use it on Test Enviroment as "This database is neutralized. "
api odoo16features
Avatar
0
mar 24
2034
Problem insert data into relational table with api
api odoo16features
Avatar
Avatar
1
may 23
3125
[16.0] call button_validate() method error on Odoo 16
api route odoo16features
Avatar
Avatar
1
feb 24
2868
ODOO 16 - download report from external API
api report odoo16features
Avatar
0
ene 24
2152
Odoo Api Login
api XML-RPC odoo16features
Avatar
0
ago 24
2432
Comunidad
  • Tutoriales
  • Documentación
  • Foro
Código abierto
  • Descargar
  • GitHub
  • Runbot
  • Traducciones
Servicios
  • Alojamiento Odoo.sh
  • Ayuda
  • Actualizar
  • Desarrollos personalizados
  • Educación
  • Encontrar un asesor fiscal
  • Encontrar un partner
  • Convertirse en partner
Sobre nosotros
  • Nuestra empresa
  • Activos de marca
  • Contacta con nosotros
  • Puestos de trabajo
  • Eventos
  • Podcast
  • Blog
  • Clientes
  • Información legal • Privacidad
  • Seguridad
الْعَرَبيّة 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 es un conjunto de aplicaciones de código abierto que cubren todas las necesidades de tu empresa: CRM, comercio electrónico, contabilidad, inventario, punto de venta, gestión de proyectos, etc.

La propuesta única de valor de Odoo es ser muy fácil de usar y totalmente integrado.

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