Přejít na obsah
Odoo Menu
  • Přihlásit se
  • Vyzkoušejte zdarma
  • Aplikace
    Finance
    • Účetnictví
    • Fakturace
    • Výdaje
    • Spreadsheet (BI)
    • Dokumenty
    • Podpisy
    Prodej
    • CRM
    • Prodej
    • POS Obchod
    • POS Restaurace
    • Předplatné
    • Pronájem
    Webové stránky
    • Webové stránky
    • E-shop
    • Blog
    • Fórum
    • Živý chat
    • eLearning
    Dodavatelský řetězec
    • Sklad
    • Výroba
    • PLM
    • Nákup
    • Údržba
    • Kvalita
    Lidské zdroje
    • Zaměstnanci
    • Nábor
    • Volno
    • Hodnocení zaměstnanců
    • Doporučení
    • Vozový park
    Marketing
    • Marketing sociálních sítí
    • Emailový marketing
    • SMS Marketing
    • Události
    • Marketingová automatizace
    • Dotazníky
    Služby
    • Projekt
    • Časové výkazy
    • Práce v terénu
    • Helpdesk
    • Plánování
    • Schůzky
    Produktivita
    • Diskuze
    • Schvalování
    • IoT
    • VoIP
    • Znalosti
    • WhatsApp
    Aplikace třetích stran Odoo Studio Odoo cloudová platforma
  • Branže
    Maloobchod
    • Knihkupectví
    • Obchod s oblečením
    • Obchod s nábytkem
    • Potraviny
    • Obchod s hardwarem
    • Hračkářství
    Food & Hospitality
    • Bar a Pub
    • Restaurace
    • Fast Food
    • Guest House
    • Distributor nápojů
    • Hotel
    Real Estate
    • Real Estate Agency
    • Architektonická firma
    • Stavba
    • Správa nemovitostí
    • Zahradnictví
    • Asociace vlastníků nemovitosti
    Consulting
    • Accounting Firm
    • Odoo Partner
    • Marketingová agentura
    • Právník
    • Akvizice talentů
    • Audit a certifikace
    Výroba
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Korporátní dárky
    Zdraví a fitness
    • Sportovní klub
    • Prodejna brýli
    • Fitness Centrum
    • Wellness praktikové
    • Lékárna
    • Kadeřnictví
    Trades
    • Údržbář
    • IT hardware a podpora
    • Solar Energy Systems
    • Výrobce obuvi
    • Úklidové služby
    • HVAC Services
    Others
    • Nonprofit Organization
    • Agentura pro životní prostředí
    • Pronájem billboardů
    • Fotografování
    • Leasing jízdních kol
    • Prodejce softwaru
    Browse all Industries
  • Komunita
    Edukační program
    • Tutoriály
    • Dokumentace
    • Certifikace
    • Vzdělávání
    • Blog
    • Podcast
    Podpora vzdělávání
    • Vzdělávací program
    • Scale Up! Hra na firmu
    • Navštivte Odoo
    Získat software
    • Stáhnout
    • Porovnejte edice
    • Verze
    Spolupráce
    • Github
    • Fórum
    • Události
    • Překlady
    • Stát se partnerem
    • Services for Partners
    • Registrujte svou účetní firmu
    Získat služby
    • Najít partnera
    • Najít účetní
    • Setkejte se s poradcem
    • Implementační služby
    • Zákaznické reference
    • Podpora
    • Upgrady
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Dohodnout demo
  • Ceník
  • Pomoc

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

  • CRM
  • e-Commerce
  • Účetnictví
  • Sklad
  • PoS
  • Projekty
  • MRP
All apps
You need to be registered to interact with the community.
All Posts Lidé Odznaky
Štítky (View all)
odoo accounting v14 pos v15
O tomto fóru
You need to be registered to interact with the community.
All Posts Lidé Odznaky
Štítky (View all)
odoo accounting v14 pos v15
O tomto fóru
Pomoc

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

Odebírat

Get notified when there's activity on this post

This question has been flagged
configurationcurrencyAutomatedActionsKeepItSimpleodoo16features
5 Odpovědi
5912 Zobrazení
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
Zrušit
Avatar
Patrick Mathers
Nejlepší odpověď

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
Zrušit
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
Nejlepší odpověď

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
Zrušit
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
Nejlepší odpověď

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

0
Avatar
Zrušit
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
Nejlepší odpověď

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

0
Avatar
Zrušit
Ricardo Gross
Autor

unfortunately not yet

Avatar
Savya Sachin
Nejlepší odpověď

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
Zrušit
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?

Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Přihlásit se
Related Posts Odpovědi Zobrazení Aktivita
Unable users to timesheet hours on closed (folded) projects and/or tasks
timesheets folded AutomatedActions KeepItSimple odoo16features
Avatar
Avatar
1
úno 24
3340
Is there a way for changes to confirmed SO's to update the PO? (Inter-Company Transactions)
syncronisation intercompany AutomatedActions KeepItSimple odoo16features
Avatar
0
úno 23
2946
Odoo16: where is Automated Actions in Technical menu Vyřešeno
AutomatedActions odoo16features
Avatar
Avatar
Avatar
Avatar
3
říj 23
4207
Currency issue in Vendor Bill Vyřešeno
currency odoo16features
Avatar
Avatar
1
říj 23
2677
EE16 - exchange rate not being applied to journal entries
accounting currency odoo16features
Avatar
Avatar
Avatar
2
čvc 24
3465
Komunita
  • Tutoriály
  • Dokumentace
  • Fórum
Open Source
  • Stáhnout
  • Github
  • Runbot
  • Překlady
Služby
  • Odoo.sh hostování
  • Podpora
  • Upgrade
  • Nestandardní vývoj
  • Edukační program
  • Najít účetní
  • Najít partnera
  • Stát se partnerem
O nás
  • Naše společnost
  • Podklady značky
  • Kontakujte nás
  • Práce
  • Události
  • Podcast
  • Blog
  • Zákazníci
  • Právní dokumenty • Soukromí
  • Zabezpečení
الْعَرَبيّة 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 je balíček open-source aplikací, které pokrývají všechny potřeby vaší společnosti: CRM, e-shop, účetnictví, sklady, kasy, projektové řízení a další.

Unikátní nabídka od Odoo poskytuje velmi jednoduché uživatelské rozhraní a vše je integrované na jednom místě.

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