Skip to Content
Odoo Meniu
  • Autentificare
  • Try it free
  • Aplicații
    Finanțe
    • Contabilitate
    • Facturare
    • Cheltuieli
    • Spreadsheet (BI)
    • Documente
    • Semn
    Vânzări
    • CRM
    • Vânzări
    • POS Shop
    • POS Restaurant
    • Abonamente
    • Închiriere
    Site-uri web
    • Constructor de site-uri
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Lanț Aprovizionare
    • Inventar
    • Producție
    • PLM
    • Achiziție
    • Maintenance
    • Calitate
    Resurse Umane
    • Angajați
    • Recrutare
    • Time Off
    • Evaluări
    • Referințe
    • Flotă
    Marketing
    • Social Marketing
    • Marketing prin email
    • SMS Marketing
    • Evenimente
    • Automatizare marketing
    • Sondaje
    Servicii
    • Proiect
    • Foi de pontaj
    • Servicii de teren
    • Centru de asistență
    • Planificare
    • Programări
    Productivitate
    • Discuss
    • Aprobări
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Aplicații Terțe Odoo Studio Platforma Odoo Cloud
  • Industrii
    Retail
    • Book Store
    • Magazin de îmbrăcăminte
    • Magazin de Mobilă
    • Magazin alimentar
    • Magazin de materiale de construcții
    • Magazin de jucării
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Distribuitor de băuturi
    • Hotel
    Proprietate imobiliara
    • Real Estate Agency
    • Firmă de Arhitectură
    • Construcție
    • Estate Managament
    • Grădinărit
    • Asociația Proprietarilor de Proprietăți
    Consultanta
    • Firma de Contabilitate
    • Partener Odoo
    • Agenție de marketing
    • Law firm
    • Atragere de talente
    • Audit & Certification
    Producție
    • Textil
    • Metal
    • Mobilier
    • Mâncare
    • Brewery
    • Cadouri corporate
    Health & Fitness
    • Club Sportiv
    • Magazin de ochelari
    • Centru de Fitness
    • Wellness Practitioners
    • Farmacie
    • Salon de coafură
    Trades
    • Handyman
    • IT Hardware and Support
    • Asigurare socială de stat
    • Cizmar
    • Servicii de curățenie
    • HVAC Services
    Altele
    • Organizație nonprofit
    • Agenție de Mediu
    • Închiriere panouri publicitare
    • Fotografie
    • Închiriere biciclete
    • Asigurare socială
    Browse all Industries
  • Comunitate
    Învăță
    • Tutorials
    • Documentație
    • Certificări
    • Instruire
    • Blog
    • Podcast
    Empower Education
    • Program Educațional
    • Scale Up! Business Game
    • Visit Odoo
    Obține Software-ul
    • Descărcare
    • Compară Edițiile
    • Lansări
    Colaborați
    • Github
    • Forum
    • Evenimente
    • Translations
    • Devino Partener
    • Services for Partners
    • Înregistrează-ți Firma de Contabilitate
    Obține Servicii
    • Găsește un Partener
    • Găsiți un contabil
    • Meet an advisor
    • Servicii de Implementare
    • Referințe ale clienților
    • Suport
    • Actualizări
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Obține un demo
  • Prețuri
  • Ajutor

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

  • CRM
  • e-Commerce
  • Contabilitate
  • Inventar
  • PoS
  • Proiect
  • MRP
All apps
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
All Posts Oameni Insigne
Etichete (View all)
odoo accounting v14 pos v15
Despre acest forum
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
All Posts Oameni Insigne
Etichete (View all)
odoo accounting v14 pos v15
Despre acest forum
Suport

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

Abonare

Primiți o notificare când există activitate la acestă postare

Această întrebare a fost marcată
viewsgraphodooodoo8
13712 Vizualizări
Imagine profil
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
Imagine profil
Abandonează
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
Autor

@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
Autor

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.

Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Înscrie-te
Related Posts Răspunsuri Vizualizări Activitate
what is the use of operator="+" in graph
views xml graph odoo
Imagine profil
Imagine profil
1
apr. 22
6167
How does line item display as kanban mode on mobile device Rezolvat
views odoo
Imagine profil
Imagine profil
Imagine profil
2
iul. 22
7791
Create a dynamic form view Rezolvat
views form dynamic odoo odoo8
Imagine profil
Imagine profil
Imagine profil
3
oct. 21
25397
How to view a graph in odoo if using matplotlib
views graph odoo odooV13 matplotlib
Imagine profil
0
mar. 21
3578
How to add a benchmark line in Odoo Graph View
graph odoo8
Imagine profil
0
oct. 17
4540
Comunitate
  • Tutorials
  • Documentație
  • Forum
Open Source
  • Descărcare
  • Github
  • Runbot
  • Translations
Servicii
  • Hosting Odoo.sh
  • Suport
  • Actualizare
  • Custom Developments
  • Educație
  • Găsiți un contabil
  • Găsește un Partener
  • Devino Partener
Despre Noi
  • Compania noastră
  • Active de marcă
  • Contactați-ne
  • Locuri de muncă
  • Evenimente
  • Podcast
  • Blog
  • Clienți
  • Aspecte juridice • Confidențialitate
  • Securitate
الْعَرَبيّة 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 este o suită de aplicații de afaceri open source care acoperă toate nevoile companiei dvs.: CRM, comerț electronic, contabilitate, inventar, punct de vânzare, management de proiect etc.

Propunerea de valoare unică a Odoo este să fie în același timp foarte ușor de utilizat și complet integrat.

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