Skip to Content
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odgovori
3668 Prikazi

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
Opusti
Best Answer

Did you had the solution?


Avatar
Opusti
Related Posts Odgovori Prikazi Aktivnost
2
maj 22
2354
1
avg. 23
2983
0
maj 23
3232
1
jan. 23
8029
3
jul. 21
5300