From b783d2d1c4c54e6f932c90eeecc35c86e1158019 Mon Sep 17 00:00:00 2001 From: Nicolas Lempereur Date: Wed, 27 Jan 2016 08:31:56 +0100 Subject: [PATCH 1/3] [FIX] web: allow view with arabic date saving When editing a form with the arabic language, the date is formatted in arabic. But the version of the Moment.js library we use for this had inconsistencies and parsing the arabic date could not work. Hence, saving would not work since date field values would be invalid. This commit cherry-pick http://momentjs.com/ commits which solves that: from version 1.8.4: https://github.com/moment/moment/commit/c9023b5 from version 1.9.0: https://github.com/moment/moment/commit/bd328d5 closes #10634 opw-660453 --- addons/web/static/lib/moment/locale/af.js | 4 ++++ addons/web/static/lib/moment/locale/ar-sa.js | 6 +++++- addons/web/static/lib/moment/locale/ar.js | 6 +++++- addons/web/static/lib/moment/locale/az.js | 4 ++++ addons/web/static/lib/moment/locale/be.js | 6 ++++-- addons/web/static/lib/moment/locale/bn.js | 4 ++++ addons/web/static/lib/moment/locale/bo.js | 4 ++++ addons/web/static/lib/moment/locale/eo.js | 4 ++++ addons/web/static/lib/moment/locale/fa.js | 4 ++++ addons/web/static/lib/moment/locale/hi.js | 5 +++++ addons/web/static/lib/moment/locale/hu.js | 4 ++++ addons/web/static/lib/moment/locale/hy-am.js | 4 ++++ addons/web/static/lib/moment/locale/id.js | 5 +++++ addons/web/static/lib/moment/locale/ja.js | 4 ++++ addons/web/static/lib/moment/locale/ko.js | 8 ++++---- addons/web/static/lib/moment/locale/ml.js | 4 ++++ addons/web/static/lib/moment/locale/mr.js | 5 +++++ addons/web/static/lib/moment/locale/ms-my.js | 5 +++++ addons/web/static/lib/moment/locale/ne.js | 5 +++++ addons/web/static/lib/moment/locale/sq.js | 4 ++++ addons/web/static/lib/moment/locale/ta.js | 2 ++ addons/web/static/lib/moment/locale/th.js | 4 ++++ addons/web/static/lib/moment/locale/uk.js | 4 ++++ addons/web/static/lib/moment/locale/zh-cn.js | 5 +++++ addons/web/static/lib/moment/locale/zh-tw.js | 5 +++++ 25 files changed, 107 insertions(+), 8 deletions(-) diff --git a/addons/web/static/lib/moment/locale/af.js b/addons/web/static/lib/moment/locale/af.js index 2777e58e77f..ec9533a4b73 100644 --- a/addons/web/static/lib/moment/locale/af.js +++ b/addons/web/static/lib/moment/locale/af.js @@ -17,6 +17,10 @@ weekdays : "Sondag_Maandag_Dinsdag_Woensdag_Donderdag_Vrydag_Saterdag".split("_"), weekdaysShort : "Son_Maa_Din_Woe_Don_Vry_Sat".split("_"), weekdaysMin : "So_Ma_Di_Wo_Do_Vr_Sa".split("_"), + meridiemParse: /vm|nm/i, + isPM : function (input) { + return /^nm$/i.test(input); + }, meridiem : function (hours, minutes, isLower) { if (hours < 12) { return isLower ? 'vm' : 'VM'; diff --git a/addons/web/static/lib/moment/locale/ar-sa.js b/addons/web/static/lib/moment/locale/ar-sa.js index 64e209137ea..7a42d59851c 100644 --- a/addons/web/static/lib/moment/locale/ar-sa.js +++ b/addons/web/static/lib/moment/locale/ar-sa.js @@ -48,6 +48,10 @@ LLL : "D MMMM YYYY LT", LLLL : "dddd D MMMM YYYY LT" }, + meridiemParse: /ص|م/, + isPM : function (input) { + return 'م' === input; + }, meridiem : function (hour, minute, isLower) { if (hour < 12) { return "ص"; @@ -79,7 +83,7 @@ yy : "%d سنوات" }, preparse: function (string) { - return string.replace(/[۰-۹]/g, function (match) { + return string.replace(/[١٢٣٤٥٦٧٨٩٠]/g, function (match) { return numberMap[match]; }).replace(/،/g, ','); }, diff --git a/addons/web/static/lib/moment/locale/ar.js b/addons/web/static/lib/moment/locale/ar.js index 2af64ee3a92..f113199a7b7 100644 --- a/addons/web/static/lib/moment/locale/ar.js +++ b/addons/web/static/lib/moment/locale/ar.js @@ -49,6 +49,10 @@ LLL : "D MMMM YYYY LT", LLLL : "dddd D MMMM YYYY LT" }, + meridiemParse: /ص|م/, + isPM : function (input) { + return 'م' === input; + }, meridiem : function (hour, minute, isLower) { if (hour < 12) { return "ص"; @@ -80,7 +84,7 @@ yy : "%d سنوات" }, preparse: function (string) { - return string.replace(/[۰-۹]/g, function (match) { + return string.replace(/[١٢٣٤٥٦٧٨٩٠]/g, function (match) { return numberMap[match]; }).replace(/،/g, ','); }, diff --git a/addons/web/static/lib/moment/locale/az.js b/addons/web/static/lib/moment/locale/az.js index a6a5aff964e..c4f66f1d2ca 100644 --- a/addons/web/static/lib/moment/locale/az.js +++ b/addons/web/static/lib/moment/locale/az.js @@ -72,6 +72,10 @@ y : "bir il", yy : "%d il" }, + meridiemParse: /gecə|səhər|gündüz|axşam/, + isPM : function (input) { + return /^(gündüz|axşam)$/.test(input); + }, meridiem : function (hour, minute, isLower) { if (hour < 4) { return "gecə"; diff --git a/addons/web/static/lib/moment/locale/be.js b/addons/web/static/lib/moment/locale/be.js index 6e0aef1b8d1..cda5495a19e 100644 --- a/addons/web/static/lib/moment/locale/be.js +++ b/addons/web/static/lib/moment/locale/be.js @@ -113,8 +113,10 @@ y : "год", yy : relativeTimeWithPlural }, - - + meridiemParse: /ночы|раніцы|дня|вечара/, + isPM : function (input) { + return /^(дня|вечара)$/.test(input); + }, meridiem : function (hour, minute, isLower) { if (hour < 4) { return "ночы"; diff --git a/addons/web/static/lib/moment/locale/bn.js b/addons/web/static/lib/moment/locale/bn.js index 8ceb8eb0a4f..947205616d0 100644 --- a/addons/web/static/lib/moment/locale/bn.js +++ b/addons/web/static/lib/moment/locale/bn.js @@ -82,6 +82,10 @@ return symbolMap[match]; }); }, + meridiemParse: /রাত|শকাল|দুপুর|বিকেল|রাত/, + isPM: function (input) { + return /^(দুপুর|বিকেল|রাত)$/.test(input); + }, //Bengali is a vast language its spoken //in different forms in various parts of the world. //I have just generalized with most common one used diff --git a/addons/web/static/lib/moment/locale/bo.js b/addons/web/static/lib/moment/locale/bo.js index f1567abf5ee..0542887aa4b 100644 --- a/addons/web/static/lib/moment/locale/bo.js +++ b/addons/web/static/lib/moment/locale/bo.js @@ -82,6 +82,10 @@ return symbolMap[match]; }); }, + meridiemParse: /མཚན་མོ|ཞོགས་ཀས|ཉིན་གུང|དགོང་དག|མཚན་མོ/, + isPM: function (input) { + return /^(ཉིན་གུང|དགོང་དག|མཚན་མོ)$/.test(input); + }, meridiem : function (hour, minute, isLower) { if (hour < 4) { return "མཚན་མོ"; diff --git a/addons/web/static/lib/moment/locale/eo.js b/addons/web/static/lib/moment/locale/eo.js index 318385b9502..43ce8e40c21 100644 --- a/addons/web/static/lib/moment/locale/eo.js +++ b/addons/web/static/lib/moment/locale/eo.js @@ -26,6 +26,10 @@ LLL : "D[-an de] MMMM, YYYY LT", LLLL : "dddd, [la] D[-an de] MMMM, YYYY LT" }, + meridiemParse: /[ap]\.t\.m/i, + isPM: function (input) { + return input.charAt(0).toLowerCase() === 'p'; + }, meridiem : function (hours, minutes, isLower) { if (hours > 11) { return isLower ? 'p.t.m.' : 'P.T.M.'; diff --git a/addons/web/static/lib/moment/locale/fa.js b/addons/web/static/lib/moment/locale/fa.js index 09c7909514f..af5e3a0e059 100644 --- a/addons/web/static/lib/moment/locale/fa.js +++ b/addons/web/static/lib/moment/locale/fa.js @@ -48,6 +48,10 @@ LLL : 'D MMMM YYYY LT', LLLL : 'dddd, D MMMM YYYY LT' }, + meridiemParse: /قبل از ظهر|بعد از ظهر/, + isPM: function (input) { + return /بعد از ظهر/.test(input); + }, meridiem : function (hour, minute, isLower) { if (hour < 12) { return "قبل از ظهر"; diff --git a/addons/web/static/lib/moment/locale/hi.js b/addons/web/static/lib/moment/locale/hi.js index 6dd7098c27d..eb440d9cdfa 100644 --- a/addons/web/static/lib/moment/locale/hi.js +++ b/addons/web/static/lib/moment/locale/hi.js @@ -84,6 +84,11 @@ }, // Hindi notation for meridiems are quite fuzzy in practice. While there exists // a rigid notion of a 'Pahar' it is not used as rigidly in modern Hindi. + meridiemParse: /रात|सुबह|दोपहर|शाम|रात/, + isPM: function (input) { + // TODO: This is incorrect (look at cutoffs). We need a better isPM interface. + return /^(दोपहर|शाम|रात)$/.test(input); + }, meridiem : function (hour, minute, isLower) { if (hour < 4) { return "रात"; diff --git a/addons/web/static/lib/moment/locale/hu.js b/addons/web/static/lib/moment/locale/hu.js index 910f0868b5a..e695dc94db8 100644 --- a/addons/web/static/lib/moment/locale/hu.js +++ b/addons/web/static/lib/moment/locale/hu.js @@ -62,6 +62,10 @@ LLL : "YYYY. MMMM D., LT", LLLL : "YYYY. MMMM D., dddd LT" }, + meridiemParse: /de|du/i, + isPM: function (input) { + return input.charAt(1).toLowerCase() === 'u'; + }, meridiem : function (hours, minutes, isLower) { if (hours < 12) { return isLower === true ? 'de' : 'DE'; diff --git a/addons/web/static/lib/moment/locale/hy-am.js b/addons/web/static/lib/moment/locale/hy-am.js index b6984a2794a..56ad52db51d 100644 --- a/addons/web/static/lib/moment/locale/hy-am.js +++ b/addons/web/static/lib/moment/locale/hy-am.js @@ -77,6 +77,10 @@ yy : "%d տարի" }, + meridiemParse: /գիշերվա|առավոտվա|ցերեկվա|երեկոյան/, + isPM: function (input) { + return /^(ցերեկվա|երեկոյան)$/.test(input); + }, meridiem : function (hour) { if (hour < 4) { return "գիշերվա"; diff --git a/addons/web/static/lib/moment/locale/id.js b/addons/web/static/lib/moment/locale/id.js index 6043f30a239..ebff3271682 100644 --- a/addons/web/static/lib/moment/locale/id.js +++ b/addons/web/static/lib/moment/locale/id.js @@ -25,6 +25,11 @@ LLL : "D MMMM YYYY [pukul] LT", LLLL : "dddd, D MMMM YYYY [pukul] LT" }, + meridiemParse: /pagi|siang|sore|malam/, + isPM: function (input) { + // TODO: This is incorrect (look at cutoffs). + return /^(siang|sore|malam)$/.test(input); + }, meridiem : function (hours, minutes, isLower) { if (hours < 11) { return 'pagi'; diff --git a/addons/web/static/lib/moment/locale/ja.js b/addons/web/static/lib/moment/locale/ja.js index 34c4b890d8e..2b4a7e7f7bb 100644 --- a/addons/web/static/lib/moment/locale/ja.js +++ b/addons/web/static/lib/moment/locale/ja.js @@ -24,6 +24,10 @@ LLL : "YYYY年M月D日LT", LLLL : "YYYY年M月D日LT dddd" }, + meridiemParse: /午前|午後/i, + isPM : function (input) { + return input === '午後'; + }, meridiem : function (hour, minute, isLower) { if (hour < 12) { return "午前"; diff --git a/addons/web/static/lib/moment/locale/ko.js b/addons/web/static/lib/moment/locale/ko.js index 7de2e51033c..c13cad1daf6 100644 --- a/addons/web/static/lib/moment/locale/ko.js +++ b/addons/web/static/lib/moment/locale/ko.js @@ -27,9 +27,6 @@ LLL : "YYYY년 MMMM D일 LT", LLLL : "YYYY년 MMMM D일 dddd LT" }, - meridiem : function (hour, minute, isUpper) { - return hour < 12 ? '오전' : '오후'; - }, calendar : { sameDay : '오늘 LT', nextDay : '내일 LT', @@ -55,9 +52,12 @@ yy : "%d년" }, ordinal : '%d일', - meridiemParse : /(오전|오후)/, + meridiemParse : /오전|오후/, isPM : function (token) { return token === "오후"; + }, + meridiem : function (hour, minute, isUpper) { + return hour < 12 ? '오전' : '오후'; } }); })); diff --git a/addons/web/static/lib/moment/locale/ml.js b/addons/web/static/lib/moment/locale/ml.js index d3cee1d3f30..2398d3be592 100644 --- a/addons/web/static/lib/moment/locale/ml.js +++ b/addons/web/static/lib/moment/locale/ml.js @@ -47,6 +47,10 @@ y : "ഒരു വർഷം", yy : "%d വർഷം" }, + meridiemParse: /രാത്രി|രാവിലെ|ഉച്ച കഴിഞ്ഞ്|വൈകുന്നേരം|രാത്രി/i, + isPM : function (input) { + return /^(ഉച്ച കഴിഞ്ഞ്|വൈകുന്നേരം|രാത്രി)$/.test(input); + }, meridiem : function (hour, minute, isLower) { if (hour < 4) { return "രാത്രി"; diff --git a/addons/web/static/lib/moment/locale/mr.js b/addons/web/static/lib/moment/locale/mr.js index 8cbfe7cf97d..92a54f087cc 100644 --- a/addons/web/static/lib/moment/locale/mr.js +++ b/addons/web/static/lib/moment/locale/mr.js @@ -82,6 +82,11 @@ return symbolMap[match]; }); }, + meridiemParse: /रात्री|सकाळी|दुपारी|सायंकाळी|रात्री/, + isPM : function (input) { + // TODO: This is wrong. + return /^(दुपारी|सायंकाळी|रात्री)$/.test(input); + }, meridiem: function (hour, minute, isLower) { if (hour < 4) { diff --git a/addons/web/static/lib/moment/locale/ms-my.js b/addons/web/static/lib/moment/locale/ms-my.js index eee412f6bcd..ed6a2e25794 100644 --- a/addons/web/static/lib/moment/locale/ms-my.js +++ b/addons/web/static/lib/moment/locale/ms-my.js @@ -24,6 +24,11 @@ LLL : "D MMMM YYYY [pukul] LT", LLLL : "dddd, D MMMM YYYY [pukul] LT" }, + meridiemParse: /pagi|tengahari|petang|malam/, + isPM: function (input) { + // TODO: This is wrong. + return /^(tengahari|petang|malam)$/.test(input); + }, meridiem : function (hours, minutes, isLower) { if (hours < 11) { return 'pagi'; diff --git a/addons/web/static/lib/moment/locale/ne.js b/addons/web/static/lib/moment/locale/ne.js index 836fb4d476f..9f6d73e3b35 100644 --- a/addons/web/static/lib/moment/locale/ne.js +++ b/addons/web/static/lib/moment/locale/ne.js @@ -59,6 +59,11 @@ return symbolMap[match]; }); }, + meridiemParse: /राती|बिहान|दिउँसो|बेलुका|साँझ|राती/, + isPM : function (input) { + // TODO: This is wrong. + return /^(दिउँसो|बेलुका|साँझ|राती)$/.test(input); + }, meridiem : function (hour, minute, isLower) { if (hour < 3) { return "राती"; diff --git a/addons/web/static/lib/moment/locale/sq.js b/addons/web/static/lib/moment/locale/sq.js index 4a3dfea725a..cf30d684034 100644 --- a/addons/web/static/lib/moment/locale/sq.js +++ b/addons/web/static/lib/moment/locale/sq.js @@ -19,6 +19,10 @@ weekdays : "E Diel_E Hënë_E Martë_E Mërkurë_E Enjte_E Premte_E Shtunë".split("_"), weekdaysShort : "Die_Hën_Mar_Mër_Enj_Pre_Sht".split("_"), weekdaysMin : "D_H_Ma_Më_E_P_Sh".split("_"), + meridiemParse: /PD|MD/, + isPM: function (input) { + return input.charAt(0) === 'M'; + }, meridiem : function (hours, minutes, isLower) { return hours < 12 ? 'PD' : 'MD'; }, diff --git a/addons/web/static/lib/moment/locale/ta.js b/addons/web/static/lib/moment/locale/ta.js index 963d40349f4..441d1fa929e 100644 --- a/addons/web/static/lib/moment/locale/ta.js +++ b/addons/web/static/lib/moment/locale/ta.js @@ -89,6 +89,8 @@ // refer http://ta.wikipedia.org/s/1er1 + // TODO: This is pretty wrong (when hour is equal to 6 10, 14, 18, 20, + // 24 (0). Also it doesn't split at 12 (noon). meridiem : function (hour, minute, isLower) { if (hour >= 6 && hour <= 10) { return " காலை"; diff --git a/addons/web/static/lib/moment/locale/th.js b/addons/web/static/lib/moment/locale/th.js index 30b41e69aa0..447f46ff56e 100644 --- a/addons/web/static/lib/moment/locale/th.js +++ b/addons/web/static/lib/moment/locale/th.js @@ -24,6 +24,10 @@ LLL : "D MMMM YYYY เวลา LT", LLLL : "วันddddที่ D MMMM YYYY เวลา LT" }, + meridiemParse: /ก่อนเที่ยง|หลังเที่ยง/, + isPM: function (input) { + return input === 'หลังเที่ยง'; + }, meridiem : function (hour, minute, isLower) { if (hour < 12) { return "ก่อนเที่ยง"; diff --git a/addons/web/static/lib/moment/locale/uk.js b/addons/web/static/lib/moment/locale/uk.js index f27d9f3e311..0ee509a8e30 100644 --- a/addons/web/static/lib/moment/locale/uk.js +++ b/addons/web/static/lib/moment/locale/uk.js @@ -122,6 +122,10 @@ // M. E.: those two are virtually unused but a user might want to implement them for his/her website for some reason + meridiemParse: /ночі|ранку|дня|вечора/, + isPM: function (input) { + return /^(дня|вечора)$/.test(input); + }, meridiem : function (hour, minute, isLower) { if (hour < 4) { return "ночі"; diff --git a/addons/web/static/lib/moment/locale/zh-cn.js b/addons/web/static/lib/moment/locale/zh-cn.js index e73acd70497..96aac691fee 100644 --- a/addons/web/static/lib/moment/locale/zh-cn.js +++ b/addons/web/static/lib/moment/locale/zh-cn.js @@ -29,6 +29,11 @@ lll : "YYYY年MMMD日LT", llll : "YYYY年MMMD日ddddLT" }, + meridiemParse: /凌晨|早上|上午|中午|下午|晚上/, + isPM: function (input) { + // TODO: This is wrong. + return /^(中午|下午|晚上)$/.test(input); + }, meridiem : function (hour, minute, isLower) { var hm = hour * 100 + minute; if (hm < 600) { diff --git a/addons/web/static/lib/moment/locale/zh-tw.js b/addons/web/static/lib/moment/locale/zh-tw.js index edb1fb9879c..1eea9173074 100644 --- a/addons/web/static/lib/moment/locale/zh-tw.js +++ b/addons/web/static/lib/moment/locale/zh-tw.js @@ -28,6 +28,11 @@ lll : "YYYY年MMMD日LT", llll : "YYYY年MMMD日ddddLT" }, + meridiemParse: /早上|上午|中午|下午|晚上/, + isPM: function (input) { + // TODO: This is wrong. + return /^(中午|下午|晚上)$/.test(input); + }, meridiem : function (hour, minute, isLower) { var hm = hour * 100 + minute; if (hm < 900) { From e522a112f8f7600dd8f7bd1238b1d9b9eee1387e Mon Sep 17 00:00:00 2001 From: Nicolas Lempereur Date: Wed, 27 Jan 2016 10:14:04 +0100 Subject: [PATCH 2/3] [FIX] website_slides: demo video is dead --- addons/website_slides/data/website_slides_demo.xml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/addons/website_slides/data/website_slides_demo.xml b/addons/website_slides/data/website_slides_demo.xml index 881f51d51bc..7867a0115b5 100644 --- a/addons/website_slides/data/website_slides_demo.xml +++ b/addons/website_slides/data/website_slides_demo.xml @@ -73,14 +73,6 @@ - - OpenERP POS Indiegogo Campaign - https://www.youtube.com/watch?v=C_Laaz4mORg - - - - - Odoo Marketing - part 1: ATTRACT https://www.youtube.com/watch?v=qhSCMShJkTY&list=UUkQPikELWZFLgQNHd73jkdg From 48639d486f71f1561d6278354829a05a88617130 Mon Sep 17 00:00:00 2001 From: Nicolas Lempereur Date: Wed, 27 Jan 2016 10:18:55 +0100 Subject: [PATCH 3/3] [IMP] website_slides: update demo url and revert e522a11 --- addons/website_slides/data/website_slides_demo.xml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/addons/website_slides/data/website_slides_demo.xml b/addons/website_slides/data/website_slides_demo.xml index 7867a0115b5..b64fb3883c2 100644 --- a/addons/website_slides/data/website_slides_demo.xml +++ b/addons/website_slides/data/website_slides_demo.xml @@ -73,6 +73,14 @@ + + OpenERP POS Indiegogo Campaign + https://www.youtube.com/watch?v=kZpbj34s1-w + + + + + Odoo Marketing - part 1: ATTRACT https://www.youtube.com/watch?v=qhSCMShJkTY&list=UUkQPikELWZFLgQNHd73jkdg