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
    Alimentación y hostelería
    • Bar y taberna
    • Restaurante
    • Comida rápida
    • Casa de huéspedes
    • Distribuidor de bebidas
    • Hotel
    Inmueble
    • Agencia inmobiliaria
    • Estudio de arquitectura
    • Construcción
    • Gestión inmobiliaria
    • Jardinería
    • Asociación de propietarios
    Consultoría
    • Empresa contable
    • Partner de Odoo
    • Agencia de marketing
    • Bufete de abogados
    • Adquisición de talentos
    • Auditorías y certificaciones
    Fabricación
    • Textil
    • Metal
    • Muebles
    • Alimentos
    • Brewery
    • Regalos de empresas
    Salud y bienestar
    • Club deportivo
    • Óptica
    • Gimnasio
    • Terapeutas
    • Farmacia
    • Peluquería
    Oficios
    • Handyman
    • Hardware y asistencia informática
    • Sistemas de energía solar
    • Zapatero
    • Servicios de limpieza
    • Servicios de calefacción, ventilación y aire acondicionado
    Otros
    • Organización sin ánimo de lucro
    • 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

Register payment automatically

Suscribirse

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

Se marcó esta pregunta
automaticpaymentvoucher
1 Responder
9983 Vistas
Avatar
Raffaele

Hallo, I'm implementing Odoo for a business where they need to register payment automatically, given these values:

  • payment date = invoice date

  • paid amount = invoice total amount

  • payment type = bank

I tried with the following code, but it fails with an error 

ValueError: "" while evaluating action_register_payment() 

It's likely I'm missing something about creating the voucher, which is a part that actually I don't know.

Code

In the invoice view: added a button 

<button name="invoice_paid" states="open" string="Invoice paid" class="oe_highlight" groups="base.group_user" />

that calls a transition by its signal

<record id="open_to_paid" model="workflow.transition">
<field name="act_from" ref="account.act_open"/>
<field name="act_to" ref="account.act_paid"/>
<field name="signal">invoice_paid</field>
</record>

the action of the act_paid activity has been improved

<record id="account.act_paid" model="workflow.activity">
<field name="action">action_register_payment()
confirm_paid()</field>
</record>

 and finally the action_register_payment():

def action_register_payment(self):
for inv in self:
journal_pool = self.env['account.journal']
journal_id = journal_pool.search([('company_id','=',inv.company_id.id), ('code','=','BNK2')])[0].id
journal = journal_pool.browse(journal_id)
account_id = journal.default_debit_account_id.id
vals = {
'currency_id': inv.currency_id.id,
'partner_id': inv.partner_id.id,
'amount': inv.amount_total,
'reference': inv.name,
'name': inv.number,
'type': 'payment',
'date': inv.date_invoice,
'period_id': inv.period_id.id,
'journal_id': journal_id,
'account_id': account_id,
'writeoff_amount': 0.0,
'paid': True,
'narration': 'Automatically set to paid'
}
id = voucher_pool.create(vals)
voucher_id = voucher_pool.browse(id)
voucher_id.signal_workflow('proforma_voucher')
voucher_pool = self.env['account.voucher']

0
Avatar
Descartar
Avatar
Kinner Vachhani
Mejor respuesta

Hi, 

The error seems to be coming form create method. Put an ipdb statement before 

id = voucher_pool.create(vals)

Could you paste the stack trace? 


1
Avatar
Descartar
Raffaele
Autor

I have installed Odoo via apt-get: do I need to launch it from terminal to get the trace of ipdb? If so, how can I launch Odoo manually?

Kinner Vachhani

Hi Raffaele, You need a manual start. I you can't then there is an alternative way to debug Print values thought logger.info(val) before voucher code create. Connect database through erppeek (pip install erppeek). $erppeek -d $voucher_obj = model('account.voucher') $voucher_obj.create(vals) Check the error message. Retry creating voucher until you get it right.

¿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
What payment processors does Odoo Subscriptions work with?
automatic payment charge
Avatar
Avatar
1
dic 22
2273
Invoice Payments and Bank Statements (7.0) different behavior than in 6.x
payment bank_statement voucher
Avatar
0
mar 15
4233
Batch Report [Qweb]
accounting payment voucher report
Avatar
0
mar 16
4674
What is the effect of the 'Exchange Rate' in payment voucher?
accounting reconciliation payment voucher
Avatar
0
mar 15
5497
How to create a record within a record creation ?
payment voucher record object
Avatar
0
mar 15
4386
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