Passa al contenuto
Odoo Menu
  • Accedi
  • Provalo gratis
  • App
    Finanze
    • Contabilità
    • Fatturazione
    • Note spese
    • Fogli di calcolo (BI)
    • Documenti
    • Firma
    Vendite
    • CRM
    • Vendite
    • Punto vendita Negozio
    • Punto vendita Ristorante
    • Abbonamenti
    • Noleggi
    Siti web
    • Configuratore sito web
    • E-commerce
    • Blog
    • Forum
    • Live chat
    • E-learning
    Supply chain
    • Magazzino
    • Produzione
    • PLM
    • Acquisti
    • Manutenzione
    • Qualità
    Risorse umane
    • Dipendenti
    • Assunzioni
    • Ferie
    • Valutazioni
    • Referral dipendenti
    • Parco veicoli
    Marketing
    • Social marketing
    • E-mail marketing
    • SMS marketing
    • Eventi
    • Marketing automation
    • Sondaggi
    Servizi
    • Progetti
    • Fogli ore
    • Assistenza sul campo
    • Helpdesk
    • Pianificazione
    • Appuntamenti
    Produttività
    • Comunicazioni
    • Approvazioni
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    App di terze parti Odoo Studio Piattaforma cloud Odoo
  • Settori
    Retail
    • Libreria
    • Negozio di abbigliamento
    • Negozio di arredamento
    • Alimentari
    • Ferramenta
    • Negozio di giocattoli
    Cibo e ospitalità
    • Bar e pub
    • Ristorante
    • Fast food
    • Pensione
    • Grossista di bevande
    • Hotel
    Agenzia immobiliare
    • Agenzia immobiliare
    • Studio di architettura
    • Edilizia
    • Gestione immobiliare
    • Impresa di giardinaggio
    • Associazione di proprietari immobiliari
    Consulenza
    • Società di contabilità
    • Partner Odoo
    • Agenzia di marketing
    • Studio legale
    • Selezione del personale
    • Audit e certificazione
    Produzione
    • Tessile
    • Metallo
    • Arredamenti
    • Alimentare
    • Birrificio
    • Ditta di regalistica aziendale
    Benessere e sport
    • Club sportivo
    • Negozio di ottica
    • Centro fitness
    • Centro benessere
    • Farmacia
    • Parrucchiere
    Commercio
    • Tuttofare
    • Hardware e assistenza IT
    • Ditta di installazione di pannelli solari
    • Calzolaio
    • Servizi di pulizia
    • Servizi di climatizzazione
    Altro
    • Organizzazione non profit
    • Ente per la tutela ambientale
    • Agenzia di cartellonistica pubblicitaria
    • Studio fotografico
    • Punto noleggio di biciclette
    • Rivenditore di software
    Carica tutti i settori
  • Community
    Apprendimento
    • Tutorial
    • Documentazione
    • Certificazioni 
    • Formazione
    • Blog
    • Podcast
    Potenzia la tua formazione
    • Programma educativo
    • Scale Up! Business Game
    • Visita Odoo
    Ottieni il software
    • Scarica
    • Versioni a confronto
    • Note di versione
    Collabora
    • Github
    • Forum
    • Eventi
    • Traduzioni
    • Diventa nostro partner
    • Servizi per partner
    • Registra la tua società di contabilità
    Ottieni servizi
    • Trova un partner
    • Trova un contabile
    • Incontra un esperto
    • Servizi di implementazione
    • Testimonianze dei clienti
    • Supporto
    • Aggiornamenti
    GitHub Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Richiedi una demo
  • Prezzi
  • Aiuto

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

  • CRM
  • e-Commerce
  • Contabilità
  • Magazzino
  • PoS
  • Progetti
  • MRP
All apps
È necessario essere registrati per interagire con la community.
Tutti gli articoli Persone Badge
Etichette (Mostra tutto)
odoo accounting v14 pos v15
Sul forum
È necessario essere registrati per interagire con la community.
Tutti gli articoli Persone Badge
Etichette (Mostra tutto)
odoo accounting v14 pos v15
Sul forum
Assistenza

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

Iscriviti

Ricevi una notifica quando c'è un'attività per questo post

La domanda è stata contrassegnata
viewsgraphodooodoo8
13714 Visualizzazioni
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
Abbandona
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
Autore

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

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.

Ti stai godendo la conversazione? Non leggere soltanto, partecipa anche tu!

Crea un account oggi per scoprire funzionalità esclusive ed entrare a far parte della nostra fantastica community!

Registrati
Post correlati Risposte Visualizzazioni Attività
what is the use of operator="+" in graph
views xml graph odoo
Avatar
Avatar
1
apr 22
6167
How does line item display as kanban mode on mobile device Risolto
views odoo
Avatar
Avatar
Avatar
2
lug 22
7792
Create a dynamic form view Risolto
views form dynamic odoo odoo8
Avatar
Avatar
Avatar
3
ott 21
25397
How to view a graph in odoo if using matplotlib
views graph odoo odooV13 matplotlib
Avatar
0
mar 21
3578
How to add a benchmark line in Odoo Graph View
graph odoo8
Avatar
0
ott 17
4540
Community
  • Tutorial
  • Documentazione
  • Forum
Open source
  • Scarica
  • Github
  • Runbot
  • Traduzioni
Servizi
  • Hosting Odoo.sh
  • Supporto
  • Aggiornamenti
  • Sviluppi personalizzati
  • Formazione
  • Trova un contabile
  • Trova un partner
  • Diventa nostro partner
Chi siamo
  • La nostra azienda
  • Branding
  • Contattaci
  • Lavora con noi
  • Eventi
  • Podcast
  • Blog
  • Clienti
  • Note legali • Privacy
  • Sicurezza
الْعَرَبيّة 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 è un gestionale di applicazioni aziendali open source pensato per coprire tutte le esigenze della tua azienda: CRM, Vendite, E-commerce, Magazzino, Produzione, Fatturazione elettronica, Project Management e molto altro.

Il punto di forza di Odoo è quello di offrire un ecosistema unico di app facili da usare, intuitive e completamente integrate tra loro.

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