Odoo Help

0

How to change unit of events duration ?

By
Anne-Sylvie Burri
on 9/30/13, 6:58 AM 954 views

Hello,

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.

0
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'),
    }

crm_meeting()

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.

Register

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)

Stats

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