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

Float field Round up

Suscribirse

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

Se marcó esta pregunta
odoo
6 Respuestas
25749 Vistas
Avatar
RDS EPOS SOLUTIONS

Hi I have a float filed and if the value is 2.17 I want to round up to 3. So always round up 1?

I cant comment but below will not work becasue I only want to round up. Below will round up and down. I belive I need to use math.ceil 
but cant find any examples


from odoo.tools import float_round
round(field_name
0
Avatar
Descartar
Manish Bohra

But it’s working for me like when value is 3.45 than it’s show 3 and if value js 3.51 than it will be show 4

JAVIER LIROLA

Hello. Did you solved? how you did it? i want to print values rounded up (ceiling) but I don´t know how to do it. In my case is just for PDF purpouses. Thanks

Avatar
Manish Bohra
Mejor respuesta

Hello Jay Roy,

You can try below code i think it's help you.

from odoo.tools import float_round
round(field_name)
5
Avatar
Descartar
Avatar
Pankaj Goyani
Mejor respuesta

Hi Jay Roy,

You just need to do simple things which is giving odoo default.
This is a better way of doing it than hard coding as I can change the decimals to any figure from Odoo GUI under

 Technical >> Database Structure >> Decimal Accuracy >>
Change Digits 0 instead of 2 or 3.


Ex. Before Quantity display: 1.00 or 1.000

       After Quantity display: 1

Thanks.

3
Avatar
Descartar
Avatar
Jithin PP
Mejor respuesta

You can do like this in qweb

<p><t t-esc="round(6.2/9,2)"/></p>

3
Avatar
Descartar
Avatar
Rakesh Vadeghar
Mejor respuesta

Hey try this 

x = 2.1

y = float(int(round(x)))

print x,y

if x > y:

        x = y+1

        print x,y

elif x == y:

        pass

0
Avatar
Descartar
Avatar
RDS EPOS SOLUTIONS
Autor Mejor respuesta

 I always want to want to round up. So 3.45 will become 4.

3.1 will be 4.

7.1 will be 8

Always up to the next never down. I read somewhere I need to be using math.ceil. reading up on that now
I also seen below trying to figure out how to use it though. I tried

from openerp.tools.float_utils  import float_round 

rolls_required = fields.float_round("Rolls Required", precision_digits=1, rounding_method='UP')

But I get TypeError: unsupported operand type(s) for /: 'str' and 'float'


// function for rounding numbers
from openerp.tools.float_utils import float_round // importing
// value - float number
// precision_digits - number of fractional digits to round to
// precision_rounding - decimal number representing the minimum non-zero value at the desired precision
// rounding_method - can be 'HALF-UP' or 'UP'
value1 = float_round(10.005, precision_digits=2, precision_rounding=None, rounding_method='HALF-UP')
value2 = float_round(10.005, precision_digits=None, precision_rounding=2, rounding_method='HALF-UP')
value3 = float_round(10.005, precision_digits=2, precision_rounding=None, rounding_method='UP')
value4 = float_round(10.005, precision_digits=None, precision_rounding=2, rounding_method='UP')
0
Avatar
Descartar
¿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
error while rendering the template website_sale.product_title after upgrading to Odoo 19
odoo
Avatar
0
dic 25
8
We are using Odoo POS (v19) for a wholesale / cash & carry business.
odoo
Avatar
0
dic 25
118
Odoo installatie
odoo
Avatar
Avatar
1
dic 25
235
How Odoo Help Businesses??
odoo
Avatar
0
dic 25
253
Odoo Studio Many2one field not appearing in automations
odoo
Avatar
Avatar
1
dic 25
424
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.

Sitio web hecho con

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