This question has been flagged

Hello,

I want to override parseFloatTime() method of field_utils.js in web module odoo14. For that i have followed to links:-

link1

link2

but not getting override in my custom module.

Also here is my code which i have tried following the above links:-


odoo.define('custom_module_name.field_utils.float_time', function (require) {

"use strict";

// override float_time function

var field_utils = require('web.field_utils');


function parseFloatTime(value) {

    var factor = 1;

    if (value[0] === '-') {

        value = value.slice(1);

        factor = -1;

    }

    if(value){

    var float_time_pair = value.split(":");

    if (float_time_pair.length !== 2)

        return factor * parseFloat(value);

    var hours = parseInteger(float_time_pair[0]);

    var minutes = parseInteger(float_time_pair[1]);

    return factor * (hours + (minutes / 60));

    }

}


field_utils.parse.float_time = parseFloatTime;

});


So can anyone help me on this problem please?

Avatar
Discard
Best Answer

Did you had the solution?


Avatar
Discard