diff --git a/addons/web/controllers/main.py b/addons/web/controllers/main.py index 13f746974da..f682157195d 100644 --- a/addons/web/controllers/main.py +++ b/addons/web/controllers/main.py @@ -1494,10 +1494,6 @@ class Binary(openerpweb.Controller): class Action(openerpweb.Controller): _cp_path = "/web/action" - - action_mapping = { - "ir.actions.act_url": "ir.actions.url", - } # For most actions, the type attribute and the model name are the same, but # there are exceptions. This dict is used to remap action type attributes @@ -1511,6 +1507,17 @@ class Action(openerpweb.Controller): Actions = req.session.model('ir.actions.actions') value = False context = req.session.eval_context(req.context) + + try: + action_id = int(action_id) + except ValueError: + try: + module, xmlid = action_id.split('.', 1) + model, action_id = req.session.model('ir.model.data').get_object_reference(module, xmlid) + assert model.startswith('ir.actions.') + except Exception: + action_id = 0 # force failed read + base_action = Actions.read([action_id], ['type'], context) if base_action: ctx = {} diff --git a/addons/web/static/src/css/base.css b/addons/web/static/src/css/base.css index 939672e7293..95164341e9b 100644 --- a/addons/web/static/src/css/base.css +++ b/addons/web/static/src/css/base.css @@ -202,6 +202,9 @@ -moz-background-clip: padding-box; background-clip: padding-box; } +.openerp.ui-dialog .ui-dialog-content { + padding: 0px; +} .openerp.ui-dialog .ui-dialog-titlebar, .openerp.ui-dialog .ui-dialog-content, .openerp.ui-dialog .ui-dialog-buttonpane { padding: 16px; } @@ -240,6 +243,9 @@ .openerp.ui-dialog .ui-dialog-buttonpane button { margin-left: 8px; } +.openerp.ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset { + float: left; +} .openerp.ui-dialog .ui-dialog-titlebar-close { padding: 0; } @@ -262,6 +268,9 @@ color: black; text-decoration: none; } +.openerp.ui-dialog.oe_act_window .ui-dialog-content { + padding: 0px; +} .openerp .modal-backdrop { position: fixed; top: 0; @@ -444,6 +453,29 @@ .openerp .oe_webclient .oe_star_on { color: gold; } +.openerp .oe_tag { + border-radius: 2px; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + -ms-box-sizing: border-box; + box-sizing: border-box; + border: 1px solid #9daccc; + background: #e2e6f0; + color: black !important; + padding: 0px 3px 0px 3px; + margin: 0 2px 2px 0; + height: 16px; +} +.openerp .oe_tags .text-wrap { + width: 100% !important; +} +.openerp .oe_tags .text-wrap textarea { + width: 100% !important; +} +.openerp .oe_tags .text-core .text-wrap .text-dropdown .text-list .text-suggestion em { + font-style: italic; + text-decoration: none; +} .openerp.oe_tooltip { font-size: 12px; } @@ -1130,63 +1162,63 @@ .openerp .oe_view_manager .oe_view_manager_view_kanban { height: inherit; } -.openerp .oe_view_manager .oe_view_manager_header { +.openerp .oe_view_manager table.oe_view_manager_header { width: 100%; + table-layout: fixed; } -.openerp .oe_view_manager .oe_view_manager_header .oe_header_row { +.openerp .oe_view_manager table.oe_view_manager_header .oe_header_row { clear: both; text-shadow: 0 1px 1px white; } -.openerp .oe_view_manager .oe_view_manager_header .oe_header_row:last-child td { +.openerp .oe_view_manager table.oe_view_manager_header .oe_header_row:last-child td { padding-top: 0; } -.openerp .oe_view_manager .oe_view_manager_header .oe_view_manager_sidebar { +.openerp .oe_view_manager table.oe_view_manager_header .oe_view_manager_sidebar { margin: 0px auto; - width: 400px; text-align: center; } -.openerp .oe_view_manager .oe_view_manager_header td { +.openerp .oe_view_manager table.oe_view_manager_header td { line-height: 26px; } -.openerp .oe_view_manager .oe_view_manager_header h2 { +.openerp .oe_view_manager table.oe_view_manager_header h2 { font-size: 18px; margin: 0; float: left; } -.openerp .oe_view_manager .oe_view_manager_header h2 a { +.openerp .oe_view_manager table.oe_view_manager_header h2 a { color: #8a89ba; } -.openerp .oe_view_manager .oe_view_manager_header .oe_button_group { +.openerp .oe_view_manager table.oe_view_manager_header .oe_button_group { display: inline-block; border: 1px solid #ababab; -moz-border-radius: 5px; -webkit-border-radius: 5px; border-radius: 5px; } -.openerp .oe_view_manager .oe_view_manager_header .oe_button_group li { +.openerp .oe_view_manager table.oe_view_manager_header .oe_button_group li { float: left; border-right: 1px solid #ababab; } -.openerp .oe_view_manager .oe_view_manager_header .oe_button_group li:last-child { +.openerp .oe_view_manager table.oe_view_manager_header .oe_button_group li:last-child { border: none; } -.openerp .oe_view_manager .oe_view_manager_header .oe_button_group a { +.openerp .oe_view_manager table.oe_view_manager_header .oe_button_group a { color: #4c4c4c; } -.openerp .oe_view_manager .oe_view_manager_header .oe_button_group a:hover { +.openerp .oe_view_manager table.oe_view_manager_header .oe_button_group a:hover { text-decoration: none; } -.openerp .oe_view_manager .oe_view_manager_header .oe_button_group .active { +.openerp .oe_view_manager table.oe_view_manager_header .oe_button_group .active { background: #999999; -moz-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3) inset; -webkit-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3) inset; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3) inset; } -.openerp .oe_view_manager .oe_view_manager_header .oe_button_group .active a { +.openerp .oe_view_manager table.oe_view_manager_header .oe_button_group .active a { color: white; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4); } -.openerp .oe_view_manager .oe_view_manager_header .oe_view_manager_buttons { +.openerp .oe_view_manager table.oe_view_manager_header .oe_view_manager_buttons { white-space: nowrap; } .openerp .oe_view_manager .oe_view_manager_pager { @@ -1313,7 +1345,7 @@ float: right; padding: 1px 0; line-height: 18px; - width: 480px; + width: 400px; border: 1px solid #ababab; background: white; -moz-border-radius: 13px; @@ -1735,12 +1767,12 @@ width: auto; } .openerp .oe_form_nosheet { - margin-left: 10px; - margin-right: 10px; + margin: 20px; } .openerp .oe_form_nosheet > header { - margin-left: -10px; - margin-right: -10px; + margin-top: -20px; + margin-left: -20px; + margin-right: -20px; } .openerp .oe_form header { position: relative; @@ -1759,7 +1791,7 @@ display: inline-block; float: right; } -.openerp .oe_form footer { +.openerp .oe_form div.oe_chatter { min-width: 650px; max-width: 860px; margin: 0 auto; @@ -1811,18 +1843,19 @@ .openerp .oe_form .oe_subtotal_footer td.oe_form_group_cell_label { border-right: none; } -.openerp .oe_form .oe_subtotal_footer .oe_form_field { - width: auto !important; -} .openerp .oe_form .oe_subtotal_footer .oe_subtotal_footer_separator { + width: 108px; border-top: 1px solid #cacaca; - font-sie: 120%; font-weight: bold; + font-size: 18px; } .openerp .oe_form .oe_subtotal_footer label.oe_subtotal_footer_separator { font-weight: bold !important; padding: 2px 8px 2px 0px !important; } +.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; @@ -1864,8 +1897,8 @@ width: 100%; margin: 4px 0 4px 0; } -.openerp .oe_form .oe_form_group .oe_group_right > tbody > tr > td:first-child { - padding-left: 18px; +.openerp .oe_form .oe_form_group .oe_group_right { + margin-left: 18px; } .openerp .oe_form .oe_form_label_help[for], .openerp .oe_form .oe_form_label[for] { font-weight: bold; @@ -1935,15 +1968,6 @@ .openerp .oe_form .oe_form_field_text.oe_inline, .openerp .oe_form .oe_form_field_text.oe_inline > textarea { width: 500px; } -.openerp .oe_form .oe_form_field_float input { - width: 100px; -} -.openerp .oe_form h1 .oe_form_field_float input { - width: 140px; -} -.openerp .oe_form h2 .oe_form_field_float input { - width: 120px; -} .openerp .oe_form h1, .openerp .oe_form h2, .openerp .oe_form h3, .openerp .oe_form h4, .openerp .oe_form h5, .openerp .oe_form h6 { margin: 0 0 4px 0; } @@ -1960,18 +1984,6 @@ .openerp .oe_form .oe_form_field input { margin: 0px; } -.openerp .oe_form .oe_form_field_integer { - width: 180px; -} -.openerp .oe_form .oe_form_field_float { - width: 180px; -} -.openerp .oe_form .oe_form_field_date { - width: 7.5em; -} -.openerp .oe_form .oe_form_field_datetime { - width: 11em; -} .openerp .oe_form input[type="text"], .openerp .oe_form input[type="password"], .openerp .oe_form input[type="file"], .openerp .oe_form select { height: 22px; padding-top: 2px; @@ -2011,32 +2023,6 @@ padding-top: 4px; width: auto; } -.openerp .oe_form .oe_form_field_many2manytags .text-wrap { - width: 100% !important; -} -.openerp .oe_form .oe_form_field_many2manytags .text-wrap textarea { - width: 100% !important; -} -.openerp .oe_form .oe_form_field_many2manytags .oe_form_field_many2manytags_box { - border-radius: 2px; - -webkit-box-sizing: border-box; - -moz-box-sizing: border-box; - -ms-box-sizing: border-box; - box-sizing: border-box; - position: relative; - float: left; - border: 1px solid #9daccc; - background: #e2e6f0; - color: black; - padding: 0px 3px 0px 3px; - margin: 0 2px 2px 0; - height: 16px; - font: 11px "lucida grande", tahoma, verdana, arial, sans-serif; -} -.openerp .oe_form .oe_form_field_many2manytags .text-core .text-wrap .text-dropdown .text-list .text-suggestion em { - font-style: italic; - text-decoration: none; -} .openerp .oe_form .oe_datepicker_container { display: none; } @@ -2090,6 +2076,18 @@ position: relative; overflow: hidden; } +.openerp .oe_form_editable .oe_form .oe_form_field_integer { + width: 7em !important; +} +.openerp .oe_form_editable .oe_form .oe_form_field_float { + width: 8em !important; +} +.openerp .oe_form_editable .oe_form .oe_form_field_date { + width: 7.5em !important; +} +.openerp .oe_form_editable .oe_form .oe_form_field_datetime { + width: 11.5em !important; +} .openerp .oe_hidden_input_file { overflow: hidden; position: relative; @@ -2147,27 +2145,33 @@ .openerp .oe_form .oe_form_field_one2many > .oe_view_manager .oe_list_pager_single_page { display: none; } -.openerp .oe_form_field_one2many .oe_list .oe_list_edit_row_save { +.openerp .oe_form_field_one2many .oe_list_content > thead, .openerp .oe_form_field_many2many .oe_list_content > thead { + border-bottom: 1px; +} +.openerp .oe_form_field_one2many .oe_list_content > tbody tr:nth-child(odd), .openerp .oe_form_field_many2many .oe_list_content > tbody tr:nth-child(odd) { + background: transparent; +} +.openerp .oe_form_field_one2many .oe_list .oe_list_edit_row_save, .openerp .oe_form_field_many2many .oe_list .oe_list_edit_row_save { background: url(/web/static/src/img/iconset-b-remove.png) 50% 50% no-repeat; } -.openerp .oe_form_field_one2many .oe_list .oe_list_edit_row_save:before { +.openerp .oe_form_field_one2many .oe_list .oe_list_edit_row_save:before, .openerp .oe_form_field_many2many .oe_list .oe_list_edit_row_save:before { visibility: hidden; } -.openerp .oe_form_field_one2many > .oe_view_manager .oe_header_row_top { +.openerp .oe_form_field_one2many > .oe_view_manager .oe_header_row_top, .openerp .oe_form_field_many2many > .oe_view_manager .oe_header_row_top { display: none; } -.openerp .oe_form_field_one2many > .oe_view_manager .oe_view_manager_header2 td { +.openerp .oe_form_field_one2many > .oe_view_manager .oe_view_manager_header2 td, .openerp .oe_form_field_many2many > .oe_view_manager .oe_view_manager_header2 td { padding: 0px 8px; line-height: 16px; } -.openerp .oe_form_field_one2many > .oe_view_manager .oe_view_manager_header2 td .oe_i { +.openerp .oe_form_field_one2many > .oe_view_manager .oe_view_manager_header2 td .oe_i, .openerp .oe_form_field_many2many > .oe_view_manager .oe_view_manager_header2 td .oe_i { font-size: 13px; } -.openerp .oe_form_field_one2many > .oe_view_manager .oe_view_manager_header2 td .oe_pager_group { +.openerp .oe_form_field_one2many > .oe_view_manager .oe_view_manager_header2 td .oe_pager_group, .openerp .oe_form_field_many2many > .oe_view_manager .oe_view_manager_header2 td .oe_pager_group { height: auto; line-height: 16px; } -.openerp .oe_form_field_one2many > .oe_view_manager .oe_view_manager_header2 td .oe_pager_group li { +.openerp .oe_form_field_one2many > .oe_view_manager .oe_view_manager_header2 td .oe_pager_group li, .openerp .oe_form_field_many2many > .oe_view_manager .oe_view_manager_header2 td .oe_pager_group li { height: auto; line-height: 16px; } @@ -2228,6 +2232,9 @@ .openerp .oe_list_content > tbody > tr > td.oe_list_field_cell { padding: 3px 6px; } +.openerp .oe_list_content > tbody > tr > td.oe_list_field_cell progress { + width: 100%; +} .openerp .oe_list_content > tbody > tr > td, .openerp .oe_list_content > tbody > tr > th { line-height: 18px; } @@ -2247,6 +2254,7 @@ } .openerp .oe_list_content > tbody > tr > td.oe_number { text-align: right !important; + max-width: 100px; } .openerp .oe_list_content > tbody > tr:nth-child(odd) { background-color: #f0f0fa; diff --git a/addons/web/static/src/css/base.sass b/addons/web/static/src/css/base.sass index 162b530ff30..2232d223a38 100644 --- a/addons/web/static/src/css/base.sass +++ b/addons/web/static/src/css/base.sass @@ -214,6 +214,8 @@ $sheet-max-width: 860px @include radius(8px) @include box-shadow(0 1px 12px rgba(0, 0, 0, 0.6)) @include background-clip() + .ui-dialog-content + padding: 0px .ui-dialog-titlebar, .ui-dialog-content, .ui-dialog-buttonpane padding: 16px .ui-dialog-titlebar @@ -235,6 +237,8 @@ $sheet-max-width: 860px @include radius(0 0 2px 2px) button margin-left: 8px + .ui-dialog-buttonset + float: left .ui-dialog-titlebar-close padding: 0 .ui-icon-closethick @@ -254,6 +258,10 @@ $sheet-max-width: 860px color: black text-decoration: none + &.ui-dialog.oe_act_window + .ui-dialog-content + padding: 0px + .modal-backdrop position: fixed top: 0 @@ -356,8 +364,26 @@ $sheet-max-width: 860px text-decoration: none .oe_star_on color: gold - - //.oe_edit_only  + // }}} + // Tags (for many2many tags, among others) {{{ + .oe_tag + border-radius: 2px + @include box-sizing(border) + border: 1px solid #9DACCC + background: #E2E6F0 + color: black !important + padding: 0px 3px 0px 3px + margin: 0 2px 2px 0 + height: 16px + // font: 11px "lucida grande", tahoma, verdana, arial, sans-serif + .oe_tags + .text-wrap + width: 100% !important + textarea + width: 100% !important + .text-core .text-wrap .text-dropdown .text-list .text-suggestion em + font-style: italic + text-decoration: none // }}} // Tooltips {{{ &.oe_tooltip @@ -817,7 +843,7 @@ $sheet-max-width: 860px text-shadow: 0 1px 1px rgba(0,0,0,0.2) @include radius(4px) @include box-shadow(inset 0 1px 1px rgba(0, 0, 0, 0.2)) - .oe_menu_counter + .oe_menu_counter float: right background: #8a89ba color: #eee @@ -840,7 +866,7 @@ $sheet-max-width: 860px color: $colour4 text-shadow: 0 1px 1px white @include box-shadow(0 1px 1px rgba(0, 0, 0, 0.2)) - .oe_menu_counter + .oe_menu_counter background: #eee color: #8a89ba .oe_menu_toggler:before @@ -882,8 +908,9 @@ $sheet-max-width: 860px .oe_view_manager_view_kanban height: inherit - .oe_view_manager_header + table.oe_view_manager_header width: 100% + table-layout: fixed .oe_header_row //min-height: 26px //line-height: 26px @@ -894,7 +921,6 @@ $sheet-max-width: 860px padding-top: 0 .oe_view_manager_sidebar margin: 0px auto - width: 400px text-align: center td line-height: 26px @@ -1027,7 +1053,7 @@ $sheet-max-width: 860px float: right padding: 1px 0 line-height: 18px - width: 480px + width: 400px border: 1px solid #ababab background: white @include radius(13px) @@ -1306,7 +1332,7 @@ $sheet-max-width: 860px margin: 0 0 0 4px padding: 0 - + // }}} // Views Common {{{ .oe_view_nocontent @@ -1350,25 +1376,25 @@ $sheet-max-width: 860px display: none !important .oe_form .oe_form_field_date width: auto - .oe_form_nosheet - margin-left: 10px - margin-right: 10px + .oe_form_nosheet + margin: 20px .oe_form_nosheet > header - margin-left: -10px - margin-right: -10px + margin-top: -20px + margin-left: -20px + margin-right: -20px // }}} // FormView.custom tags and classes {{{ - .oe_form + .oe_form header position: relative border-bottom: 1px solid #cacaca @include vertical-gradient(#fcfcfc, #dedede) padding: 0 8px - line-height: 30px + line-height: 30px ul display: inline-block float: right - footer + div.oe_chatter min-width: 650px max-width: $sheet-max-width margin: 0 auto @@ -1381,12 +1407,12 @@ $sheet-max-width: 860px vertical-align: top margin-left: 8px li - border-right: none + border-right: none padding: 0 margin: 0 - float: left + float: left vertical-align: top - height: 30px + height: 30px padding: 0 0 0 12px &:first-child border-left: 1px solid #cacaca @@ -1408,21 +1434,22 @@ $sheet-max-width: 860px padding: 0 !important td.oe_form_group_cell_label border-right: none - .oe_form_field - width: auto !important .oe_subtotal_footer_separator + width: 108px border-top: 1px solid #cacaca - font-sie: 120% font-weight: bold + font-size: 18px label.oe_subtotal_footer_separator font-weight: bold !important padding: 2px 8px 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 + border-bottom: 1px solid #ddd .oe_form_sheet_width min-width: 650px max-width: $sheet-max-width @@ -1453,8 +1480,7 @@ $sheet-max-width: 860px width: 100% margin: 4px 0 4px 0 .oe_group_right - > tbody > tr > td:first-child - padding-left: 18px + margin-left: 18px // }}} // FormView.label {{{ .oe_form @@ -1515,12 +1541,6 @@ $sheet-max-width: 860px width: 100% .oe_form_field_text.oe_inline, .oe_form_field_text.oe_inline > textarea width: 500px - .oe_form_field_float input - width: 100px - h1 .oe_form_field_float input - width: 140px - h2 .oe_form_field_float input - width: 120px h1, h2, h3, h4, h5, h6 margin: 0 0 4px 0 input @@ -1533,14 +1553,6 @@ $sheet-max-width: 860px line-height: 18px input margin: 0px - .oe_form_field_integer - width: 180px - .oe_form_field_float - width: 180px - .oe_form_field_date - width: 7.5em - .oe_form_field_datetime - width: 11em input[type="text"], input[type="password"], input[type="file"], select height: 22px padding-top: 2px @@ -1566,26 +1578,6 @@ $sheet-max-width: 860px .oe_form_field_boolean padding-top: 4px width: auto - .oe_form_field_many2manytags - .text-wrap - width: 100% !important - textarea - width: 100% !important - .oe_form_field_many2manytags_box - border-radius: 2px - @include box-sizing(border) - position: relative - float: left - border: 1px solid #9DACCC - background: #E2E6F0 - color: black - padding: 0px 3px 0px 3px - margin: 0 2px 2px 0 - height: 16px - font: 11px "lucida grande", tahoma, verdana, arial, sans-serif - .text-core .text-wrap .text-dropdown .text-list .text-suggestion em - font-style: italic - text-decoration: none .oe_datepicker_container display: none .oe_datepicker_root @@ -1630,6 +1622,16 @@ $sheet-max-width: 860px > div position: relative overflow: hidden + .oe_form_editable + .oe_form + .oe_form_field_integer + width: 7em !important + .oe_form_field_float + width: 8em !important + .oe_form_field_date + width: 7.5em !important + .oe_form_field_datetime + width: 11.5em !important // }}} // FormView.fields_binary {{{ /* http://www.quirksmode.org/dom/inputfile.html @@ -1689,8 +1691,14 @@ $sheet-max-width: 860px .oe_form .oe_form_field_one2many > .oe_view_manager .oe_list_pager_single_page display: none - .oe_form_field_one2many + .oe_form_field_one2many,.oe_form_field_many2many // TODO: oe_form_field_one2many_list? + .oe_list_content + > thead + border-bottom: 1px + > tbody + tr:nth-child(odd) + background: transparent .oe_list .oe_list_edit_row_save background: url(/web/static/src/img/iconset-b-remove.png) 50% 50% no-repeat &:before @@ -1758,6 +1766,8 @@ $sheet-max-width: 860px border-top: 1px solid #ddd > td.oe_list_field_cell padding: 3px 6px + progress + width: 100% > td, > th line-height: 18px > button @@ -1771,6 +1781,7 @@ $sheet-max-width: 860px border-width: 0 > td.oe_number text-align: right !important + max-width: 100px > tr:nth-child(odd) background-color: #f0f0fa @include vertical-gradient(#f0f0fa, #eeeef6) diff --git a/addons/web/static/src/js/chrome.js b/addons/web/static/src/js/chrome.js index c32d4feafe1..094e2f184e6 100644 --- a/addons/web/static/src/js/chrome.js +++ b/addons/web/static/src/js/chrome.js @@ -63,7 +63,7 @@ instance.web.Dialog = instance.web.Widget.extend({ this.dialog_options = { modal: true, destroy_on_close: true, - width: 750, + width: 900, min_width: 0, max_width: '95%', height: 'auto', @@ -145,9 +145,9 @@ instance.web.Dialog = instance.web.Widget.extend({ _.each(this.getChildren(), function(el) { el.destroy(); }); - if (! this.isDestroyed()) { - this.$element.dialog('destroy'); - } + if (! this.isDestroyed()) { + this.$element.dialog('destroy'); + } this._super(); } }); @@ -212,11 +212,11 @@ instance.web.CrashManager = instance.web.CallbackEnabled.extend({ dialog.$element.html(QWeb.render('CrashManager.error', {session: instance.connection, error: error})); }, on_javascript_exception: function(exception) { - this.on_traceback({ - type: _t("Client Error"), - message: exception, - data: {debug: ""} - }); + this.on_traceback({ + type: _t("Client Error"), + message: exception, + data: {debug: ""} + }); }, }); @@ -482,24 +482,26 @@ instance.web.Login = instance.web.Widget.extend({ } } }, + open_db_manager: function(){ + var self = this; + self.$element.find('.oe_login_bottom').hide(); + self.$element.find('.oe_login_pane').hide(); + self.databasemanager = new instance.web.DatabaseManager(self); + self.databasemanager.appendTo(self.$element); + self.databasemanager.do_exit.add_last(function() { + self.databasemanager.destroy(); + self.$element.find('.oe_login_bottom').show(); + self.$element.find('.oe_login_pane').show(); + self.load_db_list(true).then(self.on_db_list_loaded); + }); + }, start: function() { var self = this; - self.$element.find("form").submit(self.on_submit); - self.$element.find('.oe_login_manage_db').click(function() { - self.$element.find('.oe_login_bottom').hide(); - self.$element.find('.oe_login_pane').hide(); - self.databasemanager = new instance.web.DatabaseManager(self); - self.databasemanager.appendTo(self.$element); - self.databasemanager.do_exit.add_last(function() { - self.databasemanager.destroy(); - self.$element.find('.oe_login_bottom').show(); - self.$element.find('.oe_login_pane').show(); - self.load_db_list(true).then(self.proxy('_db_list_loaded')); - }); + self.open_db_manager(); }); - return self.load_db_list().then(self.proxy('_db_list_loaded')); + return self.load_db_list().then(self.on_db_list_loaded); }, load_db_list: function (force) { var d = $.when(), self = this; @@ -514,11 +516,14 @@ instance.web.Login = instance.web.Widget.extend({ } return d; }, - _db_list_loaded: function () { - var list = this._db_list, - dbdiv = this.$element.find('div.oe_login_dbpane'); + on_db_list_loaded: function () { + var self = this; + var list = this._db_list; + var dbdiv = this.$element.find('div.oe_login_dbpane'); this.$element.find("[name=db]").replaceWith(instance.web.qweb.render('Login.dblist', { db_list: list, selected_db: this.selected_db})); - if(list && list.length === 1) { + if(list.length === 0) { + self.open_db_manager(); + } else if(list && list.length === 1) { dbdiv.hide(); } else { dbdiv.show(); @@ -667,7 +672,7 @@ instance.web.Menu = instance.web.Widget.extend({ * @param {Number} id the action_id to match */ open_action: function (id) { - var $menu = this.$element.add(this.$secondary_menus).find('a[data-action-id=' + id + ']'); + var $menu = this.$element.add(this.$secondary_menus).find('a[data-action-id="' + id + '"]'); var menu_id = $menu.data('menu'); if (menu_id) { this.open_menu(menu_id); diff --git a/addons/web/static/src/js/coresetup.js b/addons/web/static/src/js/coresetup.js index a00ca4002e5..a5a62b9bcc1 100644 --- a/addons/web/static/src/js/coresetup.js +++ b/addons/web/static/src/js/coresetup.js @@ -404,10 +404,11 @@ instance.web.Session = instance.web.JsonRPC.extend( /** @lends instance.web.Sess } }); + /** * Event Bus used to bind events scoped in the current instance */ -instance.web.bus = new (instance.web.Class.extend(instance.web.EventDispatcherMixin, { +instance.web.Bus = instance.web.Class.extend(instance.web.EventDispatcherMixin, { init: function() { instance.web.EventDispatcherMixin.init.call(this, parent); var self = this; @@ -425,7 +426,8 @@ instance.web.bus = new (instance.web.Class.extend(instance.web.EventDispatcherMi }); }); } -}))(); +}) +instance.web.bus = new instance.web.Bus(); /** OpenERP Translations */ instance.web.TranslationDataBase = instance.web.Class.extend(/** @lends instance.web.TranslationDataBase# */{ diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index a90654b2cf5..b103ce83699 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -9,7 +9,7 @@ instance.web.form = {}; /** * Interface implemented by the form view or any other object * able to provide the features necessary for the fields to work. - * + * * Properties: * - display_invalid_fields : if true, all fields where is_valid() return true should * be displayed as invalid. @@ -526,7 +526,7 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM this.on_form_changed(); } if (!_.isEmpty(result.warning)) { - instance.web.dialog($(QWeb.render("CrashManager.warning", result.warning)), { + instance.web.dialog($(QWeb.render("CrashManager.warning", result.warning)), { title:result.warning.title, modal: true, buttons: [ @@ -955,7 +955,7 @@ instance.web.form.FormRenderingEngineInterface = instance.web.Class.extend({ /** * Default rendering engine for the form view. - * + * * It is necessary to set the view using set_view() before usage. */ instance.web.form.FormRenderingEngine = instance.web.form.FormRenderingEngineInterface.extend({ @@ -1278,7 +1278,7 @@ instance.web.form.FormRenderingEngine = instance.web.form.FormRenderingEngineInt page_attrs.__page = $new_page; page_attrs.__ic = ic; pages.push(page_attrs); - + $new_page.children().each(function() { self.process($(this)); }); @@ -1304,7 +1304,7 @@ instance.web.form.FormRenderingEngine = instance.web.form.FormRenderingEngineInt } }); }); - + this.handle_common_properties($new_notebook, $notebook); return $new_notebook; }, @@ -1605,7 +1605,7 @@ instance.web.form.FormWidget = instance.web.Widget.extend(instance.web.form.Invi if (! v_context) { v_context = (this.field || {}).context || {}; } - + if (v_context.__ref || true) { //TODO: remove true var fields_values = this._build_eval_context(blacklist); v_context = new instance.web.CompoundContext(v_context).set_eval_context(fields_values); @@ -1713,14 +1713,14 @@ instance.web.form.WidgetButton = instance.web.form.FormWidget.extend({ /** * Interface to be implemented by fields. - * + * * Properties: * - readonly: boolean. If set to true the field should appear in readonly mode. * - force_readonly: boolean, When it is true, the field should always appear * in read only mode, no matter what the value of the "readonly" property can be. * Events: * - changed_value: triggered to inform the view to check on_changes - * + * */ instance.web.form.FieldInterface = { /** @@ -1731,14 +1731,14 @@ instance.web.form.FieldInterface = { init: function(field_manager, node) {}, /** * Called by the form view to indicate the value of the field. - * + * * set_value() may return an object that can be passed to $.when() that represents the moment when * the field has finished all operations necessary before the user can effectively use the widget. - * + * * Multiple calls to set_value() can occur at any time and must be handled correctly by the implementation, * regardless of any asynchronous operation currently running and the status of any promise that a * previous call to set_value() could have returned. - * + * * set_value() must be able, at any moment, to handle the syntax returned by the "read" method of the * osv class in the OpenERP server as well as the syntax used by the set_value() (see below). It must * also be able to handle any other format commonly used in the _defaults key on the models in the addons @@ -1748,16 +1748,16 @@ instance.web.form.FieldInterface = { set_value: function(value_) {}, /** * Get the current value of the widget. - * + * * Must always return a syntaxically correct value to be passed to the "write" method of the osv class in * the OpenERP server, although it is not assumed to respect the constraints applied to the field. * For example if the field is marqued as "required", a call to get_value() can return false. - * + * * get_value() can also be called *before* a call to set_value() and, in that case, is supposed to * return a defaut value according to the type of field. - * + * * This method is always assumed to perform synchronously, it can not return a promise. - * + * * If there was no user interaction to modify the value of the field, it is always assumed that * get_value() return the same semantic value than the one passed in the last call to set_value(), * altough the syntax can be different. This can be the case for type of fields that have a different @@ -1787,14 +1787,14 @@ instance.web.form.FieldInterface = { /** * Abstract class for classes implementing FieldInterface. - * + * * Properties: * - effective_readonly: when it is true, the widget is displayed as readonly. Vary depending * the values of the "readonly" property and the "force_readonly" property on the field manager. * - value: useful property to hold the value of the field. By default, set_value() and get_value() * set and retrieve the value property. Changing the value property also triggers automatically * a 'changed_value' event that inform the view to trigger on_changes. - * + * */ instance.web.form.AbstractField = instance.web.form.FormWidget.extend(instance.web.form.FieldInterface, { /** @@ -1813,7 +1813,7 @@ instance.web.form.AbstractField = instance.web.form.FormWidget.extend(instance.w this.string = this.node.attrs.string || this.field.string || this.name; this.set({'value': false}); this.set({required: this.modifiers['required'] === true}); - + // some events to make the property "effective_readonly" sync automatically with "readonly" and // "force_readonly" this.set({"readonly": this.modifiers['readonly'] === true}); @@ -1823,7 +1823,7 @@ instance.web.form.AbstractField = instance.web.form.FormWidget.extend(instance.w this.on("change:readonly", this, test_effective_readonly); this.on("change:force_readonly", this, test_effective_readonly); _.bind(test_effective_readonly, this)(); - + this.on("change:value", this, function() { if (! this._inhibit_on_change) this.trigger('changed_value'); @@ -2005,7 +2005,7 @@ instance.web.form.FieldChar = instance.web.form.AbstractField.extend(instance.we }); instance.web.form.FieldID = instance.web.form.FieldChar.extend({ - + }); instance.web.form.FieldEmail = instance.web.form.FieldChar.extend({ @@ -2398,7 +2398,7 @@ instance.web.form.FieldSelection = instance.web.form.AbstractField.extend(instan } else { var self = this; var option = _(this.values) - .detect(function (record) { return record[0] === self.get('value'); }); + .detect(function (record) { return record[0] === self.get('value'); }); this.$element.text(option ? option[1] : this.values[0][1]); } }, @@ -2577,7 +2577,7 @@ instance.web.form.FieldMany2One = instance.web.form.AbstractField.extend(instanc render_editable: function() { var self = this; this.$input = this.$element.find("input"); - + self.$input.tipsy({ title: function() { return "No element was selected, you should create or select one from the dropdown list."; @@ -2585,10 +2585,10 @@ instance.web.form.FieldMany2One = instance.web.form.AbstractField.extend(instanc trigger:'manual', fade: true, }); - + this.$drop_down = this.$element.find(".oe_m2o_drop_down_button"); this.$follow_button = $(".oe_m2o_cm_button", this.$element); - + this.$follow_button.click(function() { if (!self.get('value')) { self.focus(); @@ -2882,7 +2882,7 @@ instance.web.form.FieldOne2Many = instance.web.form.AbstractField.extend({ }, load_views: function() { var self = this; - + var modes = this.node.attrs.mode; modes = !!modes ? modes.split(",") : ["tree"]; var views = []; @@ -3464,7 +3464,7 @@ instance.web.form.FieldMany2ManyTags = instance.web.form.AbstractField.extend(in $("textarea", self.$element).css("padding-left", "3px"); self.tags.addTags(_.map(data, function(el) {return {name: el[1], id:el[0]};})); } else { - self.$element.html(QWeb.render("FieldMany2ManyTags.box", {elements: data})); + self.$element.html(QWeb.render("FieldMany2ManyTag", {elements: data})); } }; if (! self.get('values') || self.get('values').length > 0) { @@ -3636,7 +3636,7 @@ instance.web.form.FieldMany2ManyKanban = instance.web.form.AbstractField.extend( this.dataset.on_unlink.add_last(function(ids) { self.dataset_changed(); }); - + this.is_setted.then(function() { self.load_view(); }); @@ -3752,7 +3752,7 @@ instance.web.form.Many2ManyKanbanView = instance.web_kanban.KanbanView.extend({ }); instance.web.form.Many2ManyQuickCreate = instance.web.Widget.extend({ template: 'Many2ManyKanban.quick_create', - + /** * close_btn: If true, the widget will display a "Close" button able to trigger * a "close" event. @@ -3868,8 +3868,8 @@ instance.web.form.AbstractFormPopup = instance.web.OldWidget.extend({ var self = this; this.renderElement(); new instance.web.Dialog(this, { - width: '90%', min_width: '800px', + dialogClass: 'oe_act_window', close: function() { self.check_exit(true); }, @@ -4445,7 +4445,7 @@ instance.web.form.FieldStatus = instance.web.form.AbstractField.extend({ this.selection = []; // get fold information from widget var fold = ((this.node.attrs || {}).statusbar_fold || true); - // build final domain: if fold option required, add the + // build final domain: if fold option required, add the if (fold == true) { var domain = new instance.web.CompoundDomain(['|'], ['&'], self.build_domain(), [['fold', '=', false]], [['id', '=', self.selected_value]]); } else { @@ -4477,7 +4477,7 @@ instance.web.form.FieldStatus = instance.web.form.AbstractField.extend({ var shown = _.map(((this.node.attrs || {}).statusbar_visible || "").split(","), function(x) { return _.str.trim(x); }); shown = _.select(shown, function(x) { return x.length > 0; }); - + if (shown.length == 0) { this.to_show = this.selection; } else { diff --git a/addons/web/static/src/js/view_list.js b/addons/web/static/src/js/view_list.js index 3033404b387..edc53f82042 100644 --- a/addons/web/static/src/js/view_list.js +++ b/addons/web/static/src/js/view_list.js @@ -1045,7 +1045,7 @@ instance.web.ListView.List = instance.web.Class.extend( /** @lends instance.web. render_cell: function () { return self.render_cell.apply(self, arguments); } }, this))); - this.pad_table_to(5); + this.pad_table_to(4); }, pad_table_to: function (count) { if (this.records.length >= count || diff --git a/addons/web/static/src/js/views.js b/addons/web/static/src/js/views.js index 423bf3f9d46..e11adb9d595 100644 --- a/addons/web/static/src/js/views.js +++ b/addons/web/static/src/js/views.js @@ -178,7 +178,7 @@ instance.web.ActionManager = instance.web.Widget.extend({ }); }, do_action: function(action, on_close) { - if (_.isNumber(action)) { + if (_.isNumber(action) || _.isString(action)) { var self = this; return self.rpc("/web/action/load", { action_id: action }, function(result) { self.do_action(result.result, on_close); @@ -220,7 +220,11 @@ instance.web.ActionManager = instance.web.Widget.extend({ } if (action.target === 'new') { if (this.dialog === null) { - this.dialog = new instance.web.Dialog(this, { width: '80%' }); + // These buttons will be overwrited by