Se rendre au contenu
Odoo Menu
  • Se connecter
  • Essai gratuit
  • Applications
    Finance
    • Comptabilité
    • Facturation
    • Notes de frais
    • Feuilles de calcul (BI)
    • Documents
    • Signature
    Ventes
    • CRM
    • Ventes
    • PdV Boutique
    • PdV Restaurant
    • Abonnements
    • Location
    Sites web
    • Site Web
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Chaîne d'approvisionnement
    • Inventaire
    • Fabrication
    • PLM
    • Achats
    • Maintenance
    • Qualité
    Ressources Humaines
    • Employés
    • Recrutement
    • Congés
    • Évaluations
    • Recommandations
    • Parc automobile
    Marketing
    • Marketing Social
    • E-mail Marketing
    • SMS Marketing
    • Événements
    • Marketing Automation
    • Sondages
    Services
    • Projet
    • Feuilles de temps
    • Services sur Site
    • Assistance
    • Planification
    • Rendez-vous
    Productivité
    • Discussion
    • Validations
    • Internet des Objets
    • VoIP
    • Connaissances
    • WhatsApp
    Applications tierces Odoo Studio Plateforme Cloud d'Odoo
  • Industries
    Commerce de détail
    • Librairie
    • Magasin de vêtements
    • Magasin de meubles
    • Épicerie
    • Quincaillerie
    • Magasin de jouets
    Food & Hospitality
    • Bar et Pub
    • Restaurant
    • Fast-food
    • Maison d’hôtes
    • Distributeur de boissons
    • Hôtel
    Immobilier
    • Agence immobilière
    • Cabinet d'architecture
    • Construction
    • Gestion immobilière
    • Jardinage
    • Association de copropriétaires
    Consultance
    • Cabinet d'expertise comptable
    • Partenaire Odoo
    • Agence Marketing
    • Cabinet d'avocats
    • Aquisition de talents
    • Audit & Certification
    Fabrication
    • Textile
    • Métal
    • Meubles
    • Alimentation
    • Brewery
    • Cadeaux d'entreprise
    Santé & Fitness
    • Club de sports
    • Opticien
    • Salle de fitness
    • Praticiens bien-être
    • Pharmacie
    • Salon de coiffure
    Trades
    • Bricoleur
    • Matériel informatique et support
    • Systèmes photovoltaïques
    • Cordonnier
    • Services de nettoyage
    • Services CVC
    Autres
    • Organisation à but non lucratif
    • Agence environnementale
    • Location de panneaux d'affichage
    • Photographie
    • Leasing de vélos
    • Revendeur de logiciel
    Browse all Industries
  • Communauté
    Apprenez
    • Tutoriels
    • Documentation
    • Certifications
    • Formation
    • Blog
    • Podcast
    Renforcer l'éducation
    • Programme éducatif
    • Business Game Scale-Up!
    • Rendez-nous visite
    Obtenir le logiciel
    • Téléchargement
    • Comparez les éditions
    • Versions
    Collaborer
    • Github
    • Forum
    • Événements
    • Traductions
    • Devenez partenaire
    • Services for Partners
    • Enregistrer votre cabinet comptable
    Nos Services
    • Trouver un partenaire
    • Trouver un comptable
    • Rencontrer un conseiller
    • Services de mise en œuvre
    • Références clients
    • Assistance
    • Mises à niveau
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Obtenir une démonstration
  • Tarification
  • Aide

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

  • CRM
  • e-Commerce
  • Comptabilité
  • Inventaire
  • PoS
  • Projet
  • MRP
All apps
Vous devez être inscrit pour interagir avec la communauté.
Toutes les publications Personnes Badges
Étiquettes (Voir toutl)
odoo accounting v14 pos v15
À propos de ce forum
Vous devez être inscrit pour interagir avec la communauté.
Toutes les publications Personnes Badges
Étiquettes (Voir toutl)
odoo accounting v14 pos v15
À propos de ce forum
Aide

How can I show integers measured fields instead floats in graph views in Odoo 8?

S'inscrire

Recevez une notification lorsqu'il y a de l'activité sur ce poste

Cette question a été signalée
viewsgraphodooodoo8
13713 Vues
Avatar
Pepiño

Hi Odoo developers,


In graph views, the measured fields are shown as floats by default instead of integers. How can I show them as integers?.

For instance, in the CRM module, I have a graph for opportunities which show the expected revenue in the x-axis and the opportunity stage in y.axis. The expected revenue is shown as a float (e.g 60,000.0). How can I show the expected revenue as an integer (e.g 60,000 instead of 60,000.0).

Thanks.

Version Odoo: Odoo 8

OS: Ubuntu 14.04


EDIT:

Here is my own example.

The Session model:

