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

Multi currency

Suscribirse

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

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

Registrarse
Publicaciones relacionadas Respuestas Vistas Actividad
Odoo Multicurrency Conceptually
accounting multicurrency
Avatar
1
may 23
6651
Doing journal entry in difference currency not auto transferring to main currency
accounting multicurrency
Avatar
Avatar
2
ene 23
4480
How to work with currency conversion (multi currency)? Resuelto
accounting multicurrency
Avatar
Avatar
1
ago 15
8232
"Accounting and Finance" multicurrency supports?
accounting multicurrency
Avatar
Avatar
Avatar
Avatar
3
mar 15
7366
Multi-Currency Partner Ledger Odoo 16
accounting multicurrency partnerledger
Avatar
Avatar
Avatar
Avatar
Avatar
4
may 24
4019
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