Ir al contenido
Odoo Menú
  • Iniciar sesión
  • Pruébalo gratis
  • Aplicaciones
    Finanzas
    • Contabilidad
    • Facturación
    • Gastos
    • Hoja de cálculo (BI)
    • Documentos
    • Firma electrónica
    Ventas
    • CRM
    • Ventas
    • PdV para tiendas
    • PdV para restaurantes
    • Suscripciones
    • Alquiler
    Sitios web
    • Creador de sitios web
    • Comercio electrónico
    • Blog
    • Foro
    • Chat en vivo
    • eLearning
    Cadena de suministro
    • Inventario
    • Manufactura
    • PLM
    • Compras
    • Mantenimiento
    • Calidad
    Recursos humanos
    • Empleados
    • Reclutamiento
    • Vacaciones
    • Evaluaciones
    • Referencias
    • Flotilla
    Marketing
    • Redes sociales
    • Marketing por correo
    • Marketing por SMS
    • Eventos
    • Automatización de marketing
    • Encuestas
    Servicios
    • Proyectos
    • Registro de horas
    • Servicio externo
    • Soporte al cliente
    • Planeación
    • Citas
    Productividad
    • Conversaciones
    • Aprobaciones
    • IoT
    • VoIP
    • Artículos
    • WhatsApp
    Aplicaciones externas Studio de Odoo Plataforma de Odoo en la nube
  • Industrias
    Venta minorista
    • Librería
    • Tienda de ropa
    • Mueblería
    • Tienda de abarrotes
    • Ferretería
    • Juguetería
    Alimentos y hospitalidad
    • Bar y pub
    • Restaurante
    • Comida rápida
    • Casa de huéspedes
    • Distribuidora de bebidas
    • Hotel
    Bienes inmuebles
    • Agencia inmobiliaria
    • Estudio de arquitectura
    • Construcción
    • Gestión de bienes inmuebles
    • Jardinería
    • Asociación de propietarios
    Consultoría
    • Firma contable
    • Partner de Odoo
    • Agencia de marketing
    • Bufete de abogados
    • Adquisición de talentos
    • Auditorías y certificaciones
    Manufactura
    • Textil
    • Metal
    • Muebles
    • Comida
    • Cervecería
    • Regalos corporativos
    Salud y ejercicio
    • Club deportivo
    • Óptica
    • Gimnasio
    • Especialistas en bienestar
    • Farmacia
    • Peluquería
    Trades
    • Personal de mantenimiento
    • Hardware y soporte de TI
    • Sistemas de energía solar
    • Zapateros y fabricantes de calzado
    • Servicios de limpieza
    • Servicios de calefacción, ventilación y aire acondicionado
    Otros
    • Organización sin fines de lucro
    • Agencia para la protección del medio ambiente
    • Alquiler de anuncios publicitarios
    • Fotografía
    • Alquiler de bicicletas
    • Distribuidor de software
    Descubre todas las industrias
  • Odoo Community
    Aprende
    • Tutoriales
    • Documentación
    • Certificaciones
    • Capacitación
    • Blog
    • Podcast
    Fortalece la educación
    • Programa educativo
    • Scale Up! El juego empresarial
    • Visita Odoo
    Obtén el software
    • Descargar
    • Compara ediciones
    • Versiones
    Colabora
    • GitHub
    • Foro
    • Eventos
    • Traducciones
    • Conviértete en partner
    • Servicios para partners
    • Registra tu firma contable
    Obtén servicios
    • Encuentra un partner
    • Encuentra un contador
    • Contacta a un consultor
    • Servicios de implementación
    • Referencias de clientes
    • Soporte
    • Actualizaciones
    GitHub YouTube Twitter LinkedIn Instagram Facebook Spotify
    +1 (650) 691-3277
    Solicita 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
  • Proyectos
  • 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
5179 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.

Registrarse
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
2045
Problem insert data into relational table with api
api odoo16features
Avatar
Avatar
1
may 23
3133
[16.0] call button_validate() method error on Odoo 16
api route odoo16features
Avatar
Avatar
1
feb 24
2876
ODOO 16 - download report from external API
api report odoo16features
Avatar
0
ene 24
2154
Odoo Api Login
api XML-RPC odoo16features
Avatar
0
ago 24
2436
Comunidad
  • Tutoriales
  • Documentación
  • Foro
Código abierto
  • Descargar
  • GitHub
  • Runbot
  • Traducciones
Servicios
  • Alojamiento en Odoo.sh
  • Soporte
  • Actualizaciones del software
  • Desarrollos personalizados
  • Educación
  • Encuentra un contador
  • Encuentra un partner
  • Conviértete en partner
Sobre nosotros
  • Nuestra empresa
  • Activos de marca
  • Contáctanos
  • Empleos
  • Eventos
  • Podcast
  • Blog
  • Clientes
  • 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 estar 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