Skip to Content
Odoo Menú
  • Registra entrada
  • Prova-ho gratis
  • Aplicacions
    Finances
    • Comptabilitat
    • Facturació
    • Despeses
    • Full de càlcul (IA)
    • Documents
    • Signatura
    Vendes
    • CRM
    • Vendes
    • Punt de venda per a botigues
    • Punt de venda per a restaurants
    • Subscripcions
    • Lloguer
    Imatges de llocs web
    • Creació de llocs web
    • Comerç electrònic
    • Blog
    • Fòrum
    • Xat en directe
    • Aprenentatge en línia
    Cadena de subministrament
    • Inventari
    • Fabricació
    • PLM
    • Compres
    • Manteniment
    • Qualitat
    Recursos humans
    • Empleats
    • Reclutament
    • Absències
    • Avaluacions
    • Recomanacions
    • Flota
    Màrqueting
    • Màrqueting Social
    • Màrqueting per correu electrònic
    • Màrqueting per SMS
    • Esdeveniments
    • Automatització del màrqueting
    • Enquestes
    Serveis
    • Projectes
    • Fulls d'hores
    • Servei de camp
    • Suport
    • Planificació
    • Cites
    Productivitat
    • Converses
    • Validacions
    • IoT
    • VoIP
    • Coneixements
    • WhatsApp
    Aplicacions de tercers Odoo Studio Plataforma d'Odoo al núvol
  • Sectors
    Comerç al detall
    • Llibreria
    • Botiga de roba
    • Botiga de mobles
    • Botiga d'ultramarins
    • Ferreteria
    • Botiga de joguines
    Food & Hospitality
    • Bar i pub
    • Restaurant
    • Menjar ràpid
    • Guest House
    • Distribuïdor de begudes
    • Hotel
    Immobiliari
    • Agència immobiliària
    • Estudi d'arquitectura
    • Construcció
    • Gestió immobiliària
    • Jardineria
    • Associació de propietaris de béns immobles
    Consultoria
    • Empresa comptable
    • Partner d'Odoo
    • Agència de màrqueting
    • Bufet d'advocats
    • Captació de talent
    • Auditoria i certificació
    Fabricació
    • Textile
    • Metal
    • Mobles
    • Menjar
    • Brewery
    • Regals corporatius
    Salut i fitness
    • Club d'esport
    • Òptica
    • Centre de fitness
    • Especialistes en benestar
    • Farmàcia
    • Perruqueria
    Trades
    • Servei de manteniment
    • Hardware i suport informàtic
    • Sistemes d'energia solar
    • Shoe Maker
    • Serveis de neteja
    • Instal·lacions HVAC
    Altres
    • Nonprofit Organization
    • Agència del medi ambient
    • Lloguer de panells publicitaris
    • Fotografia
    • Lloguer de bicicletes
    • Distribuïdors de programari
    Browse all Industries
  • Comunitat
    Aprèn
    • Tutorials
    • Documentació
    • Certificacions
    • Formació
    • Blog
    • Pòdcast
    Potenciar l'educació
    • Programa educatiu
    • Scale-Up! El joc empresarial
    • Visita Odoo
    Obtindre el programari
    • Descarregar
    • Comparar edicions
    • Novetats de les versions
    Col·laborar
    • GitHub
    • Fòrum
    • Esdeveniments
    • Traduccions
    • Converteix-te en partner
    • Services for Partners
    • Registra la teva empresa comptable
    Obtindre els serveis
    • Troba un partner
    • Troba un comptable
    • Contacta amb un expert
    • Serveis d'implementació
    • Referències del client
    • Suport
    • Actualitzacions
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Programar una demo
  • Preus
  • Ajuda

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

  • CRM
  • e-Commerce
  • Comptabilitat
  • Inventari
  • PoS
  • Projectes
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Etiquetes (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Etiquetes (View all)
odoo accounting v14 pos v15
About this forum
Ajuda

Multi currency

Subscriure's

Get notified when there's activity on this post

This question has been flagged
accountingmulticurrencyodooV17
1645 Vistes
Avatar
Alain kazadi

Hi everyone, I'm new to odoo. For my accounting entries, I do a multiple conversion on the debit, credit and balance lines for an operation carried out in a currency other than the one selected. How can I solve this?


def _get_report_vals(self, dates, entry_type, journal_id, company_id, prev_period, last_period, currency_id, fold_account_ids):
move_lines = []
domain = []
compare_period = []
if not isinstance(fold_account_ids, list):
fold_account_ids = [int(x) for x in fold_account_ids.split(',')] if fold_account_ids else []
if journal_id and journal_id not in ['0', 'undefined']:
domain += [('move_id.journal_id', '=', int(journal_id))]
if company_id and company_id not in ['0', 'undefined']:
domain += [('move_id.company_id', '=', int(company_id))]
if entry_type == 'all':
domain += [('move_id.state', 'in', ['draft', 'posted'])]
elif entry_type == 'draft':
domain += [('move_id.state', '=', 'draft')]
elif entry_type == 'posted':
domain += [('move_id.state', '=', 'posted')]
date_from, date_to = date_utils.get_month(fields.Date.context_today(self))
string = format_date(self.env, fields.Date.to_string(date_to), date_format='MMM YYYY')
quarter_names = get_quarter_names('abbreviated', locale=get_lang(self.env).code)
if dates == 'this_month':
string = format_date(self.env, fields.Date.to_string(date_to), date_format='MMM YYYY')
domain += [('date', '>=', date_from), ('date', '<=', date_to)]
elif dates == 'this_quarter':
date_from, date_to = date_utils.get_quarter(fields.Date.context_today(self))
string = u'%s\N{NO-BREAK SPACE}%s' % (quarter_names[date_utils.get_quarter_number(date_to)], date_to.year)
domain += [('date', '>=', date_from), ('date', '<=', date_to)]
elif dates == 'this_fin_year':
company_fiscalyear_dates = self.env.company.compute_fiscalyear_dates(fields.Date.context_today(self))
date_from = company_fiscalyear_dates['date_from']
date_to = company_fiscalyear_dates['date_to']
string = date_to.strftime('%Y')
domain += [('date', '>=', date_from), ('date', '<=', date_to)]
elif dates == 'last_month':
date_from, date_to = date_utils.get_month(fields.Date.context_today(self))
date_from = date_from - relativedelta(months=1)
date_to = date_to - relativedelta(months=1)
string = format_date(self.env, fields.Date.to_string(date_to), date_format='MMM YYYY')
domain += [('date', '>=', date_from), ('date', '<=', date_to)]
elif dates == 'last_quarter':
date_from, date_to = date_utils.get_quarter(fields.Date.context_today(self))
date_from = date_from - relativedelta(months=1)
date_from, date_to = date_utils.get_quarter(date_from)
string = u'%s\N{NO-BREAK SPACE}%s' % (quarter_names[date_utils.get_quarter_number(date_to)], date_to.year)
domain += [('date', '>=', date_from), ('date', '<=', date_to)]
elif dates == 'last_fin_year':
company_fiscalyear_dates = self.env.company.compute_fiscalyear_dates(fields.Date.context_today(self))
date_from = company_fiscalyear_dates['date_from']
date_to = company_fiscalyear_dates['date_to']
date_from = date_from - relativedelta(years=1)
date_to = date_to - relativedelta(years=1)
string = date_to.strftime('%Y')
domain += [('date', '>=', date_from), ('date', '<=', date_to)]
line_data = {}
selected_currency = currency_id or self.env.company.currency_id
if selected_currency and selected_currency not in ['0', 'undefined']:
selected_currency = self.env['res.currency'].browse(int(selected_currency))
else:
selected_currency = self.env.company.currency_id
rates_conversion = self.env['ir.config_parameter'].sudo().get_param('account_report_with_multi_currency.rates_conversion_date_selection')
if rates_conversion == 'transaction_date':
for mo_line in self.env['account.move.line'].search(domain, order='account_code asc'):
if mo_line.account_id not in line_data:
line_data[mo_line.account_id] = {}
line_data[mo_line.account_id]['debit'] = mo_line.currency_id._convert(mo_line.debit, selected_currency, self.env.company, mo_line.date or fields.Date.context_today(self))
line_data[mo_line.account_id]['credit'] = mo_line.currency_id._convert(mo_line.credit, selected_currency, self.env.company, mo_line.date or fields.Date.context_today(self))
line_data[mo_line.account_id]['amount_currency'] = mo_line.currency_id._convert(mo_line.amount_currency, selected_currency, self.env.company, mo_line.date or fields.Date.context_today(self))
line_data[mo_line.account_id]['date'] = mo_line.date
line_data[mo_line.account_id]['partner'] = ''
line_data[mo_line.account_id]['name'] = ''
line_data[mo_line.account_id]['account_id'] = mo_line.account_id.id

else:
line_data[mo_line.account_id]['debit'] += mo_line.currency_id._convert(mo_line.debit, selected_currency, self.env.company, mo_line.date or fields.Date.context_today(self))
line_data[mo_line.account_id]['credit'] += mo_line.currency_id._convert(mo_line.credit, selected_currency, self.env.company, mo_line.date or fields.Date.context_today(self))
line_data[mo_line.account_id]['amount_currency'] += mo_line.currency_id._convert(mo_line.amount_currency, selected_currency, self.env.company, mo_line.date or fields.Date.context_today(self))
else:
for mo_line in self.env['account.move.line'].search(domain, order='account_code asc'):
if mo_line.account_id not in line_data:
line_data[mo_line.account_id] = {}
line_data[mo_line.account_id]['debit'] = mo_line.currency_id._convert(mo_line.debit, selected_currency, self.env.company, date_from or fields.Date.context_today(self))
line_data[mo_line.account_id]['credit'] = mo_line.currency_id._convert(mo_line.credit, selected_currency, self.env.company, date_from or fields.Date.context_today(self))
line_data[mo_line.account_id]['amount_currency'] = mo_line.currency_id._convert(mo_line.amount_currency, selected_currency, self.env.company, date_from or fields.Date.context_today(self))
line_data[mo_line.account_id]['date'] = mo_line.date
line_data[mo_line.account_id]['partner'] = ''
line_data[mo_line.account_id]['name'] = ''
line_data[mo_line.account_id]['account_id'] = mo_line.account_id.id
else:
line_data[mo_line.account_id]['debit'] += mo_line.currency_id._convert(mo_line.debit, selected_currency, self.env.company, date_from or fields.Date.context_today(self))
line_data[mo_line.account_id]['credit'] += mo_line.currency_id._convert(mo_line.credit, selected_currency, self.env.company, date_from or fields.Date.context_today(self))
line_data[mo_line.account_id]['amount_currency'] += mo_line.currency_id._convert(mo_line.amount_currency, selected_currency, self.env.company, date_from or fields.Date.context_today(self))
# line_data = self.env['account.move.line'].read_group(domain, ['account_id', 'debit', 'credit', 'date', 'partner_id', 'amount_currency', 'move_name'], ['account_id'])
for account in line_data:
lines = self.env['account.move.line'].search(domain + [('account_id', '=', account.id)])
move_line_list = []
for line in lines:
move_line_data = {}
move_line_data['id'] = line.id
move_line_data['move_name'] = line.move_id.name
move_line_data['move_id'] = line.move_id.id
move_line_data['model'] = line.move_id._name
move_line_data['date'] = line.date
move_line_data['name'] = line.name
move_line_data['partner_id'] = line.partner_id.name
# move_line_data['is_foldernle'] = True if line.account_id.id in fold_account_ids else False
if rates_conversion == 'transaction_date':
move_line_data['debit'] = line.currency_id._convert(line.debit, selected_currency, self.env.company, line.date or fields.Date.context_today(self))
move_line_data['credit'] = line.currency_id._convert(line.credit, selected_currency, self.env.company, line.date or fields.Date.context_today(self))
move_line_data['amount_currency'] = line.currency_id._convert(line.amount_currency, selected_currency, self.env.company, line.date or fields.Date.context_today(self))
move_line_data['total'] = line.currency_id._convert(line.debit - line.credit, selected_currency, self.env.company, line.date or fields.Date.context_today(self))
else:
move_line_data['debit'] = line.currency_id._convert(line.debit, selected_currency, self.env.company, date_from or fields.Date.context_today(self))
move_line_data['credit'] = line.currency_id._convert(line.credit, selected_currency, self.env.company, date_from or fields.Date.context_today(self))
move_line_data['amount_currency'] = line.currency_id._convert(line.amount_currency, selected_currency, self.env.company, date_from or fields.Date.context_today(self))
move_line_data['total'] = line.currency_id._convert(line.debit - line.credit, selected_currency, self.env.company, date_from or fields.Date.context_today(self))

move_line_list.append(move_line_data)

partner = self.env['res.partner']
if 'partner_id' in line_data[account]:
partner = self.env['res.partner'].browse(line_data[account]['partner_id'][0])
vals = {
'name': line_data[account]['name'],
'account': account.display_name,
'debit': line_data[account]['debit'],
'credit': line_data[account]['credit'],
'amount_currency': line_data[account]['amount_currency'],
'date': line_data[account]['date'],
'partner': partner.display_name,
'lines': move_line_list,
'account_id': account.id,
'model': "account.move.line"
}
move_lines.append(vals)
# currency_id = self.env.company.currency_id
return {
'move_lines': move_lines,
'string': string,
'report_currency_id': selected_currency,
'currency_id': selected_currency.id,
'compare_period': compare_period,
'fold_account_ids': fold_account_ids if fold_account_ids else []
}
0
Avatar
Descartar
Lars Aam

I don't know why you struggle with this. Odoo manage foreign currency very efficient in accounting.

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

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

Registrar-se
Related Posts Respostes Vistes Activitat
Odoo Multicurrency Conceptually
accounting multicurrency
Avatar
1
de maig 23
6654
Doing journal entry in difference currency not auto transferring to main currency
accounting multicurrency
Avatar
Avatar
2
de gen. 23
4482
How to work with currency conversion (multi currency)? Solved
accounting multicurrency
Avatar
Avatar
1
d’ag. 15
8237
"Accounting and Finance" multicurrency supports?
accounting multicurrency
Avatar
Avatar
Avatar
Avatar
3
de març 15
7369
Multi-Currency Partner Ledger Odoo 16
accounting multicurrency partnerledger
Avatar
Avatar
Avatar
Avatar
Avatar
4
de maig 24
4023
Community
  • Tutorials
  • Documentació
  • Fòrum
Codi obert
  • Descarregar
  • GitHub
  • Runbot
  • Traduccions
Serveis
  • Allotjament a Odoo.sh
  • Suport
  • Actualització
  • Desenvolupaments personalitzats
  • Educació
  • Troba un comptable
  • Troba un partner
  • Converteix-te en partner
Sobre nosaltres
  • La nostra empresa
  • Actius de marca
  • Contacta amb nosaltres
  • Llocs de treball
  • Esdeveniments
  • Pòdcast
  • Blog
  • Clients
  • Informació legal • Privacitat
  • Seguretat
الْعَرَبيّة 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 és un conjunt d'aplicacions empresarials de codi obert que cobreix totes les necessitats de la teva empresa: CRM, comerç electrònic, comptabilitat, inventari, punt de venda, gestió de projectes, etc.

La proposta única de valor d'Odoo és ser molt fàcil d'utilitzar i estar totalment integrat, ambdues alhora.

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