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

Multi currency

Suscribirse

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

Se marcó esta pregunta
accountingmulticurrencyodooV17
1615 Vistas
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.

¿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
Odoo Multicurrency Conceptually
accounting multicurrency
Avatar
1
may 23
6616
Doing journal entry in difference currency not auto transferring to main currency
accounting multicurrency
Avatar
Avatar
2
ene 23
4455
How to work with currency conversion (multi currency)? Resuelto
accounting multicurrency
Avatar
Avatar
1
ago 15
8194
"Accounting and Finance" multicurrency supports?
accounting multicurrency
Avatar
Avatar
Avatar
Avatar
3
mar 15
7341
Multi-Currency Partner Ledger Odoo 16
accounting multicurrency partnerledger
Avatar
Avatar
Avatar
Avatar
Avatar
4
may 24
3989
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