Merge lp:~openerp-dev/openerp-web/trunk-bug-885289-vda into lp:openerp-web

Proposed by Vaibhav Darji
Status: Rejected
Rejected by: Xavier (Open ERP)
Proposed branch: lp:~openerp-dev/openerp-web/trunk-bug-885289-vda
Merge into: lp:openerp-web
Diff against target: 36 lines (+15/-4)
1 file modified
addons/web/static/src/js/formats.js (+15/-4)
To merge this branch: bzr merge lp:~openerp-dev/openerp-web/trunk-bug-885289-vda
Reviewer Review Type Date Requested Status
Xavier (Open ERP) (community) Needs Fixing
Review via email: mp+81702@code.launchpad.net

Description of the change

Through exception on unmatched date patern while formating.

To post a comment you must log in.
Revision history for this message
Xavier (Open ERP) (xmo-deactivatedaccount) wrote :

This leads to displaying stuff, but it displays the wrong stuff:

* read_group groups by *month* (and year), and displays a value of the year and month as the group title, this patch changes to displaying a day as well. The day is *not* correct, you will have dates of e.g. "11/10/2011" under the group "01/11/2011"
* read_group returns a preformatted group title, this breaks it

review: Needs Fixing

Unmerged revisions

1419. By Vaibhav Darji

[FIX] web failed unmatched date format. format using Date.parse directly in case.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'addons/web/static/src/js/formats.js'
--- addons/web/static/src/js/formats.js 2011-10-27 12:54:48 +0000
+++ addons/web/static/src/js/formats.js 2011-11-09 10:34:12 +0000
@@ -41,8 +41,14 @@
41 // name_get value format41 // name_get value format
42 return value[1];42 return value[1];
43 case 'datetime':43 case 'datetime':
44 if (typeof(value) == "string")44 if (typeof(value) == "string") {
45 value = openerp.web.auto_str_to_date(value);45 try {
46 value = openerp.web.auto_str_to_date(value);
47 } catch(e) {
48 value = Date.parse(value);
49 }
50 }
51
46 try {52 try {
47 return value.toString(_.sprintf("%s %s", Date.CultureInfo.formatPatterns.shortDate,53 return value.toString(_.sprintf("%s %s", Date.CultureInfo.formatPatterns.shortDate,
48 Date.CultureInfo.formatPatterns.longTime));54 Date.CultureInfo.formatPatterns.longTime));
@@ -51,8 +57,13 @@
51 }57 }
52 return value;58 return value;
53 case 'date':59 case 'date':
54 if (typeof(value) == "string")60 if (typeof(value) == "string") {
55 value = openerp.web.auto_str_to_date(value);61 try {
62 value = openerp.web.auto_str_to_date(value);
63 } catch(e) {
64 value = Date.parse(value);
65 }
66 }
56 try {67 try {
57 return value.toString(Date.CultureInfo.formatPatterns.shortDate);68 return value.toString(Date.CultureInfo.formatPatterns.shortDate);
58 } catch (e) {69 } catch (e) {