Odoo is the world's easiest all-in-one management software. It includes hundreds of business apps:
CRM | e-Commerce | Accounting | Inventory | PoS | Project management | MRP | etc.
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).
Version Odoo: Odoo 8
OS: Ubuntu 14.04
Here is my own example.
The Session 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,
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="arch" type="xml">
<graph string="Session graph" type="bar">
<field name="num_of_attendees" type="measure"/>
<field name="duration" type="measure"/>
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.
Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!
About This Community
This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.Register
Odoo Training Center
Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.Test it now
|Asked: 5/5/15, 10:38 PM|
|Seen: 2163 times|
|Last updated: 5/6/15, 1:38 PM|