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
    • e-learning
    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
    • Conocimientos
    • 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 pub
    • 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
    • Cervecería
    • Regalos de empresas
    Salud y bienestar
    • Club deportivo
    • Óptica
    • Gimnasio
    • Terapeutas
    • Farmacia
    • Peluquería
    Oficios
    • Handyman
    • Hardware y soporte técnico
    • 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
    Explorar todos los sectores
  • 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
    • Servicios para 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

Float, comma as decimal separator and trailing 0

Suscribirse

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

Se marcó esta pregunta
reports
1 Responder
15352 Vistas
Avatar
aydunno

I created a simple report with float numbers which are calculated beforehand in this simple method:


def onchange_value(self, cr, uid, ids, c1 = 0.0, c2 = 0.00, c3 = 0.0, c4 = 0.0, c5 = 0.0, c6 = 0.0, c7 = 0.0, c8 = 0.0, c9 = 0.0, c10 = 0.0, context = None):

cx = (c1 + c2 + c3 + c4 + c5 + c6 + c7 + c8 + c9) * 1.19

c10 = round(cx, 2)

return {'value': { 'c10': c10 }}


the numbers aredeclared in this manner:

'c1': fields.float(string="Betrag 1"),

'c2': fields.float(string="Betrag 2"),

'c3': fields.float(string="Betrag 3"),


and added to the report in this manner: 

<div class="col-xs-2"> <p t-field="o.c1" /> </div>   

<div class="col-xs-2"> <p t-field="o.c2" /> </div>

<div class="col-xs-2"> <p t-field="o.c3" /> </div>


What I try to do and actually have no idea how, is:

Having a comma as a decimal sepataor instead of the dot and the trailing zero need to be displayed.

Any help is much appreciated.

0
Avatar
Descartar
Avatar
Axel Mendoza
Mejor respuesta

For change the decmal separator you can do it in your specific lang on the menu /Settings/Translations/Languages, there is a field called Decimal Separator specifically for that matter

For change the trailing zeros you need to do it directly on the float field by defining the decimal precision like:

Old Api

'rounding': fields.float('Rounding Factor', digits=(12,2)),

New Api

rounding = fields.Float('Rounding Factor', digits=(12,2))

Where (12,2) is the number of digits before and after the decimal separator

2
Avatar
Descartar
aydunno
Autor

you agaibn, thanks!!!!! guess I have to mention you in the credits now :P I will try this out tomorrow. any idea for the trailing zero? My last idea was to modify the downloaded pdf by an external script.

Axel Mendoza

The answer is updated to include the trailing zeros part

aydunno
Autor

got it! remarks on the solution: when trying to accomplish this by changing anything in the code, the leading zero where never displayed, unless using

in stead of field vauel in the report's definition. I solved it by doing both changes in the seetings. 1. the languages settings you pointed out. importatn here is to also change the value of the thousands separator. 2. under settings > technical > database structure > decimal accuracy, create a new entry whith your modules name and the number of digits that should follow the separator. in this way, comma and trainiling zeros are displayed everywhere correctly, especially in the reports.
aydunno
Autor

one part is not displayed: using t-esc="'%.2f'%(o.c2)" instead of t-field value

¿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
Code for page number in Body of Pdf report
reports
Avatar
Avatar
Avatar
2
oct 25
3336
How to increase the width of a column on odoo quotation PDF?
reports
Avatar
Avatar
1
oct 25
1128
Odoo Online (SaaS 18.4 Enterprise) – How to modify invoice report header without affecting other reports but keep default table content
reports
Avatar
Avatar
1
ago 25
1799
Odoo .SH V17 how do I migrate a report from staging to production?
reports
Avatar
Avatar
1
abr 25
2440
List of Sales in a Report
reports
Avatar
Avatar
1
jul 24
2785
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