Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
1 Răspunde
5946 Vizualizări

How can i overwrite date function in field_utils.js

this is the code


odoo.define('web.field_utils', function (require) {
"use strict";
/**
Returns a string representing a date. If the value is false, then we return
an empty string. Note that this is dependant on the localization settings
@param {Moment|false} value
@param {Object} [field]
a description of the field (note: this parameter is ignored)
@param {Object} [options] additional options
@param {boolean} [options.timezone=true] use the user timezone when formating the
date
@returns {string}
*/
function formatDate(value, field, options) {
if (value === false) {
return "";
}
if (field && field.type === 'datetime') {
if (!options || !('timezone' in options) || options.timezone) {
value = value.clone().add(session.getTZOffset(value), 'minutes');
}
}
var date_format = time.getLangDateFormat();
return value.format(date_format);
}
}



i'll be happy to hear an answer soon.


Imagine profil
Abandonează
Cel mai bun răspuns
odoo.define('custom.field_utils.date', function (require) {
"use strict";
// override Datetime function 
var field_utils = require('web.field_utils');  

function MyCustomformatDate(value, field, options) {    
    console.log('Overrided format Date');
    // Copy original function with your modification
}
field_utils.format.date = MyCustomformatDate; });
Imagine profil
Abandonează
Related Posts Răspunsuri Vizualizări Activitate
2
aug. 19
9549
1
mai 24
1867
0
iul. 22
1806
2
sept. 21
15550
1
iun. 20
4841