summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/fields/field_utils.js
diff options
context:
space:
mode:
authorOlivier Dony <odo@openerp.com>2017-05-16 18:23:03 +0200
committerOlivier Dony <odo@openerp.com>2017-05-16 18:23:15 +0200
commit5f4db9df6640100302ab7967344e12ab877089cb (patch)
tree934f0ceb590fb72846c12cb046d96ff609554951 /addons/web/static/src/js/fields/field_utils.js
parentcbca7e13132fe807ac918d9b3c2fcbbb3a12a103 (diff)
parent5afe894f440eff3b58134d14fa7c9b43b19fe88b (diff)
[MERGE] Forward-port saas-16 up to 5afe894f440eff3b58134d14fa7c9b43b19fe88b
Diffstat (limited to 'addons/web/static/src/js/fields/field_utils.js')
-rw-r--r--addons/web/static/src/js/fields/field_utils.js14
1 files changed, 10 insertions, 4 deletions
diff --git a/addons/web/static/src/js/fields/field_utils.js b/addons/web/static/src/js/fields/field_utils.js
index 9a683954e7e..ed3014d9bb6 100644
--- a/addons/web/static/src/js/fields/field_utils.js
+++ b/addons/web/static/src/js/fields/field_utils.js
@@ -71,7 +71,7 @@ function formatChar(value) {
* @returns {string}
*/
function formatDate(value, field, options) {
- if (!value) {
+ if (value === false) {
return "";
}
if (!options || !('timezone' in options) || options.timezone) {
@@ -96,7 +96,7 @@ function formatDate(value, field, options) {
* @returns {string}
*/
function formatDateTime(value, field, options) {
- if (!value) {
+ if (value === false) {
return "";
}
if (!options || !('timezone' in options) || options.timezone) {
@@ -113,7 +113,7 @@ function formatDateTime(value, field, options) {
* Returns a string representing a float. The result takes into account the
* user settings (to display the correct decimal separator).
*
- * @param {float} value the value that should be formatted
+ * @param {float|false} value the value that should be formatted
* @param {Object} [field] a description of the field (returned by fields_get
* for example). It may contain a description of the number of digits that
* should be used.
@@ -124,6 +124,9 @@ function formatDateTime(value, field, options) {
* @returns {string}
*/
function formatFloat(value, field, options) {
+ if (value === false) {
+ return "";
+ }
var l10n = core._t.database.parameters;
var precision;
if (options && options.digits) {
@@ -213,7 +216,7 @@ function formatX2Many(value) {
* Returns a string representing a monetary value. The result takes into account
* the user settings (to display the correct decimal separator, currency, ...).
*
- * @param {float} value the value that should be formatted
+ * @param {float|false} value the value that should be formatted
* @param {Object} [field]
* a description of the field (returned by fields_get for example). It
* may contain a description of the number of digits that should be used.
@@ -238,6 +241,9 @@ function formatX2Many(value) {
* @returns {string}
*/
function formatMonetary(value, field, options) {
+ if (value === false) {
+ return "";
+ }
options = options || {};
var currency = options.currency;