diff options
| author | Minh Tran <mit@openerp.com> | 2012-09-06 16:53:26 +0200 |
|---|---|---|
| committer | Minh Tran <mit@openerp.com> | 2012-09-06 16:53:26 +0200 |
| commit | 60ba6f83bf5ad3a55785ee8f4440be3a5bbeae7f (patch) | |
| tree | 2c7cb8c10c7ddee303a1996001e1c1c61100d86e /addons/web/static/src | |
| parent | 7761a0f603e90fa833d6f6c2abdd806d98fd9cc6 (diff) | |
| parent | 8562bb1ef722512dab46e47079773fa037145a5e (diff) | |
merge from trunk
bzr revid: mit@openerp.com-20120906145110-l9sndgilivxo0on1
bzr revid: mit@openerp.com-20120906145326-8ykppthhs25xo5d4
Diffstat (limited to 'addons/web/static/src')
| -rw-r--r-- | addons/web/static/src/css/Makefile | 2 | ||||
| -rw-r--r-- | addons/web/static/src/css/base.css | 302 | ||||
| -rw-r--r-- | addons/web/static/src/css/base.sass | 317 | ||||
| -rw-r--r-- | addons/web/static/src/js/corelib.js | 6 | ||||
| -rw-r--r-- | addons/web/static/src/js/coresetup.js | 25 | ||||
| -rw-r--r-- | addons/web/static/src/js/view_form.js | 67 | ||||
| -rw-r--r-- | addons/web/static/src/js/view_list.js | 21 | ||||
| -rw-r--r-- | addons/web/static/src/js/view_list_editable.js | 29 | ||||
| -rw-r--r-- | addons/web/static/src/js/views.js | 161 | ||||
| -rw-r--r-- | addons/web/static/src/xml/base.xml | 40 |
10 files changed, 486 insertions, 484 deletions
diff --git a/addons/web/static/src/css/Makefile b/addons/web/static/src/css/Makefile index eca044497ef..d6b4f4b2fc8 100644 --- a/addons/web/static/src/css/Makefile +++ b/addons/web/static/src/css/Makefile @@ -1,3 +1,3 @@ base.css: base.sass - sass -t expanded base.sass base.css + sass --trace -t expanded base.sass base.css diff --git a/addons/web/static/src/css/base.css b/addons/web/static/src/css/base.css index 846c62f64b4..03898f25d78 100644 --- a/addons/web/static/src/css/base.css +++ b/addons/web/static/src/css/base.css @@ -20,50 +20,6 @@ font-style: normal; } -@-moz-keyframes bounce { - 0% { - -moz-transform: scale(0); - opacity: 0; - } - - 50% { - -moz-transform: scale(1.3); - opacity: 0.4; - } - - 75% { - -moz-transform: scale(0.9); - opacity: 0.7; - } - - 100% { - -moz-transform: scale(1); - opacity: 1; - } -} - -@-webkit-keyframes bounce { - 0% { - -webkit-transform: scale(0); - opacity: 0; - } - - 50% { - -webkit-transform: scale(1.3); - opacity: 0.4; - } - - 75% { - -webkit-transform: scale(0.9); - opacity: 0.7; - } - - 100% { - -webkit-transform: scale(1); - opacity: 1; - } -} - @media print { .oe_topbar, .oe_leftbar, .oe_loading { display: none !important; @@ -141,13 +97,6 @@ background-image: -o-linear-gradient(top, #eeeeee, #dedede); background-image: linear-gradient(to bottom, #eeeeee, #dedede); } -.openerp ul, .openerp li, .openerp ol { - margin: 0; - padding: 0; -} -.openerp li { - list-style-type: none; -} .openerp input, .openerp textarea, .openerp select { padding: 2px 4px; border: 1px solid #cccccc; @@ -162,6 +111,28 @@ .openerp h4 { margin: 4px 0; } +.openerp .oe_semantic_html_override ul, .openerp .oe_semantic_html_override ol { + margin: 0; + padding: 0; +} +.openerp .oe_semantic_html_override ul ul, .openerp .oe_semantic_html_override ul ol, .openerp .oe_semantic_html_override ul li, .openerp .oe_semantic_html_override ol ul, .openerp .oe_semantic_html_override ol ol, .openerp .oe_semantic_html_override ol li { + margin: 0; + padding: 0; +} +.openerp .oe_semantic_html_override ul li, .openerp .oe_semantic_html_override ol li { + list-style-type: none; +} +.openerp ul.oe_semantic_html_override { + margin: 0; + padding: 0; +} +.openerp ul.oe_semantic_html_override ul, .openerp ul.oe_semantic_html_override ol, .openerp ul.oe_semantic_html_override li { + margin: 0; + padding: 0; +} +.openerp ul.oe_semantic_html_override li { + list-style-type: none; +} .openerp a.button:link, .openerp a.button:visited, .openerp button, .openerp input[type='submit'], .openerp .ui-dialog-buttonpane .ui-dialog-buttonset .ui-button { display: inline-block; border: 1px solid #ababab; @@ -237,6 +208,9 @@ .openerp .ui-widget-content a { color: #7c7bad; } +.openerp .oe_bounce_container { + display: inline-block; +} .openerp.ui-dialog { display: none; padding: 6px; @@ -518,9 +492,9 @@ padding: 0; margin: 0; background: none; - -moz-border-radius: none; - -webkit-border-radius: none; - border-radius: none; + -moz-border-radius: 0; + -webkit-border-radius: 0; + border-radius: 0; -moz-box-shadow: none; -webkit-box-shadow: none; box-shadow: none; @@ -533,9 +507,9 @@ padding: 0; margin: 0; background: none; - -moz-border-radius: none; - -webkit-border-radius: none; - border-radius: none; + -moz-border-radius: 0; + -webkit-border-radius: 0; + border-radius: 0; -moz-box-shadow: none; -webkit-box-shadow: none; box-shadow: none; @@ -628,6 +602,26 @@ padding: 0 16px; list-style: none; zoom: 1; + margin: 0; + padding: 0; +} +.openerp .oe_notebook ul, .openerp .oe_notebook ol, .openerp .oe_notebook li { + margin: 0; + padding: 0; +} +.openerp .oe_notebook li { + list-style-type: none; +} +.openerp .oe_notebook ul, .openerp .oe_notebook ol { + margin: 0; + padding: 0; +} +.openerp .oe_notebook ul ul, .openerp .oe_notebook ul ol, .openerp .oe_notebook ul li, .openerp .oe_notebook ol ul, .openerp .oe_notebook ol ol, .openerp .oe_notebook ol li { + margin: 0; + padding: 0; +} +.openerp .oe_notebook ul li, .openerp .oe_notebook ol li { + list-style-type: none; } .openerp .oe_notebook.ui-corner-all { -moz-border-radius: 0; @@ -932,6 +926,17 @@ -webkit-box-shadow: 0 0 18px rgba(0, 0, 0, 0.9); box-shadow: 0 0 18px rgba(0, 0, 0, 0.9); } +.openerp .oe_login .oe_login_pane ul, .openerp .oe_login .oe_login_pane ol { + margin: 0; + padding: 0; +} +.openerp .oe_login .oe_login_pane ul ul, .openerp .oe_login .oe_login_pane ul ol, .openerp .oe_login .oe_login_pane ul li, .openerp .oe_login .oe_login_pane ol ul, .openerp .oe_login .oe_login_pane ol ol, .openerp .oe_login .oe_login_pane ol li { + margin: 0; + padding: 0; +} +.openerp .oe_login .oe_login_pane ul li, .openerp .oe_login .oe_login_pane ol li { + list-style-type: none; +} .openerp .oe_login .oe_login_pane h2 { margin-top: 0; font-size: 18px; @@ -1011,6 +1016,17 @@ background-image: -o-linear-gradient(top, #646060, #262626); background-image: linear-gradient(to bottom, #646060, #262626); } +.openerp .oe_topbar ul, .openerp .oe_topbar ol { + margin: 0; + padding: 0; +} +.openerp .oe_topbar ul ul, .openerp .oe_topbar ul ol, .openerp .oe_topbar ul li, .openerp .oe_topbar ol ul, .openerp .oe_topbar ol ol, .openerp .oe_topbar ol li { + margin: 0; + padding: 0; +} +.openerp .oe_topbar ul li, .openerp .oe_topbar ol li { + list-style-type: none; +} .openerp .oe_topbar .oe_topbar_item { display: block; padding: 5px 10px 7px; @@ -1083,6 +1099,17 @@ text-shadow: 0 1px 1px white; padding-bottom: 16px; } +.openerp .oe_leftbar ul, .openerp .oe_leftbar ol { + margin: 0; + padding: 0; +} +.openerp .oe_leftbar ul ul, .openerp .oe_leftbar ul ol, .openerp .oe_leftbar ul li, .openerp .oe_leftbar ol ul, .openerp .oe_leftbar ol ol, .openerp .oe_leftbar ol li { + margin: 0; + padding: 0; +} +.openerp .oe_leftbar ul li, .openerp .oe_leftbar ol li { + list-style-type: none; +} .openerp a.oe_logo { width: 220px; display: block; @@ -1175,16 +1202,16 @@ width: 100%; display: inline-block; } -.openerp .oe_secondary_submenu > li { +.openerp .oe_secondary_submenu li { position: relative; - padding: 1px 0 1px 20px; + padding: 1px 0 1px 20px !important; } -.openerp .oe_secondary_submenu > li a { +.openerp .oe_secondary_submenu li a { display: block; color: #4c4c4c; padding: 2px 4px 2px 0; } -.openerp .oe_secondary_submenu > li .oe_menu_label { +.openerp .oe_secondary_submenu li .oe_menu_label { position: absolute; top: 1px; right: 1px; @@ -1289,6 +1316,16 @@ width: 100%; table-layout: fixed; } +.openerp .oe_view_manager table.oe_view_manager_header ul { + padding: 0; + margin-right: 0; + margin-top: 0; + margin-bottom: 0; +} +.openerp .oe_view_manager table.oe_view_manager_header ul li { + list-style-type: none; + margin: 0; +} .openerp .oe_view_manager table.oe_view_manager_header .oe_header_row { clear: both; text-shadow: 0 1px 1px white; @@ -1398,11 +1435,15 @@ color: white; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4); } +.openerp .oe_view_manager .oe_view_manager_switch { + margin-left: 8px; +} .openerp .oe_view_manager .oe_view_manager_switch li { text-align: center; width: 24px; height: 24px; line-height: 16px; + padding: 0; } .openerp .oe_view_manager .oe_view_manager_switch li a { position: relative; @@ -1934,6 +1975,35 @@ margin: -16px -16px 0 -16px; padding: 8px; } +.openerp .oe_form_sheetbg { + padding: 8px 0; +} +.openerp .oe_form_sheet_width { + min-width: 650px; + max-width: 860px; + margin: 0 auto; +} +.openerp .oe_form_sheet { + background: white; + min-height: 330px; + padding: 16px; +} +.openerp .oe_application .oe_form_sheetbg { + background: url(/web/static/src/img/form_sheetbg.png); + border-bottom: 1px solid #dddddd; +} +.openerp .oe_application .oe_form_sheet { + border: 1px solid #afafb6; + -moz-box-shadow: 0 0 10px rgba(0, 0, 0, 0.3); + -webkit-box-shadow: 0 0 10px rgba(0, 0, 0, 0.3); + box-shadow: 0 0 10px rgba(0, 0, 0, 0.3); +} +.openerp .oe_application .oe_form_sheet .ui-tabs { + margin: 0 -16px; +} +.openerp .oe_application .oe_form_sheet .oe_notebook_page { + padding: 0 16px; +} .openerp .oe_form header { position: relative; border-bottom: 1px solid #cacaca; @@ -1964,7 +2034,7 @@ max-width: 650px; margin: 0 0 10px 0; } -.openerp .oe_form div.oe_form_configuration p { +.openerp .oe_form div.oe_form_configuration p, .openerp .oe_form div.oe_form_configuration ul, .openerp .oe_form div.oe_form_configuration ol { color: #aaaaaa; max-width: 650px; } @@ -1977,11 +2047,11 @@ .openerp .oe_form div.oe_form_configuration .oe_form_group_cell div div { padding: 1px 0; } -.openerp ul.oe_form_steps, .openerp ul.oe_form_steps_clickable { +.openerp .oe_form ul.oe_form_steps, .openerp .oe_form ul.oe_form_steps_clickable { display: inline-block; padding-right: 18px; } -.openerp ul.oe_form_steps li, .openerp ul.oe_form_steps_clickable li { +.openerp .oe_form ul.oe_form_steps li, .openerp .oe_form ul.oe_form_steps_clickable li { display: inline-block; margin-right: -20px; background-color: #fcfcfc; @@ -1992,20 +2062,20 @@ background-image: -o-linear-gradient(top, #fcfcfc, #dedede); background-image: linear-gradient(to bottom, #fcfcfc, #dedede); } -.openerp ul.oe_form_steps li:first-child .label, .openerp ul.oe_form_steps_clickable li:first-child .label { +.openerp .oe_form ul.oe_form_steps li:first-child .label, .openerp .oe_form ul.oe_form_steps_clickable li:first-child .label { border-left: 1px solid #cacaca; padding-left: 14px; } -.openerp ul.oe_form_steps li:last-child, .openerp ul.oe_form_steps_clickable li:last-child { +.openerp .oe_form ul.oe_form_steps li:last-child, .openerp .oe_form ul.oe_form_steps_clickable li:last-child { border-right: 1px solid #cacaca; } -.openerp ul.oe_form_steps li:last-child .label, .openerp ul.oe_form_steps_clickable li:last-child .label { +.openerp .oe_form ul.oe_form_steps li:last-child .label, .openerp .oe_form ul.oe_form_steps_clickable li:last-child .label { padding-right: 14px; } -.openerp ul.oe_form_steps li:last-child .arrow, .openerp ul.oe_form_steps_clickable li:last-child .arrow { +.openerp .oe_form ul.oe_form_steps li:last-child .arrow, .openerp .oe_form ul.oe_form_steps_clickable li:last-child .arrow { display: none; } -.openerp ul.oe_form_steps li .label, .openerp ul.oe_form_steps_clickable li .label { +.openerp .oe_form ul.oe_form_steps li .label, .openerp .oe_form ul.oe_form_steps_clickable li .label { color: #4c4c4c; text-shadow: 0 1px 1px #fcfcfc, 0 -1px 1px #dedede; padding: 7px; @@ -2014,14 +2084,14 @@ margin: 0; position: relative; } -.openerp ul.oe_form_steps li .arrow, .openerp ul.oe_form_steps_clickable li .arrow { +.openerp .oe_form ul.oe_form_steps li .arrow, .openerp .oe_form ul.oe_form_steps_clickable li .arrow { width: 17px; display: inline-block; vertical-align: top; overflow: hidden; margin-left: -5px; } -.openerp ul.oe_form_steps li .arrow span, .openerp ul.oe_form_steps_clickable li .arrow span { +.openerp .oe_form ul.oe_form_steps li .arrow span, .openerp .oe_form ul.oe_form_steps_clickable li .arrow span { position: relative; width: 24px; height: 24px; @@ -2036,12 +2106,13 @@ -moz-border-radius: 3px; -webkit-border-radius: 3px; border-radius: 3px; - -moz-transform: rotate(45deg); -webkit-transform: rotate(45deg); - -o-transform: rotate(45deg); + -moz-transform: rotate(45deg); -ms-transform: rotate(45deg); + -o-transform: rotate(45deg); + transform: rotate(45deg); } -.openerp ul.oe_form_steps li.oe_active, .openerp ul.oe_form_steps_clickable li.oe_active { +.openerp .oe_form ul.oe_form_steps li.oe_active, .openerp .oe_form ul.oe_form_steps_clickable li.oe_active { background-color: #729fcf; background-image: -webkit-gradient(linear, left top, left bottom, from(#729fcf), to(#3465a4)); background-image: -webkit-linear-gradient(top, #729fcf, #3465a4); @@ -2050,20 +2121,20 @@ background-image: -o-linear-gradient(top, #729fcf, #3465a4); background-image: linear-gradient(to bottom, #729fcf, #3465a4); } -.openerp ul.oe_form_steps li.oe_active .arrow span, .openerp ul.oe_form_steps_clickable li.oe_active .arrow span { +.openerp .oe_form ul.oe_form_steps li.oe_active .arrow span, .openerp .oe_form ul.oe_form_steps_clickable li.oe_active .arrow span { background-color: #3465a4; background: -moz-linear-gradient(135deg, #3465a4, #729fcf); background: -o-linear-gradient(135deg, #729fcf, #3465a4); background: -webkit-gradient(linear, left top, right bottom, from(#729fcf), to(#3465a4)); } -.openerp ul.oe_form_steps li.oe_active .label, .openerp ul.oe_form_steps_clickable li.oe_active .label { +.openerp .oe_form ul.oe_form_steps li.oe_active .label, .openerp .oe_form ul.oe_form_steps_clickable li.oe_active .label { color: white; text-shadow: 0 1px 1px #729fcf, 0 -1px 1px #3465a4; } -.openerp ul.oe_form_steps_clickable li { +.openerp .oe_form ul.oe_form_steps_clickable li { cursor: pointer; } -.openerp ul.oe_form_steps_clickable li:hover { +.openerp .oe_form ul.oe_form_steps_clickable li:hover { background-color: #e8e8e8; background-image: -webkit-gradient(linear, left top, left bottom, from(#e8e8e8), to(#cacaca)); background-image: -webkit-linear-gradient(top, #e8e8e8, #cacaca); @@ -2072,10 +2143,10 @@ background-image: -o-linear-gradient(top, #e8e8e8, #cacaca); background-image: linear-gradient(to bottom, #e8e8e8, #cacaca); } -.openerp ul.oe_form_steps_clickable li:hover .label { +.openerp .oe_form ul.oe_form_steps_clickable li:hover .label { text-shadow: 0 -1px 1px #fcfcfc, 0 1px 1px #dedede; } -.openerp ul.oe_form_steps_clickable li:hover .arrow span { +.openerp .oe_form ul.oe_form_steps_clickable li:hover .arrow span { background-color: #e8e8e8; background-image: -webkit-gradient(linear, left top, left bottom, from(#e8e8e8), to(#cacaca)); background-image: -webkit-linear-gradient(top, #e8e8e8, #cacaca); @@ -2084,10 +2155,10 @@ background-image: -o-linear-gradient(top, #e8e8e8, #cacaca); background-image: linear-gradient(to bottom, #e8e8e8, #cacaca); } -.openerp ul.oe_form_steps_clickable li .label { +.openerp .oe_form ul.oe_form_steps_clickable li .label { color: #7c7bad; } -.openerp ul.oe_form_steps_clickable li.oe_active:hover { +.openerp .oe_form ul.oe_form_steps_clickable li.oe_active:hover { background-color: #4c85c2; background-image: -webkit-gradient(linear, left top, left bottom, from(#4c85c2), to(#284d7d)); background-image: -webkit-linear-gradient(top, #4c85c2, #284d7d); @@ -2096,10 +2167,10 @@ background-image: -o-linear-gradient(top, #4c85c2, #284d7d); background-image: linear-gradient(to bottom, #4c85c2, #284d7d); } -.openerp ul.oe_form_steps_clickable li.oe_active:hover .label { +.openerp .oe_form ul.oe_form_steps_clickable li.oe_active:hover .label { text-shadow: 0 -1px 1px #729fcf, 0 1px 1px #3465a4; } -.openerp ul.oe_form_steps_clickable li.oe_active:hover .arrow span { +.openerp .oe_form ul.oe_form_steps_clickable li.oe_active:hover .arrow span { background-color: #284d7d; background: -moz-linear-gradient(135deg, #284d7d, #4c85c2); background: -o-linear-gradient(135deg, #4c85c2, #284d7d); @@ -2131,31 +2202,6 @@ .openerp .oe_form .oe_subtotal_footer label.oe_form_label_help { font-weight: normal; } -.openerp .oe_application .oe_form_sheetbg { - background: url(/web/static/src/img/form_sheetbg.png); - padding: 8px 0; - border-bottom: 1px solid #dddddd; -} -.openerp .oe_application .oe_form_sheet_width { - min-width: 650px; - max-width: 860px; - margin: 0 auto; -} -.openerp .oe_application .oe_form_sheet { - background: white; - min-height: 330px; - padding: 16px; - border: 1px solid #afafb6; - -moz-box-shadow: 0 0 10px rgba(0, 0, 0, 0.3); - -webkit-box-shadow: 0 0 10px rgba(0, 0, 0, 0.3); - box-shadow: 0 0 10px rgba(0, 0, 0, 0.3); -} -.openerp .oe_application .oe_form_sheet .ui-tabs { - margin: 0 -16px; -} -.openerp .oe_application .oe_form_sheet .oe_notebook_page { - padding: 0 16px; -} .openerp .oe_form .oe_form_button { margin: 2px; } @@ -2271,7 +2317,7 @@ -ms-box-sizing: border-box; box-sizing: border-box; background: white; - min-width: 70px; + min-width: 60px; color: #1f1f1f; } .openerp .oe_form input[readonly], .openerp .oe_form select[readonly], .openerp .oe_form textarea[readonly], .openerp .oe_form input[disabled], .openerp .oe_form select[disabled] { @@ -2417,6 +2463,28 @@ .openerp.ui-autocomplete li:not(.oe_m2o_dropdown_option) + li.oe_m2o_dropdown_option { margin-top: 10px; } +.openerp .oe_form_field_status { + margin: 0; + padding: 0; +} +.openerp .oe_form_field_status ul, .openerp .oe_form_field_status ol { + margin: 0; + padding: 0; +} +.openerp .oe_form_field_status ul ul, .openerp .oe_form_field_status ul ol, .openerp .oe_form_field_status ul li, .openerp .oe_form_field_status ol ul, .openerp .oe_form_field_status ol ol, .openerp .oe_form_field_status ol li { + margin: 0; + padding: 0; +} +.openerp .oe_form_field_status ul li, .openerp .oe_form_field_status ol li { + list-style-type: none; +} +.openerp .oe_form_field_status ul, .openerp .oe_form_field_status ol, .openerp .oe_form_field_status li { + margin: 0; + padding: 0; +} +.openerp .oe_form_field_status li { + list-style-type: none; +} .openerp .oe_form .oe_form_field_one2many > .oe_view_manager .oe_list_pager_single_page { display: none; } @@ -2481,10 +2549,11 @@ height: 27px; } .openerp .oe_list.oe_list_editable.oe_editing .oe_form_field input, .openerp .oe_list.oe_list_editable.oe_editing .oe_form_field textarea { + -moz-border-radius: 0; + -webkit-border-radius: 0; + border-radius: 0; border: 1px solid #aaaaff; - border-radius: 0px; - margin: 0px; - -webkit-border-radius: 0px; + margin: 0; } .openerp .oe_list.oe_list_editable.oe_editing .oe_form_field textarea { height: 60px; @@ -2593,6 +2662,7 @@ cursor: pointer; } .openerp .oe_list_content > tbody > tr { + height: 27px; border-top: 1px solid #dddddd; } .openerp .oe_list_content > tbody > tr > td.oe_list_field_cell { @@ -2655,6 +2725,12 @@ content: "ö"; color: #404040; } +.openerp .oe_list_cannot_edit .oe_list_header_handle, .openerp .oe_list_cannot_edit .oe_list_field_handle { + display: none !important; +} +.openerp .oe_list_cannot_delete .oe_list_record_delete { + display: none !important; +} .openerp .tree_header { background-color: #f0f0f0; border-bottom: 1px solid #cacaca; diff --git a/addons/web/static/src/css/base.sass b/addons/web/static/src/css/base.sass index 1991052180c..65146407e54 100644 --- a/addons/web/static/src/css/base.sass +++ b/addons/web/static/src/css/base.sass @@ -36,7 +36,7 @@ $sheet-max-width: 860px padding: 0 margin: 0 background: none - @include radius(none) + @include radius(0) @include box-shadow(none) @mixin vertical-gradient($startColor: #555, $endColor: #333) @@ -95,10 +95,23 @@ $sheet-max-width: 860px background: -webkit-gradient(linear, left top, right bottom, from($startColor), to($endColor)) @mixin transform($transform) - -moz-transform: $transform -webkit-transform: $transform - -o-transform: $transform + -moz-transform: $transform -ms-transform: $transform + -o-transform: $transform + transform: $transform + +@mixin keyframes($name) + @-webkit-keyframes #{$name} + @content + @-moz-keyframes #{$name} + @content + @-ms-keyframes #{$name} + @content + @-o-keyframes #{$name} + @content + @keyframes #{$name} + @content // Transforms the (readable) text of an inline element into an mmlicons icon, // allows for actual readable text in-code (and in readers?) with iconic looks @@ -111,35 +124,19 @@ $sheet-max-width: 860px content: $icon-name color: $color -// }}} -// CSS animation bounces {{{ -@-moz-keyframes bounce - 0% - -moz-transform: scale(0) - opacity: 0 - 50% - -moz-transform: scale(1.3) - opacity: 0.4 - 75% - -moz-transform: scale(0.9) - opacity: 0.7 - 100% - -moz-transform: scale(1) - opacity: 1 +@mixin ul-html-override() + margin: 0 + padding: 0 + ul, ol, li + margin: 0 + padding: 0 + li + list-style-type: none + +@mixin semantic-html-override() + ul, ol + @include ul-html-override() -@-webkit-keyframes bounce - 0% - -webkit-transform: scale(0) - opacity: 0 - 50% - -webkit-transform: scale(1.3) - opacity: 0.4 - 75% - -webkit-transform: scale(0.9) - opacity: 0.7 - 100% - -webkit-transform: scale(1) - opacity: 1 // }}} @media print @@ -194,11 +191,6 @@ $sheet-max-width: 860px @include vertical-gradient(#f0f0fa, #eeeef6) .zebra tbody tr:hover td @include vertical-gradient(#eee, #dedede) - ul, li, ol - margin: 0 - padding: 0 - li - list-style-type: none input, textarea, select padding: 2px 4px border: 1px solid #ccc @@ -208,6 +200,10 @@ $sheet-max-width: 860px vertical-align: middle h4 margin: 4px 0 + .oe_semantic_html_override + @include semantic-html-override + ul.oe_semantic_html_override + @include ul-html-override // }}} // Button style {{{ a.button:link, a.button:visited, button, input[type='submit'], .ui-dialog-buttonpane .ui-dialog-buttonset .ui-button @@ -251,6 +247,8 @@ $sheet-max-width: 860px // Jquery ui Overrides {{{ .ui-widget-content a color: $link-color + .oe_bounce_container + display: inline-block // Modal box &.ui-dialog @@ -511,6 +509,8 @@ $sheet-max-width: 860px padding: 0 16px list-style: none zoom: 1 + @include ul-html-override + @include semantic-html-override .oe_notebook.ui-corner-all @include radius(0) .oe_notebook:before, .oe_notebook:after @@ -730,6 +730,7 @@ $sheet-max-width: 860px text-align: left @include radius(8px) @include box-shadow(0 0 18px rgba(0, 0, 0, 0.9)) + @include semantic-html-override h2 margin-top: 0 font-size: 18px @@ -795,6 +796,7 @@ $sheet-max-width: 860px height: 31px border-top: solid 1px #d3d3d3 @include vertical-gradient(#646060, #262626) + @include semantic-html-override .oe_topbar_item display: block padding: 5px 10px 7px @@ -845,6 +847,7 @@ $sheet-max-width: 860px border-right: 1px solid $tag-border text-shadow: 0 1px 1px white padding-bottom: 16px + @include semantic-html-override a.oe_logo width: 220px display: block @@ -922,9 +925,9 @@ $sheet-max-width: 860px margin: 0 width: 100% display: inline-block - > li + li position: relative - padding: 1px 0 1px 20px + padding: 1px 0 1px 20px !important a display: block color: #4c4c4c @@ -1010,6 +1013,14 @@ $sheet-max-width: 860px table.oe_view_manager_header width: 100% table-layout: fixed + ul + padding: 0 + margin-right: 0 + margin-top: 0 + margin-bottom: 0 + li + list-style-type: none + margin: 0 .oe_header_row //min-height: 26px //line-height: 26px @@ -1094,11 +1105,13 @@ $sheet-max-width: 860px // }}} // ViewManager.switches {{{ .oe_view_manager_switch + margin-left: 8px li text-align: center width: 24px height: 24px line-height: 16px + padding: 0 a position: relative .oe_vm_switch_list:after, .oe_vm_switch_tree:after @@ -1499,11 +1512,34 @@ $sheet-max-width: 860px display: none !important .oe_form .oe_form_field_date width: auto + // Sheet and padding .oe_form_nosheet margin: 16px > header margin: -16px -16px 0 -16px padding: 8px + .oe_form_sheetbg + padding: 8px 0 + .oe_form_sheet_width + min-width: 650px + max-width: $sheet-max-width + margin: 0 auto + .oe_form_sheet + background: white + min-height: 330px + padding: 16px + // Sheet inline mode + .oe_application + .oe_form_sheetbg + background: url(/web/static/src/img/form_sheetbg.png) + border-bottom: 1px solid #ddd + .oe_form_sheet + border: 1px solid $tag-border + @include box-shadow(0 0 10px rgba(0,0,0,0.3)) + .ui-tabs + margin: 0 -16px + .oe_notebook_page + padding: 0 16px // }}} // FormView.custom tags and classes {{{ .oe_form @@ -1527,7 +1563,7 @@ $sheet-max-width: 860px max-width: 650px margin: 0 0 10px 0 div.oe_form_configuration - p + p, ul, ol color: #aaa max-width: 650px label @@ -1536,115 +1572,92 @@ $sheet-max-width: 860px padding: 1px 0 .oe_form_group_cell div div padding: 1px 0 - - - ul.oe_form_steps, ul.oe_form_steps_clickable - display: inline-block - padding-right: 18px - li + ul.oe_form_steps, ul.oe_form_steps_clickable display: inline-block - margin-right: -20px - @include vertical-gradient(#fcfcfc, #dedede) - &:first-child .label - border-left: 1px solid #cacaca - padding-left: 14px - &:last-child - border-right: 1px solid #cacaca - .label - padding-right: 14px - .arrow - display: none - .label - color: #4c4c4c - text-shadow: 0 1px 1px #fcfcfc, 0 -1px 1px #dedede - padding: 7px + padding-right: 18px + li display: inline-block - padding-left: 24px - margin: 0 - position: relative - .arrow - width: 17px - display: inline-block - vertical-align: top - overflow: hidden - margin-left: -5px - span + margin-right: -20px + @include vertical-gradient(#fcfcfc, #dedede) + &:first-child .label + border-left: 1px solid #cacaca + padding-left: 14px + &:last-child + border-right: 1px solid #cacaca + .label + padding-right: 14px + .arrow + display: none + .label + color: #4c4c4c + text-shadow: 0 1px 1px #fcfcfc, 0 -1px 1px #dedede + padding: 7px + display: inline-block + padding-left: 24px + margin: 0 position: relative - width: 24px - height: 24px + .arrow + width: 17px display: inline-block - margin-left: -12px - margin-top: 3px - box-shadow: -1px 1px 2px rgba(255,255,255,0.2), inset -1px 1px 1px rgba(0,0,0,0.2) - @include skew-gradient(#fcfcfc, #dedede) - @include radius(3px) - @include transform(rotate(45deg)) - li.oe_active - @include vertical-gradient(#729fcf, #3465a4) - .arrow span - @include skew-gradient(#729fcf, #3465a4) - .label - color: white - text-shadow: 0 1px 1px #729fcf, 0 -1px 1px #3465a4 - - ul.oe_form_steps_clickable - li - cursor: pointer - &:hover - @include vertical-gradient(darken(#fcfcfc, 8%), darken(#dedede, 8%)) - .label - text-shadow: 0 -1px 1px #fcfcfc, 0 1px 1px #dedede + vertical-align: top + overflow: hidden + margin-left: -5px + span + position: relative + width: 24px + height: 24px + display: inline-block + margin-left: -12px + margin-top: 3px + box-shadow: -1px 1px 2px rgba(255,255,255,0.2), inset -1px 1px 1px rgba(0,0,0,0.2) + @include skew-gradient(#fcfcfc, #dedede) + @include radius(3px) + @include transform(rotate(45deg)) + li.oe_active + @include vertical-gradient(#729fcf, #3465a4) .arrow span + @include skew-gradient(#729fcf, #3465a4) + .label + color: white + text-shadow: 0 1px 1px #729fcf, 0 -1px 1px #3465a4 + ul.oe_form_steps_clickable + li + cursor: pointer + &:hover @include vertical-gradient(darken(#fcfcfc, 8%), darken(#dedede, 8%)) - .label - color: $link-color - li.oe_active - &:hover - @include vertical-gradient(darken(#729fcf, 10%), darken(#3465a4, 10%)) + .label + text-shadow: 0 -1px 1px #fcfcfc, 0 1px 1px #dedede + .arrow span + @include vertical-gradient(darken(#fcfcfc, 8%), darken(#dedede, 8%)) .label - text-shadow: 0 -1px 1px #729fcf, 0 1px 1px #3465a4 - .arrow span - @include skew-gradient(darken(#729fcf, 10%), darken(#3465a4, 10%)) + color: $link-color + li.oe_active + &:hover + @include vertical-gradient(darken(#729fcf, 10%), darken(#3465a4, 10%)) + .label + text-shadow: 0 -1px 1px #729fcf, 0 1px 1px #3465a4 + .arrow span + @include skew-gradient(darken(#729fcf, 10%), darken(#3465a4, 10%)) + .oe_subtotal_footer + width: 1% !important + td.oe_form_group_cell + text-align: right + padding: 0 !important + td.oe_form_group_cell_label + border-right: none + .oe_subtotal_footer_separator + width: 108px + border-top: 1px solid #cacaca + font-weight: bold + font-size: 18px + label:after + content: ":" + label.oe_subtotal_footer_separator + font-weight: bold !important + padding: 2px 11px 2px 0px !important + label.oe_form_label_help + font-weight: normal - .oe_form .oe_subtotal_footer - width: 1% !important - td.oe_form_group_cell - text-align: right - padding: 0 !important - td.oe_form_group_cell_label - border-right: none - .oe_subtotal_footer_separator - width: 108px - border-top: 1px solid #cacaca - font-weight: bold - font-size: 18px - label:after - content: ":" - label.oe_subtotal_footer_separator - font-weight: bold !important - padding: 2px 11px 2px 0px !important - label.oe_form_label_help - font-weight: normal - // no sheet in popups - .oe_application - .oe_form_sheetbg - background: url(/web/static/src/img/form_sheetbg.png) - padding: 8px 0 - border-bottom: 1px solid #ddd - .oe_form_sheet_width - min-width: 650px - max-width: $sheet-max-width - margin: 0 auto - .oe_form_sheet - background: white - min-height: 330px - padding: 16px - border: 1px solid $tag-border - @include box-shadow(0 0 10px rgba(0,0,0,0.3)) - .ui-tabs - margin: 0 -16px - .oe_notebook_page - padding: 0 16px // }}} // FormView.group {{{ .oe_form @@ -1741,7 +1754,7 @@ $sheet-max-width: 860px input[type="text"], input[type="password"], input[type="file"], select, textarea @include box-sizing(border) background: white - min-width: 70px + min-width: 60px color: #1f1f1f input[readonly], select[readonly], textarea[readonly], input[disabled], select[disabled] background: #E5E5E5 !important @@ -1865,6 +1878,11 @@ $sheet-max-width: 860px li:not(.oe_m2o_dropdown_option) + li.oe_m2o_dropdown_option margin-top: 10px // }}} + // FormView.fieldstatus {{{ + .oe_form_field_status + @include semantic-html-override + @include ul-html-override + // }}} // FormView.one2many {{{ .oe_form .oe_form_field_one2many > .oe_view_manager .oe_list_pager_single_page @@ -1912,6 +1930,8 @@ $sheet-max-width: 860px background-color: #d2d2ff td.oe_readonly background-color: #eee + + $row-height: 27px .oe_list_editable .oe_list_content td.oe_list_field_cell @@ -1926,12 +1946,11 @@ $sheet-max-width: 860px display: none .oe_form_field input - height: 27px + height: $row-height input, textarea + @include radius(0) border: 1px solid #aaf - border-radius: 0px - margin: 0px - -webkit-border-radius: 0px + margin: 0 textarea height: 60px &.oe_form_field_float,&.oe_form_view_integer @@ -2018,6 +2037,7 @@ $sheet-max-width: 860px > tbody cursor: pointer > tr + height: $row-height border-top: 1px solid #ddd > td.oe_list_field_cell padding: 3px 6px @@ -2058,6 +2078,13 @@ $sheet-max-width: 860px .oe_list_handle @include text-to-icon("ö") + .oe_list_cannot_edit + .oe_list_header_handle, .oe_list_field_handle + display: none !important + .oe_list_cannot_delete + .oe_list_record_delete + display: none !important + // }}} // Tree view {{{ .tree_header diff --git a/addons/web/static/src/js/corelib.js b/addons/web/static/src/js/corelib.js index 8a28c0a8a4d..c74c2d5dc03 100644 --- a/addons/web/static/src/js/corelib.js +++ b/addons/web/static/src/js/corelib.js @@ -1323,12 +1323,6 @@ instance.web.JsonRPC = instance.web.CallbackEnabled.extend({ deferred.resolve(response["result"], textStatus, jqXHR); } else if (response.error.data.type === "session_invalid") { self.uid = false; - // TODO deprecate or use a deferred on login.do_ask_login() - self.on_session_invalid(function() { - self.rpc(url, payload.params, - function() { deferred.resolve.apply(deferred, arguments); }, - function() { deferred.reject.apply(deferred, arguments); }); - }); } else { deferred.reject(response.error, $.Event()); } diff --git a/addons/web/static/src/js/coresetup.js b/addons/web/static/src/js/coresetup.js index 38cf57387d1..60e59ad0b2c 100644 --- a/addons/web/static/src/js/coresetup.js +++ b/addons/web/static/src/js/coresetup.js @@ -113,20 +113,6 @@ instance.web.Session = instance.web.JsonRPC.extend( /** @lends instance.web.Sess this.set_cookie('session_id', ''); return this.rpc("/web/session/destroy", {}); }, - on_session_valid: function() { - }, - /** - * Called when a rpc call fail due to an invalid session. - * By default, it's a noop - */ - on_session_invalid: function(retry_callback) { - }, - /** - * Fetches a cookie stored by an openerp session - * - * @private - * @param name the cookie's name - */ get_cookie: function (name) { if (!this.name) { return null; } var nameEQ = this.name + '|' + name + '='; @@ -160,9 +146,8 @@ instance.web.Session = instance.web.JsonRPC.extend( /** @lends instance.web.Sess /** * Load additional web addons of that instance and init them * - * @param {Boolean} [no_session_valid_signal=false] prevents load_module from triggering ``on_session_valid``. */ - load_modules: function(no_session_valid_signal) { + load_modules: function() { var self = this; return this.rpc('/web/session/modules', {}).pipe(function(result) { var lang = self.user_context.lang, @@ -195,9 +180,6 @@ instance.web.Session = instance.web.JsonRPC.extend( /** @lends instance.web.Sess return loaded.then(function() { self.on_modules_loaded(); self.trigger('module_loaded'); - if (!no_session_valid_signal) { - self.on_session_valid(); - } }); }); }, @@ -611,11 +593,12 @@ if ($.blockUI) { var messages_by_seconds = function() { return [ [0, _t("Loading...")], - [30, _t("Still loading...")], + [20, _t("Still loading...")], [60, _t("Still loading...<br />Please be patient.")], [120, _t("Don't leave yet,<br />it's still loading...")], [300, _t("You may not believe it,<br />but the application is actually loading...")], - [600, _t("You know, sometimes,<br />OpenERP can be a little bit slow,<br />because it's loading...")], + [420, _t("Take a minute to get a coffee,<br />because it's loading...")], + [600, _t("It's loading...<br />By the way, did you tried the kitten mode?")], [3600, _t("Maybe you should consider pressing F5...")], ]; }; diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index 24584413fee..f65da67d8fb 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -23,10 +23,6 @@ instance.web.form.FieldManagerMixin = { */ get_field: function(field_name) {}, /** - * Called by the field when the translate button is clicked. - */ - open_translate_dialog: function(field) {}, - /** * Returns true when the view is in create mode. */ is_create_mode: function() {}, @@ -145,14 +141,14 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM if (!this.sidebar && this.options.$sidebar) { this.sidebar = new instance.web.Sidebar(this); this.sidebar.appendTo(this.$sidebar); - if(this.fields_view.toolbar) { + if (this.fields_view.toolbar) { this.sidebar.add_toolbar(this.fields_view.toolbar); } - this.sidebar.add_items('other', [ - { label: _t('Delete'), callback: self.on_button_delete }, - { label: _t('Duplicate'), callback: self.on_button_duplicate }, + this.sidebar.add_items('other', _.compact([ + self.is_action_enabled('delete') && { label: _t('Delete'), callback: self.on_button_delete }, + self.is_action_enabled('create') && { label: _t('Duplicate'), callback: self.on_button_duplicate }, { label: _t('Set Default'), callback: function (item) { self.open_defaults_dialog(); } } - ]); + ])); } this.has_been_loaded.resolve(); @@ -1049,9 +1045,6 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM is_create_mode: function() { return this.get("actual_mode") === "create"; }, - open_translate_dialog: function(field) { - return this._super(field); - }, }); /** @@ -1882,6 +1875,10 @@ instance.web.form.FieldInterface = { * Must set the focus on the field. Return false if field is not focusable. */ focus: function() {}, + /** + * Called when the translate button is clicked. + */ + on_translate: function() {}, }; /** @@ -1936,9 +1933,7 @@ instance.web.form.AbstractField = instance.web.form.FormWidget.extend(instance.w this._super(); if (this.field.translate) { this.$el.addClass('oe_form_field_translatable'); - this.$el.find('.oe_field_translate').click(_.bind(function() { - this.field_manager.open_translate_dialog(this); - }, this)); + this.$el.find('.oe_field_translate').click(this.on_translate); } this.$label = this.view.$el.find('label[for=' + this.id_for_label + ']'); if (instance.session.debug) { @@ -2000,6 +1995,13 @@ instance.web.form.AbstractField = instance.web.form.FormWidget.extend(instance.w set_input_id: function(id) { this.id_for_label = id; }, + on_translate: function() { + var self = this; + var trans = new instance.web.DataSet(this, 'ir.translation'); + return trans.call_button('translate_fields', [this.view.dataset.model, this.view.datarecord.id, this.name, this.view.dataset.get_context()]).then(function(r) { + self.do_action(r.result); + }); + }, }); /** @@ -2692,8 +2694,8 @@ instance.web.form.CompletionFieldMixin = { _create_context: function(name) { var tmp = {}; var field = (this.options || {}).create_name_field; - if (field) - tmp["default_" + field] = name; + if (field !== false && (this.options || {}).quick_create !== false) + tmp["default_" + field] = name || "name"; return tmp; }, }; @@ -2844,7 +2846,21 @@ instance.web.form.FieldMany2One = instance.web.form.AbstractField.extend(instanc self.tip_def.reject(); } }; - this.$input.focusout(anyoneLoosesFocus); + var ignore_blur = false; + this.$input.on({ + focusout: anyoneLoosesFocus, + focus: function () { self.trigger('focused'); }, + autocompleteopen: function () { ignore_blur = true; }, + autocompleteclose: function () { ignore_blur = false; }, + blur: function () { + // autocomplete open + if (ignore_blur) { return; } + if (_(self.getChildren()).any(function (child) { + return child instanceof instance.web.form.AbstractFormPopup; + })) { return; } + self.trigger('blurred'); + } + }); var isSelecting = false; // autocomplete @@ -2886,7 +2902,7 @@ instance.web.form.FieldMany2One = instance.web.form.AbstractField.extend(instanc } isSelecting = false; }); - this.setupFocus(this.$input.add(this.$follow_button)); + this.setupFocus(this.$follow_button); }, render_value: function(no_recurse) { var self = this; @@ -3471,7 +3487,7 @@ instance.web.form.One2ManyListView = instance.web.ListView.extend({ return self.o2m.dataset.read_ids.apply(self.o2m.dataset, arguments); }, form_view_options: {'not_interactible_on_create':true}, - readonly: self.o2m.get("effective_readonly") + readonly: !this.is_action_enabled('edit') || self.o2m.get("effective_readonly") }); }, do_button_action: function (name, id, callback) { @@ -3559,7 +3575,11 @@ instance.web.form.One2ManyListView = instance.web.ListView.extend({ }); instance.web.form.One2ManyList = instance.web.ListView.List.extend({ pad_table_to: function (count) { - this._super(count > 0 ? count - 1 : 0); + if (!this.view.is_action_enabled('create')) { + this._super(count); + } else { + this._super(count > 0 ? count - 1 : 0); + } // magical invocation of wtf does that do if (this.view.o2m.get('effective_readonly')) { @@ -3572,6 +3592,11 @@ instance.web.form.One2ManyList = instance.web.ListView.List.extend({ }).length; if (this.options.selectable) { columns++; } if (this.options.deletable) { columns++; } + + if (!this.view.is_action_enabled('create')) { + return; + } + var $cell = $('<td>', { colspan: columns, 'class': 'oe_form_field_one2many_list_row_add' diff --git a/addons/web/static/src/js/view_list.js b/addons/web/static/src/js/view_list.js index 42a808c5e15..22333898813 100644 --- a/addons/web/static/src/js/view_list.js +++ b/addons/web/static/src/js/view_list.js @@ -250,6 +250,12 @@ instance.web.ListView = instance.web.View.extend( /** @lends instance.web.ListVi this.$el.html(QWeb.render(this._template, this)); this.$el.addClass(this.fields_view.arch.attrs['class']); + + // add css classes that reflect the (absence of) access rights + this.$el.toggleClass('oe_list_cannot_create', !this.is_action_enabled('create')) + .toggleClass('oe_list_cannot_edit', !this.is_action_enabled('edit')) + .toggleClass('oe_list_cannot_delete', !this.is_action_enabled('delete')); + // Head hook // Selecting records this.$el.find('.oe_list_record_selector').click(function(){ @@ -351,11 +357,11 @@ instance.web.ListView = instance.web.View.extend( /** @lends instance.web.ListVi if (!this.sidebar && this.options.$sidebar) { this.sidebar = new instance.web.Sidebar(this); this.sidebar.appendTo(this.options.$sidebar); - this.sidebar.add_items('other', [ - { label: _t("Import"), callback: this.on_sidebar_import }, + this.sidebar.add_items('other', _.compact([ + self.is_action_enabled('create') && { label: _t("Import"), callback: this.on_sidebar_import }, { label: _t("Export"), callback: this.on_sidebar_export }, - { label: _t('Delete'), callback: this.do_delete_selected } - ]); + self.is_action_enabled('delete') && { label: _t('Delete'), callback: this.do_delete_selected } + ])); this.sidebar.add_toolbar(this.fields_view.toolbar); this.sidebar.$el.hide(); } @@ -1995,7 +2001,7 @@ instance.web.list.Column = instance.web.Class.extend({ if (!(aggregation_func in this)) { return {}; } - var C = function (label, fn) { + var C = function (fn, label) { this['function'] = fn; this.label = label; }; @@ -2115,6 +2121,11 @@ instance.web.list.ProgressBar = instance.web.list.Column.extend({ } }); instance.web.list.Handle = instance.web.list.Column.extend({ + init: function () { + this._super.apply(this, arguments); + // Handle overrides the field to not be form-editable. + this.modifiers.readonly = true; + }, /** * Return styling hooks for a drag handle * diff --git a/addons/web/static/src/js/view_list_editable.js b/addons/web/static/src/js/view_list_editable.js index 65f5620c1a9..892221a347b 100644 --- a/addons/web/static/src/js/view_list_editable.js +++ b/addons/web/static/src/js/view_list_editable.js @@ -55,6 +55,12 @@ openerp.web.list_editable = function (instance) { instance.web.bus.off('resize', this, this.resize_fields); this._super(); }, + do_hide: function () { + if (this.editor.is_editing()) { + this.cancel_edition(true); + } + this._super(); + }, /** * Handles the activation of a record in editable mode (making a record * editable), called *after* the record has become editable. @@ -249,7 +255,7 @@ openerp.web.list_editable = function (instance) { var position = $cell.position(); // jquery does not understand !important - field.$el.attr('style', 'width: '+$cell.outerWidth()+'px !important') + field.$el.attr('style', 'width: '+$cell.outerWidth()+'px !important'); field.$el.css({ top: position.top, left: position.left, @@ -354,14 +360,17 @@ openerp.web.list_editable = function (instance) { 'class': 'oe_form_container', version: '7.0' }); - _(view.arch.children).each(function (widget) { - var modifiers = JSON.parse(widget.attrs.modifiers || '{}'); - widget.attrs.nolabel = true; - if (modifiers['tree_invisible'] || widget.tag === 'button') { - modifiers.invisible = true; - } - widget.attrs.modifiers = JSON.stringify(modifiers); - }); + _(view.arch.children).chain() + .zip(this.columns) + .each(function (ar) { + var widget = ar[0], column = ar[1]; + var modifiers = _.extend({}, column.modifiers); + widget.attrs.nolabel = true; + if (modifiers['tree_invisible'] || widget.tag === 'button') { + modifiers.invisible = true; + } + widget.attrs.modifiers = JSON.stringify(modifiers); + }); return view; }, handle_onwrite: function (source_record) { @@ -750,7 +759,7 @@ openerp.web.list_editable = function (instance) { instance.web.ListView.List.include(/** @lends instance.web.ListView.List# */{ row_clicked: function (event) { - if (!this.view.editable()) { + if (!this.view.editable() || ! this.view.is_action_enabled('edit')) { return this._super.apply(this, arguments); } var record_id = $(event.currentTarget).data('id'); diff --git a/addons/web/static/src/js/views.js b/addons/web/static/src/js/views.js index e453ecbc905..4820cc065dc 100644 --- a/addons/web/static/src/js/views.js +++ b/addons/web/static/src/js/views.js @@ -732,6 +732,14 @@ instance.web.ViewManagerAction = instance.web.ViewManager.extend({ var dialog = new instance.web.Dialog(this, { title: _t("Fields View Get"), width: '95%' }).open(); $('<pre>').text(instance.web.json_node_to_xml(current_view.fields_view.arch, true)).appendTo(dialog.$el); break; + case 'tests': + this.do_action({ + name: "JS Tests", + target: 'new', + type : 'ir.actions.act_url', + url: '/web/static/test/test.html' + }) + break; case 'perm_read': var ids = current_view.get_selected_ids(); if (ids.length === 1) { @@ -749,6 +757,17 @@ instance.web.ViewManagerAction = instance.web.ViewManager.extend({ case 'toggle_layout_outline': current_view.rendering_engine.toggle_layout_debugging(); break; + case 'translate': + this.do_action({ + name: "Technical Translation", + res_model : 'ir.translation', + domain : [['type', '!=', 'object'], '|', ['name', '=', this.dataset.model], ['name', 'ilike', this.dataset.model + ',']], + views: [[false, 'list'], [false, 'form']], + type : 'ir.actions.act_window', + view_type : "list", + view_mode : "list" + }); + break; case 'fields': this.dataset.call_and_eval( 'fields_get', [false, {}], null, 1).then(function (fields) { @@ -882,10 +901,6 @@ instance.web.Sidebar = instance.web.Widget.extend({ 'files' : [], 'other' : [] }; - if (this.session.uid === 1) { - var item = { label: _t("Translate"), callback: view.on_sidebar_translate, title: _t("Technical translation") }; - this.items.other.push(item); - } this.fileupload_id = _.uniqueId('oe_fileupload'); $(window).on(this.fileupload_id, function() { var args = [].slice.call(arguments).slice(1); @@ -1050,119 +1065,6 @@ instance.web.Sidebar = instance.web.Widget.extend({ } }); -instance.web.TranslateDialog = instance.web.Dialog.extend({ - dialog_title: {toString: function () { return _t("Translations"); }}, - init: function(view) { - // TODO fme: should add the language to fields_view_get because between the fields view get - // and the moment the user opens the translation dialog, the user language could have been changed - this.view_language = view.session.user_context.lang; - this['on_button_' + _t("Save")] = this.on_btn_save; - this['on_button_' + _t("Close")] = this.on_btn_close; - this._super(view, { - width: '80%', - height: '80%', - destroy_on_close: false, - }); - this.view = view; - this.view_type = view.fields_view.type || ''; - this.$fields_form = null; - this.$view_form = null; - this.$sidebar_form = null; - this.translatable_fields_keys = _.map(this.view.translatable_fields || [], function(i) { return i.name; }); - this.languages = null; - this.languages_loaded = $.Deferred(); - (new instance.web.DataSetSearch(this, 'res.lang', this.view.dataset.get_context(), - [['translatable', '=', '1']])).read_slice(['code', 'name'], { sort: 'id' }).then(this.on_languages_loaded); - }, - start: function() { - var self = this; - this._super(); - return $.when(this.languages_loaded).then(function() { - self.$el.html(instance.web.qweb.render('TranslateDialog', { widget: self })); - self.$fields_form = self.$el.find('.oe_translation_form'); - self.$fields_form.find('.oe_trad_field').change(function() { - $(this).toggleClass('touched', ($(this).val() != $(this).attr('data-value'))); - }); - }); - }, - on_languages_loaded: function(langs) { - this.languages = langs; - this.languages_loaded.resolve(); - }, - do_load_fields_values: function(callback) { - var self = this, - deffered = []; - this.$fields_form.find('.oe_trad_field').val('').removeClass('touched'); - _.each(self.languages, function(lg) { - var deff = $.Deferred(); - deffered.push(deff); - var callback = function(values) { - _.each(self.translatable_fields_keys, function(f) { - var value = values[0][f] || ''; - self.$fields_form.find('.oe_trad_field[name="' + lg.code + '-' + f + '"]').val(value).attr('data-value', value); - }); - deff.resolve(); - }; - if (lg.code === self.view_language) { - var values = {}; - _.each(self.translatable_fields_keys, function(field) { - values[field] = self.view.fields[field].get_value(); - }); - callback([values]); - } else { - self.view.dataset.read_ids([self.view.datarecord.id], self.translatable_fields_keys, { - context: { 'lang': lg.code } - }).then(callback); - } - }); - $.when.apply(null, deffered).then(callback); - }, - open: function(field) { - var self = this; - this._super(); - $.when(this.languages_loaded).then(function() { - if (self.view.translatable_fields && self.view.translatable_fields.length) { - self.do_load_fields_values(function() { - if (field) { - var $field_input = self.$el.find('tr[data-field="' + field.name + '"] td:nth-child(2) *:first-child'); - self.$el.scrollTo($field_input); - $field_input.focus(); - } - }); - } else { - sup.call(self); - } - }); - }, - on_btn_save: function() { - var trads = {}; - var self = this; - var trads_mutex = new $.Mutex(); - self.$fields_form.find('.oe_trad_field.touched').each(function() { - var field = $(this).attr('name').split('-'); - if (!trads[field[0]]) { - trads[field[0]] = {}; - } - trads[field[0]][field[1]] = $(this).val(); - }); - _.each(trads, function(data, code) { - if (code === self.view_language) { - _.each(data, function(value, field) { - self.view.fields[field].set_value(value); - }); - } - trads_mutex.exec(function() { - return self.view.dataset.write(self.view.datarecord.id, data, { context : { 'lang': code } }); - }); - }); - this.close(); - return trads_mutex; - }, - on_btn_close: function() { - this.close(); - } -}); - instance.web.View = instance.web.Widget.extend({ // name displayed in view switchers display_name: '', @@ -1214,12 +1116,6 @@ instance.web.View = instance.web.Widget.extend({ action_views_ids: {} }); }, - open_translate_dialog: function(field) { - if (!this.translate_dialog) { - this.translate_dialog = new instance.web.TranslateDialog(this); - } - this.translate_dialog.open(field); - }, /** * Fetches and executes the action identified by ``action_data``. * @@ -1338,16 +1234,6 @@ instance.web.View = instance.web.Widget.extend({ on_sidebar_export: function() { new instance.web.DataExport(this, this.dataset).open(); }, - on_sidebar_translate: function() { - return this.do_action({ - res_model : 'ir.translation', - domain : [['type', '!=', 'object'], '|', ['name', '=', this.dataset.model], ['name', 'ilike', this.dataset.model + ',']], - views: [[false, 'list'], [false, 'form']], - type : 'ir.actions.act_window', - view_type : "list", - view_mode : "list" - }); - }, sidebar_context: function () { return $.when(); }, @@ -1357,6 +1243,15 @@ instance.web.View = instance.web.Widget.extend({ */ reload: function () { return $.when(); + }, + /** + * Return whether the user can perform the action ('create', 'edit', 'delete') in this view. + * An action is disabled by setting the corresponding attribute in the view's main element, + * like: <form string="" create="false" edit="false" delete="false"> + */ + is_action_enabled: function(action) { + var attrs = this.fields_view.arch.attrs; + return (action in attrs) ? JSON.parse(attrs[action]) : true; } }); diff --git a/addons/web/static/src/xml/base.xml b/addons/web/static/src/xml/base.xml index d5596f5c8da..f280119be99 100644 --- a/addons/web/static/src/xml/base.xml +++ b/addons/web/static/src/xml/base.xml @@ -479,10 +479,12 @@ <option value="">Debug View#<t t-esc="view.fields_view.view_id"/></option> <option t-if="view_manager.active_view === 'form'" value="perm_read" data-views="form,page">View Log (perm_read)</option> <option t-if="view_manager.active_view === 'form'" value="toggle_layout_outline">Toggle Form Layout Outline</option> + <option value="tests">JS Tests</option> <option value="fields">View Fields</option> <option value="fvg">Fields View Get</option> <option value="manage_filters">Manage Filters</option> <t t-if="view_manager.session.uid === 1"> + <option value="translate">Technical translation</option> <option value="manage_views">Manage Views</option> <option value="edit" data-model="ir.ui.view" t-att-data-id="view.fields_view.view_id">Edit <t t-esc="_.str.capitalize(view.fields_view.type)"/>View</option> <option t-if="view_manager.searchview" value="edit" data-model="ir.ui.view" t-att-data-id="view_manager.searchview.view_id">Edit SearchView</option> @@ -635,7 +637,7 @@ <t t-if="column.tag !== 'button'"><t t-esc="column.string"/></t> </th> </t> - <th t-if="options.deletable" width="13px"/> + <th t-if="options.deletable" class="oe_list_record_delete" width="13px"/> </tr> </thead> <tfoot> @@ -649,7 +651,7 @@ </tfoot> </table> <div t-name="ListView.buttons" class="oe_list_buttons"> - <t t-if="!widget.no_leaf and widget.options.action_buttons !== false and widget.options.addable"> + <t t-if="!widget.no_leaf and widget.options.action_buttons !== false and widget.options.addable and widget.is_action_enabled('create')"> <button type="button" class="oe_button oe_list_add oe_highlight"> <t t-esc="widget.options.addable"/> </button> @@ -701,7 +703,7 @@ type="button">Save</button> </t> <t t-jquery="a.oe_list_button_import" t-operation="after"> - <a href="#" class="oe_bold oe_list_discard">discard</a> + <a href="#" class="oe_bold oe_list_discard">Discard</a> </t> </t> <t t-extend="ListView.row"> @@ -725,10 +727,12 @@ <div t-name="FormView.buttons" class="oe_form_buttons"> <t t-if="widget.options.action_buttons !== false"> <span class="oe_form_buttons_view"> - <div style="display: inline-block;"> <!-- required for the bounce effect on button --> - <button type="button" class="oe_button oe_form_button_edit" accesskey="E">Edit</button> + <!-- required for the bounce effect on button --> + <div t-if="widget.is_action_enabled('edit')" style="display: inline-block;"> + <button type="button" class="oe_button oe_form_button_edit" accesskey="E">Edit</button> </div> - <button type="button" class="oe_button oe_form_button_create" accesskey="C">Create</button> + <button t-if="widget.is_action_enabled('create')" + type="button" class="oe_button oe_form_button_create" accesskey="C">Create</button> </span> <span class="oe_form_buttons_edit"> <button type="button" class="oe_button oe_form_button_save oe_highlight" accesskey="S">Save</button> @@ -1063,7 +1067,7 @@ </span> </t> <t t-name="FieldStatus"> - <ul t-att-class="widget.options.clickable ? 'oe_form_steps_clickable' : 'oe_form_steps'" t-att-style="widget.node.attrs.style"/> + <ul t-att-class="'oe_form_field_status ' + (widget.options.clickable ? 'oe_form_steps_clickable' : 'oe_form_steps')" t-att-style="widget.node.attrs.style"/> </t> <t t-name="FieldStatus.content"> <t t-foreach="widget.selection" t-as="i"> @@ -1205,28 +1209,6 @@ </t> </t> -<t t-name="TranslateDialog"> - <table t-if="widget.view.translatable_fields" class="oe_form oe_translation_form" border="0" cellpadding="0" cellspacing="0" width="100%"> - <tr> - <td class="oe_form_separator" width="1%" nowrap="nowrap"> - <div class="oe_horizontal_separator">Field</div> - </td> - <th t-foreach="widget.languages" align="left"> - <div class="oe_horizontal_separator"><t t-esc="name"/></div> - </th> - </tr> - <tr t-foreach="widget.view.translatable_fields" t-as="field" t-att-data-field="field.name"> - <td class="oe_form_group_cell" width="1%" nowrap="nowrap"> - <label class="oe_label"><t t-esc="field.string"/>:</label> - </td> - <td t-foreach="widget.languages" t-as="lg" class="oe_form_group_cell"> - <input t-if="field.field.type == 'char'" type="text" t-attf-name="#{lg.code}-#{field.name}" value="" data-value="" class="oe_trad_field" style="width: 100%"/> - <textarea t-if="field.field.type == 'text'" t-attf-name="#{lg.code}-#{field.name}" data-value="" class="oe_trad_field" style="width: 100%"></textarea> - </td> - </tr> - </table> -</t> - <t t-name="AbstractFormPopup.render"> <div> <table style="width:100%"> |
