From f994797896e767e489b88d3e8644cd95f62d848b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?William=20Beltr=C3=A1n?= Date: Fri, 4 May 2012 12:23:03 -0500 Subject: [PATCH 1/3] [FIX]: Bug #942894 This fix the format.js file to make openerp show a count of ids instead the list of them in 2om relationship. lp bug: https://launchpad.net/bugs/942894 fixed bzr revid: wbeltran@infostudio.com.ec-20120504172303-r4pynkj4vofeptk5 --- addons/web/static/src/js/formats.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/addons/web/static/src/js/formats.js b/addons/web/static/src/js/formats.js index 640ba4d5a93..834a73fac2a 100644 --- a/addons/web/static/src/js/formats.js +++ b/addons/web/static/src/js/formats.js @@ -134,6 +134,10 @@ instance.web.format_value = function (value, descriptor, value_if_empty) { case 'many2one': // name_get value format return value[1]; + case 'one2many': + // this is to show count of ids related in this o2m relation instead the list of them for example will show this:(5) instead of this 1,2,5,8,76 + count_ids='('+value.length.toString()+')' + return count_ids; case 'datetime': if (typeof(value) == "string") value = instance.web.auto_str_to_date(value); From 1e041011fd76d6318f2e6ed1e90fcb3dbec3ada7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?William=20Beltr=C3=A1n?= Date: Fri, 4 May 2012 14:30:27 -0500 Subject: [PATCH 2/3] Changes accordig to quality code. bzr revid: wbeltran@infostudio.com.ec-20120504193027-0u94nwfbbitoa2zc --- addons/web/static/src/js/formats.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/web/static/src/js/formats.js b/addons/web/static/src/js/formats.js index 834a73fac2a..5bb5e461fce 100644 --- a/addons/web/static/src/js/formats.js +++ b/addons/web/static/src/js/formats.js @@ -136,7 +136,7 @@ instance.web.format_value = function (value, descriptor, value_if_empty) { return value[1]; case 'one2many': // this is to show count of ids related in this o2m relation instead the list of them for example will show this:(5) instead of this 1,2,5,8,76 - count_ids='('+value.length.toString()+')' + count_ids = '('+value.length.toString()+')' return count_ids; case 'datetime': if (typeof(value) == "string") From 9e5290e997afff6a9bbfa0096d7b0cd26ec3e102 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?William=20Beltr=C3=A1n?= Date: Tue, 15 May 2012 08:24:06 -0500 Subject: [PATCH 3/3] Changed the way of show the result in case of many2many and one2many fields according to xmo@openerp.com tips. bzr revid: wbeltran@infostudio.com.ec-20120515132406-950ekkzyi3nq7jmp --- addons/web/static/src/js/formats.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/web/static/src/js/formats.js b/addons/web/static/src/js/formats.js index 5bb5e461fce..93126d7b8c9 100644 --- a/addons/web/static/src/js/formats.js +++ b/addons/web/static/src/js/formats.js @@ -135,9 +135,9 @@ instance.web.format_value = function (value, descriptor, value_if_empty) { // name_get value format return value[1]; case 'one2many': - // this is to show count of ids related in this o2m relation instead the list of them for example will show this:(5) instead of this 1,2,5,8,76 - count_ids = '('+value.length.toString()+')' - return count_ids; + return _.str.sprintf(_t("(%d records)"), value.length); + case 'many2many': + return _.str.sprintf(_t("(%d records)"), value.length); case 'datetime': if (typeof(value) == "string") value = instance.web.auto_str_to_date(value);