Odoo Help


How to change unit of events duration ?

Anne-Sylvie Burri
on 9/30/13, 6:58 AM 1,237 views


I want to change the display of the duration of an event in the tree view of crm.meeting . Currently the duration is displayed in hours and i want it to be displayed in days.

Any help is appreciated.

Anne-Sylvie Burri
On 9/30/13, 10:01 AM

Find it.

I use a functional field "duration_in_day" whose the value is equal to the duration field's / 24.

Here is my code :

class crm_meeting(osv.osv): 
    def compute_duration_in_day(self, cr, uid, ids, field_name, field_value, arg, context=None):
        records = self.browse(cr, uid, ids)
        result = {}
        for r in records:
            flt = 0.0
            if r.duration: flt = r.duration / 24
            result[r.id] = flt
        return result

    _inherit = 'crm.meeting'
    _name = 'crm.meeting'
    _columns = {
        'duration_in_day': fields.function(compute_duration_in_day, type='float', string='Durée en jours'),


However i don't think it's optimised.

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.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

0 follower(s)


Asked: 9/30/13, 6:58 AM
Seen: 1237 times
Last updated: 3/16/15, 8:10 AM