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

Creating journal entries via external API (XML-RPC)

Suscribirse

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

Se marcó esta pregunta
pythonxmlrpc
1 Responder
15038 Vistas
Avatar
george@previ.se

Hi,

We are considering using Odoo for reporting purposes, and I'm doing some proof of concept tests right now. Basically, we need to create some journal entries by using the external API and Python. The ultimate goal is to integrate this with our Python based application. I'm using Odoo v11.

I've figured out how to create the journal entry and also journal items - however as soon as I enter a credit or debit balance when creating the item I receive the following error:-

Fault: <Fault 2: 'Cannot create unbalanced journal entry.'>

My very basic code is below. If I run this as-is, it creates the journal entry. However, as soon as I uncomment the credit or debit balances, I receive the error above.

I guess I need a way to create the three lines simultaneously, or alternatively temporarily disable the control preventing the unbalanced entry. (The journal entry will balance after the final entry)

# Create journal entry

je_id = models.execute_kw(db, uid, password, 'account.move', 'create',

[{'name': "Python Journal Entry 2", 'date' : '06-Mar-2018', 'journal_id': '3'}])

# Create three lines - debit AR, Credit sales & tax

l1 = models.execute_kw(db, uid, password, 'account.move.line', 'create',

[{

'move_id': je_id,

'account_id': 7, #Receivables

# 'debit' : 120.00

}])

l2 = models.execute_kw(db, uid, password, 'account.move.line', 'create',

[{'move_id': je_id,

'account_id': 17, #Revenue

# 'credit' : 100.00

}])

l3 = models.execute_kw(db, uid, password, 'account.move.line', 'create',

[{'move_id': je_id,

'account_id': 14, #Tax

# 'credit' : 20.00

}])


Appreciate any advice that can be given.

George

2
Avatar
Descartar
Avatar
george@previ.se
Autor Mejor respuesta

I figured it out!

I need to use {'context' :{'check_move_validity': False}} to allow a journal entry to be temporarily unbalanced. I use 'True' for the final entry to ensure it does eventually balance.

Here's the working code.


# Create journal entry

je_id = models.execute_kw(db, uid, password, 'account.move', 'create',

[{'name': "Python Journal Entry 4", 'date' : '06-Mar-2018', 'journal_id': '3'}])

# Create three lines - debit AR, Credit sales & tax. Credits & debits must total zero.

l1 = models.execute_kw(db, uid, password, 'account.move.line', 'create',

[{

'move_id': je_id,

'account_id': 7, #Receivables

'debit' : 120.00

}],{'context' :{'check_move_validity': False}})

l2 = models.execute_kw(db, uid, password, 'account.move.line', 'create',

[{'move_id': je_id,

'account_id': 17, #Revenue

'credit' : 100.00

}],{'context' :{'check_move_validity': False}})

l3 = models.execute_kw(db, uid, password, 'account.move.line', 'create',

[{'move_id': je_id,

'account_id': 14, #Tax

'credit' : 20.00

}],{'context' :{'check_move_validity': True}})

2
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
404 when testing demo xmlrpc client in python
python xmlrpc
Avatar
Avatar
Avatar
Avatar
3
jul 25
1848
XMLRPC Error 302 Temporarily moved (odoo.sh v13)
python xmlrpc
Avatar
0
jun 20
61
Adding translations while creating records for models with XMLRPC
python translations xmlrpc
Avatar
Avatar
1
may 24
3707
Create invoice via xmlrpc Resuelto
python invoice xmlrpc
Avatar
Avatar
1
nov 22
4180
API attachment question
python api xmlrpc
Avatar
Avatar
Avatar
Avatar
3
jun 22
7573
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