class Session(models.Model):
_name = 'openacademy.session'
name = fields.Char(required=True)
start_date = fields.Date(default=fields.Date.today())
end_date = fields.Date(string="End Date", store=True,
compute='_get_end_date', inverse='_set_end_date')
duration = fields.Float(digits=(3, 0), help="Duración en días")
seats = fields.Integer(string="Seats")
percent_taken_seats = fields.Float(string='Percentage of taken seats', compute='_taken_seats_percentage')
instructor_id = fields.Many2one('res.partner', ondelete='set null',
domain=['|', ('instructor', '=', True),
('category_id.name', 'ilike', 'Teacher')])
course_id = fields.Many2one('openacademy.course', ondelete='cascade')
attendees = fields.Many2many('res.partner', string='Attendees')
num_of_attendees = fields.Integer(string="Number of attendees", compute="_get_num_attendees", store=True)
active = fields.Boolean(default=True)
hours = fields.Integer(string="Duration in hours", compute='_get_hours')
color = fields.Integer()

...

@api.one @api.depends('attendees') def _get_num_attendees(self): self.num_of_attendees = len(self.attendees)

Part of the view:

<record model="ir.ui.view" id="session_graph_view">
<field name="name">session.graph</field>
<field name="model">openacademy.session</field>
<field name="arch" type="xml">
<graph string="Session graph" type="bar">
<field name="course_id"/>
<field name="num_of_attendees" type="measure"/>
<field name="duration" type="measure"/>
</graph>
</field>
</record>

Although the 'num_of_attendees' is a integer field in Session model, in the graph view it is shown as a float number. For instance, instead of showing 60 attendees (num_of_attendees=60), 60.00 is shown in the bar graph.


0
Avatar
Ignorer
Yenthe Van Ginneken (Mainframe Monkey)

Just curious, why don't you convert all the numbers to integers for the graphs in place as doubles? Or do you absolutely need double's everywhere?

Pepiño
Auteur

@Yenthe, about the CRM incorporated in Odoo by default, I don't know where I should realize the conversion from float to integer for the 'expected revenue' field. Anyway, I suspect that some kind of conversion to float is realized from the client side (in JavaScript). I say this because I have built a test module where I have a computed integer field (named num_of_attendees) in a module name Session (a course session), and this field is shown like a decimal in a graph view. class Session(models.Model): _name = 'openacademy.session' num_of_attendees = fields.Integer(string="Number of attendees", compute="_get_num_attendees", store=True) attendees = fields.Many2many('res.partner', string='Attendees') @api.one @api.depends('attendees') def _get_num_attendees(self): self.num_of_attendees = len(self.attendees) session.graph openacademy.session

Yenthe Van Ginneken (Mainframe Monkey)

@Eduardo the field 'expected revenue' can be found in the CRM module in your Python file (see https://github.com/odoo/odoo/blob/b74d830eb299c6d672c58f3b53410dde37608a5f/addons/crm/report/crm_lead_report.py#L53). You could *try* to change this to an integer in place of a float, but only do this on a test server because I'm not sure if the graphs etc absolutely need a double or not!

Pepiño
Auteur

Thank you for your help @Yenth. I would prefer not to modify the core of the CRM module. But the problem is not only in CRM module. I have edited my original post to present my own example.

Vous appréciez la discussion ? Ne vous contentez pas de lire, rejoignez-nous !

Créez un compte dès aujourd'hui pour profiter de fonctionnalités exclusives et échanger avec notre formidable communauté !

S'inscrire
Publications associées Réponses Vues Activité
what is the use of operator="+" in graph
views xml graph odoo
Avatar
Avatar
1
avr. 22
6167
How does line item display as kanban mode on mobile device Résolu
views odoo
Avatar
Avatar
Avatar
2
juil. 22
7791
Create a dynamic form view Résolu
views form dynamic odoo odoo8
Avatar
Avatar
Avatar
3
oct. 21
25397
How to view a graph in odoo if using matplotlib
views graph odoo odooV13 matplotlib
Avatar
0
mars 21
3578
How to add a benchmark line in Odoo Graph View
graph odoo8
Avatar
0
oct. 17
4540
Communauté
  • Tutoriels
  • Documentation
  • Forum
Open Source
  • Téléchargement
  • Github
  • Runbot
  • Traductions
Services
  • Hébergement Odoo.sh
  • Assistance
  • Migration
  • Développements personnalisés
  • Éducation
  • Trouver un comptable
  • Trouver un partenaire
  • Devenez partenaire
À propos
  • Notre société
  • Actifs de la marque
  • Contactez-nous
  • Emplois
  • Événements
  • Podcast
  • Blog
  • Clients
  • Informations légales • Confidentialité
  • Sécurité.
الْعَرَبيّة 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 est une suite d'applications open source couvrant tous les besoins de votre entreprise : CRM, eCommerce, Comptabilité, Inventaire, Point de Vente, Gestion de Projet, etc.

Le positionnement unique d'Odoo est d'être à la fois très facile à utiliser et totalement intégré.

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