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

Auto set invoice "Recipient Bank" by currency with automated action

Suscribirse

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

Se marcó esta pregunta
configurationcurrencyAutomatedActionsKeepItSimpleodoo16features
5 Respuestas
5923 Vistas
Avatar
Ricardo Gross

Having different bank accounts in different currencies, is it possible to configure Odoo so that when creating customer invoice and selecting, for example the Euro currency, automatically my Euro bank account will be set in the Recipient Bank?


Odoo simply takes the first company account from the top which causes errors, an Automatic Action to take the first account in the currency/journal currrency selected in invoice could be a solution.


1
Avatar
Descartar
Avatar
Patrick Mathers
Mejor respuesta

This worked for me:


Model: Journal Entry

Trigger: On Creation & Update

Action to do: Execute Python Code

Python Code:

for record in records:
  if record.move_type == 'out_invoice':
    currency = record.currency_id
    bank_account = record.env['res.partner.bank'].search([('currency_id', '=', currency.id)], limit=1)
    if bank_account:
        record.write({'partner_bank_id': bank_account.id})

Update: You can set currency.id as a trigger field, although this was not necessary in my case as all fields are monitored if empty.

2
Avatar
Descartar
Ricardo Gross
Autor

thanks Patrick, but maybe missing trigger fields or something else?

Michael Hofer

Thanks, this did help - I have just extended it slightly in my answer.

Ricardo Gross
Autor

for v18 it also works by setting the trigger "on save” and adding Apply on “status = Draft"

Avatar
Michael Hofer
Mejor respuesta

It's really surprising that there is no easier way to solve this. I had the same issue and found this thread, but the examples were not fully working for me. They did select a bank account, but not necessarily one which is linked to the own company.


This seems to work (tested in Odoo 17, but should work in Odoo 16 too):


for record in records:
if record.move_type == 'out_invoice':
  currency = record.currency_id
bank_account = record.env['res.partner.bank'].search(['&', ('currency_id', '=', currency.id), ('partner_id', '=', record.env.company.partner_id.id)], limit=1)
    if bank_account:
        record.write({'partner_bank_id': bank_account.id})



I have set the trigger on "currency" too, but it is not necessary. Hope it helps!

1
Avatar
Descartar
Admin

Hi Michael,
Thank you for your answer. I use Odoo 17 and have been trying to setting the Automation Rules there to automatically change the Recipient bank when changing the currency of the invoice. I assume that in Odoo 17 you need to define 2 Rules since you can only choose one Trigger? One trigger would be "after last update" and one "after creation". Do I need to set a Domain (if yes, which)? Do i need to set parameters for "apply on" (if yes, which)? I used your code above but it gives me an error message. (IndentationError : unindent does not match any outer indentation level at line 16
bank_account = record.env['res.partner.bank'].search(['&', ('currency_id', '=', currency.id), ('partner_id', '=', record.env.company.partner_id.id)], limit=1))
Thank you for your help!

Avatar
constanceseverino
Mejor respuesta

I think you can reference this post. It can help.

0
Avatar
Descartar
constanceseverino

https://www.odoo.com/ko_KR/forum/doummal-1/multi-currency-on-invoice-cannot-update-on-report-214088

constanceseverino

or this link https://www.odoo.com/ko_KR/forum/doummal-1/displaying-currency-in-invoice-with-3-letter-currency-code-213421 https://bloxdio2.com

Avatar
Kris Kormany
Mejor respuesta

I would need exactly that, but the provided code does not work in Odoo 16. @Ricardo: Were you able to solve this?

0
Avatar
Descartar
Ricardo Gross
Autor

unfortunately not yet

Avatar
Savya Sachin
Mejor respuesta

Hi,

Yes, for this you can create an automatic action that triggers when a new invoice is created or updated. The automatic action should set the recipient bank account based on the currency selected in the invoice.

for move in records:
if move.type == 'out_invoice':
currency = move.currency_id
bank_account = self.env['res.partner.bank'].search([('currency_id', '=', currency.id)], limit=1)
if bank_account:
move.write({'partner_bank_id': bank_account.id})


Once the automatic action is created, it will be triggered when a new invoice is created or updated. It will set the recipient bank account based on the currency selected in the invoice.

Note that this solution assumes that you have created separate bank accounts for each currency. If you have not done so already, you will need to create a separate bank account for each currency in your chart of accounts.


Regards

0
Avatar
Descartar
Ricardo Gross
Autor

thanks for your solution.
But either I'm doing something wrong or the automated action code is not correct, as when I test and change the invoice currency, the recipient bank remains always the same. Have you tested your solution in v16?

¿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
Unable users to timesheet hours on closed (folded) projects and/or tasks
timesheets folded AutomatedActions KeepItSimple odoo16features
Avatar
Avatar
1
feb 24
3355
Is there a way for changes to confirmed SO's to update the PO? (Inter-Company Transactions)
syncronisation intercompany AutomatedActions KeepItSimple odoo16features
Avatar
0
feb 23
2953
Odoo16: where is Automated Actions in Technical menu Resuelto
AutomatedActions odoo16features
Avatar
Avatar
Avatar
Avatar
3
oct 23
4227
Currency issue in Vendor Bill Resuelto
currency odoo16features
Avatar
Avatar
1
oct 23
2684
EE16 - exchange rate not being applied to journal entries
accounting currency odoo16features
Avatar
Avatar
Avatar
2
jul 24
3471
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