+
diff --git a/addons/sales_team/sales_team.py b/addons/sales_team/sales_team.py
index e18cc3213e1..def12c2468d 100644
--- a/addons/sales_team/sales_team.py
+++ b/addons/sales_team/sales_team.py
@@ -65,7 +65,7 @@ class crm_case_section(osv.osv):
_columns = {
'name': fields.char('Sales Team', size=64, required=True, translate=True),
- 'complete_name': fields.function(get_full_name, type='char', size=256, readonly=True, store=True),
+ 'complete_name': fields.function(get_full_name, type='char', size=256, readonly=True, store=True, string="Full Name"),
'code': fields.char('Code', size=8),
'active': fields.boolean('Active', help="If the active field is set to "\
"true, it will allow you to hide the sales team without removing it."),
diff --git a/addons/share/static/src/js/share.js b/addons/share/static/src/js/share.js
index 2211295ae60..530b07c2b71 100644
--- a/addons/share/static/src/js/share.js
+++ b/addons/share/static/src/js/share.js
@@ -94,7 +94,7 @@ openerp.share = function(session) {
}
});
- session.web.ViewManagerAction.include({
+ session.web.ViewManager.include({
start: function() {
var self = this;
this.check_if_action_is_defined();
diff --git a/addons/web/static/src/css/base.css b/addons/web/static/src/css/base.css
index 23fb4ed2f09..e0fe28a58f9 100644
--- a/addons/web/static/src/css/base.css
+++ b/addons/web/static/src/css/base.css
@@ -8,7 +8,6 @@
font-weight: normal;
font-style: normal;
}
-
@font-face {
font-family: "EntypoRegular";
src: url("/web/static/src/font/entypo-webfont.eot") format("eot");
@@ -19,7 +18,6 @@
font-weight: normal;
font-style: normal;
}
-
#oe_main_menu_navbar {
min-height: 34px;
z-index: 1001;
@@ -161,16 +159,16 @@
}
.openerp .zebra tbody tr:hover td {
background-color: #e6e6e6;
- background-image: -webkit-gradient(linear, left top, left bottom, from(#eeeeee), to(#dedede));
- background-image: -webkit-linear-gradient(top, #eeeeee, #dedede);
- background-image: -moz-linear-gradient(top, #eeeeee, #dedede);
- background-image: -ms-linear-gradient(top, #eeeeee, #dedede);
- background-image: -o-linear-gradient(top, #eeeeee, #dedede);
- background-image: linear-gradient(to bottom, #eeeeee, #dedede);
+ background-image: -webkit-gradient(linear, left top, left bottom, from(#eee), to(#dedede));
+ background-image: -webkit-linear-gradient(top, #eee, #dedede);
+ background-image: -moz-linear-gradient(top, #eee, #dedede);
+ background-image: -ms-linear-gradient(top, #eee, #dedede);
+ background-image: -o-linear-gradient(top, #eee, #dedede);
+ background-image: linear-gradient(to bottom, #eee, #dedede);
}
.openerp input, .openerp textarea, .openerp select {
padding: 2px 4px;
- border: 1px solid #cccccc;
+ border: 1px solid #ccc;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
border-radius: 3px;
@@ -184,7 +182,7 @@
font-weight: bold;
font-size: inherit;
}
-.openerp a.button:link, .openerp a.button:visited, .openerp button, .openerp .oe_button, .openerp input[type='submit'] {
+.openerp a.button:link, .openerp a.button:visited, .openerp .oe_button, .openerp input[type='submit'] {
display: inline-block;
border: 1px solid rgba(0, 0, 0, 0.4);
color: #4c4c4c;
@@ -209,7 +207,7 @@
-webkit-font-smoothing: antialiased;
outline: none;
}
-.openerp a.button:hover, .openerp button:hover, .openerp .oe_button:hover, .openerp input[type='submit']:hover {
+.openerp a.button:hover, .openerp .oe_button:hover, .openerp input[type='submit']:hover {
background-color: #ececec;
background-image: -webkit-gradient(linear, left top, left bottom, from(#f6f6f6), to(#e3e3e3));
background-image: -webkit-linear-gradient(top, #f6f6f6, #e3e3e3);
@@ -220,7 +218,7 @@
cursor: pointer;
background-position: 0;
}
-.openerp a.button:focus, .openerp button:focus, .openerp .oe_button:focus, .openerp input[type='submit']:focus {
+.openerp a.button:focus, .openerp .oe_button:focus, .openerp input[type='submit']:focus {
border: 1px solid #80bfff;
background-position: 0;
background-color: #ececec;
@@ -234,7 +232,7 @@
-webkit-box-shadow: 0 0 3px #80bfff, 0 1px 1px rgba(255, 255, 255, 0.8) inset;
box-shadow: 0 0 3px #80bfff, 0 1px 1px rgba(255, 255, 255, 0.8) inset;
}
-.openerp a.button:active, .openerp a.button.active, .openerp button:active, .openerp .oe_button:active, .openerp .oe_button.active, .openerp input[type='submit']:active, .openerp input[type='submit'].active {
+.openerp a.button:active, .openerp a.button.active, .openerp .oe_button:active, .openerp .oe_button.active, .openerp input[type='submit']:active, .openerp input[type='submit'].active {
background-color: #ececec;
background-image: -webkit-gradient(linear, left top, left bottom, from(#e3e3e3), to(#f6f6f6));
background-image: -webkit-linear-gradient(top, #e3e3e3, #f6f6f6);
@@ -246,18 +244,18 @@
-webkit-box-shadow: none;
box-shadow: none;
}
-.openerp a.button.disabled, .openerp button:disabled, .openerp .oe_button:disabled, .openerp input[type='submit']:disabled {
+.openerp a.button.disabled, .openerp .oe_button:disabled, .openerp input[type='submit']:disabled {
background: #efefef !important;
border: 1px solid #d1d1d1 !important;
-moz-box-shadow: none !important;
-webkit-box-shadow: none !important;
box-shadow: none !important;
- color: #aaaaaa !important;
+ color: #aaa !important;
cursor: default;
- text-shadow: 0 1px 1px white !important;
+ text-shadow: 0 1px 1px #fff !important;
}
.openerp .ui-widget-content a {
- color: #7c7bad;
+ color: #7C7BAD;
}
.openerp .oe_bounce_container {
display: inline-block;
@@ -305,7 +303,7 @@
cursor: wait;
}
.openerp .oe_fade {
- color: #888888;
+ color: #888;
font-weight: normal;
}
.openerp .oe_bold {
@@ -316,7 +314,7 @@
}
.openerp .oe_highlight {
color: white;
- background: #dc5f59;
+ background: #DC5F59;
}
.openerp button.oe_highlight {
background-color: #c02c2c;
@@ -349,7 +347,7 @@
background-image: linear-gradient(to bottom, #c52020, #d22323);
}
.openerp .oe_background_grey {
- background: #eeeeee !important;
+ background: #eee !important;
}
.openerp .oe_form_dirty .oe_highlight_on_dirty {
color: white;
@@ -369,7 +367,7 @@
box-shadow: none;
}
.openerp .oe_form_dirty button.oe_highlight_on_dirty:hover {
- background: #ed6f6a;
+ background: #ED6F6A;
}
.openerp .oe_warning_redirect {
border: none !important;
@@ -385,7 +383,7 @@
font-weight: normal;
width: 132px !important;
height: 40px;
- color: #666666;
+ color: #666;
margin: 0px -1px -1px 0px;
padding: 0;
border: 1px solid #dddddd;
@@ -401,7 +399,7 @@
line-height: 120%;
}
.openerp .oe_stat_button .stat_button_icon {
- color: #7c7bad;
+ color: #7C7BAD;
font-size: 24px;
padding: 0px 3px;
width: 37px;
@@ -482,7 +480,7 @@
-moz-box-shadow: none;
-webkit-box-shadow: none;
box-shadow: none;
- color: #7c7bad;
+ color: #7C7BAD;
font-weight: bold;
}
.openerp .oe_button.oe_link span:hover {
@@ -505,7 +503,7 @@
max-width: 650px;
}
.openerp .oe_grey {
- color: #aaaaaa;
+ color: #aaa;
}
.openerp .oe_error_detail hr {
display: block;
@@ -525,10 +523,10 @@
-webkit-border-radius: 6px;
border-radius: 6px;
background-position: center center;
- background-image: -webkit-radial-gradient(circle, #eeeeee 0%, #cccccc 40%, #bbbbbb 100%);
- background-image: -moz-radial-gradient(#eeeeee 0%, #cccccc 40%, #bbbbbb 100%);
- background-image: -ms-radial-gradient(#eeeeee 0%, #cccccc 40%, #bbbbbb 100%);
- background-image: radial-gradient(circle, #eeeeee 0%, #cccccc 40%, #bbbbbb 100%);
+ background-image: -webkit-radial-gradient(circle, #eee 0%, #ccc 40%, #bbb 100%);
+ background-image: -moz-radial-gradient(#eee 0%, #ccc 40%, #bbb 100%);
+ background-image: -ms-radial-gradient(#eee 0%, #ccc 40%, #bbb 100%);
+ background-image: radial-gradient(circle, #eee 0%, #ccc 40%, #bbb 100%);
}
.openerp .oe_kanban_status_green {
background: green;
@@ -562,11 +560,11 @@
-webkit-border-radius: 3px;
border-radius: 3px;
background: #f0f0fa;
- color: #4c4c4c;
+ color: #4C4C4C;
}
.openerp .oe_tag_dark {
- background: #7c7bad;
- color: #eeeeee;
+ background: #7C7BAD;
+ color: #eee;
}
.openerp .oe_form_field_radio.oe_horizontal {
white-space: nowrap;
@@ -636,13 +634,13 @@
}
.openerp .oe_notebook > li > a {
display: block;
- color: gray;
+ color: #808080;
}
.openerp .oe_notebook > li.ui-tabs-active > a {
color: #4c4c4c;
}
.openerp .oe_notebook {
- border-color: #dddddd;
+ border-color: #ddd;
border-style: solid;
border-width: 0 0 1px;
}
@@ -660,16 +658,16 @@
}
.openerp .oe_notebook > li > a:hover {
text-decoration: none;
- background-color: #eeeeee;
- border-color: #eeeeee #eeeeee #dddddd;
+ background-color: #eee;
+ border-color: #eee #eee #ddd;
}
.openerp .ui-tabs .oe_notebook.ui-tabs-nav li.ui-tabs-active {
border-bottom: none;
padding-bottom: 1px;
}
.openerp .oe_notebook > li.ui-state-active > a, .openerp .oe_notebook > li.ui-state-active > a:hover {
- background-color: white;
- border: 1px solid #dddddd;
+ background-color: #ffffff;
+ border: 1px solid #ddd;
border-bottom-color: transparent;
cursor: default;
}
@@ -690,7 +688,7 @@
cursor: pointer;
}
.openerp .oe_dropdown_toggle {
- color: #2b2b2b;
+ color: #2B2B2B;
font-weight: normal;
}
.openerp .oe_dropdown_hover:hover .oe_dropdown_menu, .openerp .oe_dropdown_menu.oe_opened {
@@ -752,59 +750,6 @@
filter: alpha(opacity=50);
opacity: 0.5;
}
-.openerp .oe_sidebar {
- white-space: nowrap;
-}
-.openerp .oe_sidebar .oe_dropdown_menu .oe_sidebar_add_attachment {
- height: 20px;
- cursor: pointer;
- padding-left: 6px;
- margin-top: 6px;
-}
-.openerp .oe_sidebar .oe_dropdown_menu .oe_sidebar_add_attachment span {
- font-weight: bold;
-}
-.openerp .oe_sidebar .oe_dropdown_menu .oe_sidebar_add_attachment .oe_hidden_input_file {
- width: 200px;
-}
-.openerp .oe_sidebar .oe_dropdown_menu .oe_sidebar_add_attachment:hover {
- background-color: #efeff8;
- background-image: -webkit-gradient(linear, left top, left bottom, from(#f0f0fa), to(#eeeef6));
- background-image: -webkit-linear-gradient(top, #f0f0fa, #eeeef6);
- background-image: -moz-linear-gradient(top, #f0f0fa, #eeeef6);
- background-image: -ms-linear-gradient(top, #f0f0fa, #eeeef6);
- background-image: -o-linear-gradient(top, #f0f0fa, #eeeef6);
- background-image: linear-gradient(to bottom, #f0f0fa, #eeeef6);
- -moz-box-shadow: none;
- -webkit-box-shadow: none;
- box-shadow: none;
-}
-.openerp .oe_sidebar .oe_dropdown_menu li .oe_sidebar_delete_item {
- position: absolute;
- top: 4px;
- right: 4px;
- display: none;
- width: 12px;
- height: 12px;
- padding: 1px;
- color: #8786b7;
- line-height: 8px;
- text-align: center;
- font-weight: bold;
- text-shadow: 0 1px 1px white;
-}
-.openerp .oe_sidebar .oe_dropdown_menu li .oe_sidebar_delete_item:hover {
- text-decoration: none;
- color: white;
- background: #8786b7;
- text-shadow: 0 1px 1px rgba(0, 0, 0, 0.4);
- -moz-border-radius: 2px;
- -webkit-border-radius: 2px;
- border-radius: 2px;
-}
-.openerp .oe_sidebar .oe_dropdown_menu li:hover .oe_sidebar_delete_item {
- display: inline-block;
-}
.openerp .oe_loading {
display: none;
z-index: 1001;
@@ -812,10 +757,10 @@
top: 0;
right: 50%;
padding: 4px 12px;
- background: #a61300;
+ background: #A61300;
color: white;
text-align: center;
- border: 1px solid #990000;
+ border: 1px solid #900;
border-top: none;
-moz-border-radius-bottomright: 8px;
-moz-border-radius-bottomleft: 8px;
@@ -833,12 +778,12 @@
width: 32px;
}
.openerp .oe_database_manager {
- background: white;
- color: black;
+ background: #fff;
+ color: #000;
text-align: left;
}
.openerp .oe_database_manager .oe_database_manager_menu {
- color: black;
+ color: #000;
}
.openerp .oe_webclient {
width: 100%;
@@ -881,7 +826,7 @@
width: 100%;
display: none;
text-align: center;
- color: #eeeeee;
+ color: #eee;
background: rgba(37, 37, 37, 0.9);
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
@@ -923,7 +868,7 @@
.openerp .oe_secondary_menu_section {
font-weight: bold;
margin-left: 8px;
- color: #7c7bad;
+ color: #7C7BAD;
}
.openerp .oe_secondary_submenu {
margin-bottom: 10px !important;
@@ -1003,7 +948,7 @@
}
.openerp .oe_about .user-details .user-info-block .navigation li.active a {
background: #a24689;
- color: white;
+ color: #fff;
}
.openerp .oe_about .user-details .user-info-block .user-body {
text-align: center;
@@ -1027,10 +972,10 @@
transform: scale(1.3);
}
.openerp .oe_about #social .social-fb:hover {
- color: #3b5998;
+ color: #3B5998;
}
.openerp .oe_about #social .social-tw:hover {
- color: #4099ff;
+ color: #4099FF;
}
.openerp .oe_about #social .social-gp:hover {
color: #d34836;
@@ -1044,251 +989,177 @@
.openerp .oe_application {
width: 100%;
height: 100%;
-}
-.openerp .oe_application a {
- color: #7c7bad;
+ overflow: hidden;
}
.openerp .oe_application > div {
position: relative;
height: 100%;
}
-.openerp .oe_application > div > .oe_view_manager > .oe_view_manager_wrapper {
+.openerp .oe_application .oe-view-manager .oe-view-manager-debug {
+ margin-right: 5px;
+}
+.openerp .oe_application .oe-view-manager .oe-view-manager-content {
display: table-row;
height: 100%;
}
-.openerp .oe_application > div > .oe_view_manager > .oe_view_manager_wrapper > div {
+.openerp .oe_application .oe-view-manager-body {
position: relative;
height: 100%;
}
-.openerp .oe_application > div > .oe_view_manager > .oe_view_manager_wrapper > div > .oe_view_manager_body {
+.openerp .oe_application .oe-view-manager-body a {
+ color: #7C7BAD;
+}
+.openerp .oe_application .oe-view-manager-body .oe-view-manager-view-kanban:not(:empty) {
+ height: 100%;
+}
+.openerp .oe_application .oe-view-manager-body > div {
position: absolute;
- position: static\9;
top: 0;
bottom: 0;
left: 0;
right: 0;
overflow: auto;
}
-.openerp .oe_application .oe_breadcrumb_item:not(:last-child) {
- max-width: 7em;
- white-space: nowrap;
- text-overflow: ellipsis;
+.openerp .oe_application .oe_form_field_one2many .oe-view-manager-views {
+ position: initial;
}
-.openerp .oe_application .oe_breadcrumb_title > * {
+.openerp .oe-view-manager {
+ display: table;
+ width: 100%;
+ height: 100%;
+}
+.openerp .oe-view-manager-header {
+ display: table-row;
+ background-color: #f0eeee;
+ border-bottom: 1px solid #afafb6;
+ -webkit-user-select: none;
+ -moz-user-select: none;
+ user-select: none;
+}
+.openerp .oe-view-manager-header .dropdown-menu li {
+ position: relative;
+}
+.openerp .oe-view-manager-header .dropdown-menu li a {
+ padding: 3px 25px;
+}
+.openerp .oe-view-manager-header .oe-right-toolbar {
+ float: right;
+}
+.openerp .oe-view-manager-header .oe-right-toolbar > div {
display: inline-block;
- overflow: hidden;
+}
+.openerp .oe-view-manager-header .row {
+ margin: 0;
+}
+.openerp .oe-view-manager-header .row:first-child {
+ padding-top: 3px;
+ padding-bottom: 3px;
+}
+.openerp .oe-view-manager-header .row:last-child {
+ padding-bottom: 10px;
+}
+.openerp .oe-view-manager-header .oe_tag {
+ -moz-border-radius: 0px;
+ -webkit-border-radius: 0px;
+ border-radius: 0px;
+}
+.openerp .oe-view-manager-header .oe-view-title {
+ font-size: 18px;
+ padding-left: 0;
+ margin: 0;
+ background-color: #f0eeee;
+}
+.openerp .oe-view-manager-header .oe-view-title li {
+ -moz-user-select: initial;
+ -webkit-user-select: initial;
+ user-select: initial;
+}
+.openerp .oe-view-manager-header .oe-view-manager-search-view {
+ padding-top: 5px;
+}
+.openerp .oe-view-manager-header .oe-view-manager-switch .oe-vm-switch-kanban:before {
+ content: "";
+}
+.openerp .oe-view-manager-header .oe-view-manager-switch .oe-vm-switch-list:before {
+ content: "";
+}
+.openerp .oe-view-manager-header .oe-view-manager-switch .oe-vm-switch-form:before {
+ content: "";
+}
+.openerp .oe-view-manager-header .oe-view-manager-switch .oe-vm-switch-graph:before {
+ content: "";
+}
+.openerp .oe-view-manager-header .oe-view-manager-switch .oe-vm-switch-calendar:before {
+ content: "";
+}
+.openerp .oe-view-manager-header .oe-view-manager-switch .oe-vm-switch-gantt:before {
+ content: "";
+}
+.openerp .oe-view-manager-header .oe-view-manager-switch .oe-vm-switch-pivot:before {
+ content: "";
+}
+.openerp .oe-view-manager-header .oe-view-manager-buttons {
+ display: inline-block;
+}
+.openerp .oe-view-manager-header .oe-view-manager-buttons > div {
+ display: none;
+}
+.openerp .oe-view-manager-header .oe-view-manager-sidebar {
+ display: inline-block;
+ float: right;
+}
+.openerp .oe-view-manager-header .oe-view-manager-sidebar .oe_form_binary_form {
+ cursor: pointer;
+}
+.openerp .oe-view-manager-header .oe-view-manager-sidebar .oe_form_binary_form span {
+ padding: 3px 20px;
+}
+.openerp .oe-view-manager-header .oe-view-manager-sidebar .oe_form_binary_form input.oe_form_binary_file {
+ width: 100%;
+}
+.openerp .oe-view-manager-header .oe-view-manager-sidebar .oe_form_binary_form:hover {
+ background-color: #f5f5f5;
+}
+.openerp .oe-view-manager-header .oe-view-manager-sidebar .oe_file_attachment {
+ padding: 3px 20px;
+ display: inline-block;
+}
+.openerp .oe-view-manager-header .oe-view-manager-sidebar .oe_sidebar_delete_item {
+ padding: 0;
+ display: inline-block;
+}
+.openerp .oe-view-manager-header .oe-view-manager-sidebar .dropdown-menu li a {
+ width: 100%;
+}
+.openerp .oe-view-manager-header .oe_form_buttons {
+ padding: 0;
+}
+.openerp .oe-view-manager-header .oe-pager-buttons {
+ min-height: 30px;
+}
+.openerp .oe_view_manager_inline > .oe-view-manager-header, .openerp .oe_view_manager_inlineview > .oe-view-manager-header {
+ display: none;
+}
+.openerp .oe-search-options .selected {
+ display: block;
+}
+.openerp .oe-search-options .selected a {
font-weight: bold;
}
-.openerp .oe_view_manager {
- display: table;
- height: inherit;
- width: 100%;
+.openerp .oe-search-options .selected a:before {
+ font-family: FontAwesome;
+ position: absolute;
+ left: 6px;
+ top: 3px;
+ content: "";
}
-.openerp .oe_view_manager .oe_view_manager_view_kanban:not(:empty) {
- height: 100%;
-}
-.openerp .oe_view_manager[data-view-type=kanban] .oe_view_manager_body {
- display: table-row;
-}
-.openerp .oe_view_manager table.oe_view_manager_header {
- border-collapse: separate;
- width: 100%;
- table-layout: fixed;
-}
-.openerp .oe_view_manager table.oe_view_manager_header .oe_header_row {
- clear: both;
- text-shadow: 0 1px 1px white;
-}
-.openerp .oe_view_manager table.oe_view_manager_header .oe_header_row:last-child td {
- padding-top: 0;
-}
-.openerp .oe_view_manager table.oe_view_manager_header .oe_header_row:first-child td {
- padding-top: 8px;
-}
-.openerp .oe_view_manager table.oe_view_manager_header .oe_view_manager_sidebar {
- margin: 0px auto;
- text-align: center;
-}
-.openerp .oe_view_manager table.oe_view_manager_header .oe_view_manager_sidebar .oe_dropdown_arrow:after {
- opacity: 0.9;
-}
-.openerp .oe_view_manager table.oe_view_manager_header td {
- line-height: 26px;
-}
-.openerp .oe_view_manager table.oe_view_manager_header h2 {
- font-size: 18px;
- margin: 0;
- float: left;
- line-height: 30px;
-}
-.openerp .oe_view_manager table.oe_view_manager_header h2 a {
- color: #7c7bad;
-}
-.openerp .oe_view_manager table.oe_view_manager_header .oe_dropdown_menu {
- line-height: normal;
-}
-.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 table.oe_view_manager_header .oe_button_group li {
- float: left;
- border-right: 1px solid #ababab;
-}
-.openerp .oe_view_manager table.oe_view_manager_header .oe_button_group li:last-child {
- border: none;
-}
-.openerp .oe_view_manager table.oe_view_manager_header .oe_button_group a {
- color: #4c4c4c;
-}
-.openerp .oe_view_manager table.oe_view_manager_header .oe_button_group a:hover {
- text-decoration: none;
-}
-.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 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 table.oe_view_manager_header .oe_view_manager_buttons {
- white-space: nowrap;
-}
-.openerp .oe_view_manager .oe_view_manager_switch {
- padding: 0;
- margin: 0 0 0 8px;
-}
-.openerp .oe_view_manager .oe_view_manager_switch li {
- margin: 0;
- width: 24px;
- height: 24px;
- line-height: 16px;
- padding: 0;
- text-align: center;
- list-style-type: none;
-}
-.openerp .oe_view_manager .oe_view_manager_switch li a {
- position: relative;
-}
-.openerp .oe_view_manager .oe_view_manager_switch .oe_vm_switch_list:after, .openerp .oe_view_manager .oe_view_manager_switch .oe_vm_switch_tree:after {
- padding: 2px;
- content: "i";
-}
-.openerp .oe_view_manager .oe_view_manager_switch .oe_vm_switch_form:after {
- content: "m";
-}
-.openerp .oe_view_manager .oe_view_manager_switch .oe_vm_switch_graph:after {
- font-family: "mnmliconsRegular" !important;
- font-size: 21px;
- font-weight: 300 !important;
- content: "}";
- top: -2px;
- position: relative;
-}
-.openerp .oe_view_manager .oe_view_manager_switch .oe_vm_switch_gantt:after {
- font-family: "mnmliconsRegular" !important;
- font-size: 21px;
- font-weight: 300 !important;
- content: "y";
- top: -2px;
- position: relative;
-}
-.openerp .oe_view_manager .oe_view_manager_switch .oe_vm_switch_calendar:after {
- content: "P";
-}
-.openerp .oe_view_manager .oe_view_manager_switch .oe_vm_switch_kanban:after {
- content: "k";
-}
-.openerp .oe_view_manager .oe_view_manager_switch .oe_vm_switch_diagram:after {
- content: "f";
-}
-.openerp .oe_list_pager {
- line-height: 26px;
-}
-.openerp .oe_pager_value {
- float: left;
- margin-right: 8px;
-}
-.openerp ul.oe_pager_group {
- padding: 0;
- margin: 0;
-}
-.openerp .oe_pager_group {
- float: left;
- height: 24px;
- line-height: 24px;
- display: inline-block;
- border: 1px solid #ababab;
- cursor: pointer;
- -moz-border-radius: 5px;
- -webkit-border-radius: 5px;
- border-radius: 5px;
-}
-.openerp .oe_pager_group li {
- height: 24px;
- line-height: 24px;
- padding: 0;
- margin: 0;
- list-style-type: none;
- float: left;
- border-right: 1px solid #ababab;
-}
-.openerp .oe_pager_group li:last-child {
- border: none;
-}
-.openerp .oe_pager_group a {
- color: #4c4c4c;
- padding: 0 8px;
-}
-.openerp .oe_pager_group a:hover {
- text-decoration: none;
-}
-.openerp .oe_pager_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_pager_group .active a {
- color: white;
- text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
-}
-.openerp .oe_list_pager.oe_list_pager_single_page .oe_pager_group {
- display: none;
-}
-.openerp .oe_view_manager_current {
- height: 100%;
-}
-.openerp .oe_view_manager_current > .oe_view_manager_header {
- border-bottom: 1px solid #cacaca;
- background-color: #ededed;
- background-image: -webkit-gradient(linear, left top, left bottom, from(#fcfcfc), to(#dedede));
- background-image: -webkit-linear-gradient(top, #fcfcfc, #dedede);
- background-image: -moz-linear-gradient(top, #fcfcfc, #dedede);
- background-image: -ms-linear-gradient(top, #fcfcfc, #dedede);
- background-image: -o-linear-gradient(top, #fcfcfc, #dedede);
- background-image: linear-gradient(to bottom, #fcfcfc, #dedede);
- -moz-box-shadow: 0 1px 0 rgba(255, 255, 255, 0.4), 0 0 9px rgba(0, 0, 0, 0.1);
- -webkit-box-shadow: 0 1px 0 rgba(255, 255, 255, 0.4), 0 0 9px rgba(0, 0, 0, 0.1);
- box-shadow: 0 1px 0 rgba(255, 255, 255, 0.4), 0 0 9px rgba(0, 0, 0, 0.1);
-}
-.openerp .oe_view_manager_current > .oe_view_manager_header .oe_header_row td {
- padding: 8px;
-}
-.openerp .oe_view_manager_current > .oe_view_manager_header .oe_header_row:first-child td {
- padding-top: 8px;
-}
-.openerp .oe_view_manager_inline, .openerp .oe_view_manager_inlineview {
- height: 100%;
-}
-.openerp .oe_view_manager_inline > .oe_view_manager_header, .openerp .oe_view_manager_inlineview > .oe_view_manager_header {
- display: none;
+.openerp .oe_application > div > div > .oe-view-manager-body {
+ position: absolute;
+ top: 90px;
+ bottom: 0;
+ left: 0;
+ right: 0;
+ overflow: auto;
}
.openerp .oe_popup_form {
display: table;
@@ -1302,112 +1173,38 @@
.openerp .oe_popup_list_pager {
float: right;
}
+.openerp .oe_popup_search {
+ width: 50%;
+ float: right;
+}
.openerp .oe_searchview {
cursor: text;
position: relative;
- float: right;
- padding: 1px 0;
- line-height: 18px;
- min-width: 400px;
- border: 1px solid #ababab;
- background: white;
- -moz-border-radius: 13px;
- -webkit-border-radius: 13px;
- border-radius: 13px;
- -moz-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2) inset;
- -webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2) inset;
- box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2) inset;
-}
-.openerp .oe_searchview input, .openerp .oe_searchview textarea {
- padding: 3px;
- height: 14px;
- font-size: 12px;
- line-height: 18px;
-}
-.openerp .oe_searchview input:not([type]), .openerp .oe_searchview input[type="text"], .openerp .oe_searchview input[type="number"] {
- width: 156px;
- height: 22px;
-}
-.openerp .oe_searchview input[type="checkbox"] {
- margin: 3px 3px 3px 4px;
-}
-.openerp .oe_searchview select {
- margin: 2px 4px 2px 0;
-}
-.openerp .oe_searchview.oe_focused {
- border-color: #a6a6fe;
- -moz-box-shadow: 0 1px 2px #a6a6fe inset;
- -webkit-box-shadow: 0 1px 2px #a6a6fe inset;
- box-shadow: 0 1px 2px #a6a6fe inset;
-}
-.openerp .oe_searchview .oe_searchview_clear {
- cursor: pointer;
- position: absolute;
- top: 0;
- right: 18px;
- width: 15px;
- height: 24px;
- background: url(../img/search_reset.gif) center center no-repeat;
+ display: none;
+ height: auto;
+ padding-top: 1px;
+ padding-bottom: 1px;
}
.openerp .oe_searchview .oe_searchview_unfold_drawer {
position: absolute;
- top: 0;
- right: 0;
- height: 24px;
- padding: 0 7px 0 4px;
- color: #cccccc;
+ top: 8px;
+ right: 5px;
cursor: pointer;
}
-.openerp .oe_searchview .oe_searchview_unfold_drawer:hover {
- color: #999999;
-}
-.openerp .oe_searchview .oe_searchview_unfold_drawer:before {
- position: absolute;
- top: 10px;
- right: 7px;
- width: 0;
- height: 0;
- display: inline-block;
- content: "";
- vertical-align: top;
- border-top: 5px solid #4c4c4c;
- border-left: 5px solid transparent;
- border-right: 5px solid transparent;
- filter: alpha(opacity=50);
- opacity: 0.5;
-}
.openerp .oe_searchview .oe_searchview_search {
- font-size: 1px;
- letter-spacing: -1px;
- color: transparent;
- text-shadow: none;
- font-weight: normal;
- -moz-box-shadow: none;
- -webkit-box-shadow: none;
- box-shadow: none;
- -moz-border-radius: 0;
- -webkit-border-radius: 0;
- border-radius: 0;
+ cursor: pointer;
position: absolute;
- left: 3px;
- top: 1px;
- padding: 0;
- border: none;
- background: transparent;
-}
-.openerp .oe_searchview .oe_searchview_search:before {
- font: 21px "mnmliconsRegular";
- content: "r";
- color: #a3a3a3;
+ top: 8px;
+ left: 5px;
}
.openerp .oe_searchview .oe_searchview_facets {
min-height: 22px;
- margin: 0 35px 0 15px;
+ margin: 2px 20px 0 0;
}
.openerp .oe_searchview .oe_searchview_facets * {
vertical-align: top;
display: inline-block;
- line-height: 17px;
+ font-size: 100%;
}
.openerp .oe_searchview .oe_searchview_facets .oe_searchview_facet {
margin: 1px 0;
@@ -1416,15 +1213,25 @@
.openerp .oe_searchview .oe_searchview_facets .oe_searchview_facet:focus {
outline: none;
}
+.openerp .oe_searchview .oe_searchview_facets .oe_searchview_facet .label {
+ -moz-border-radius: 0px;
+ -webkit-border-radius: 0px;
+ border-radius: 0px;
+}
.openerp .oe_searchview .oe_searchview_facets .oe_searchview_input {
- padding: 0 0 0 6px;
+ padding: 2px 0 0 6px;
font-size: 12px;
height: 16px;
- margin-top: 3px;
+ -webkit-user-select: initial;
+ -moz-user-select: initial;
+ user-select: initial;
}
.openerp .oe_searchview .oe_searchview_facets .oe_searchview_input:focus {
outline: none;
}
+.openerp .oe_searchview .oe_searchview_facets .oe_searchview_input:first-child {
+ margin-left: 10px;
+}
.openerp .oe_searchview .oe_searchview_facets .oe_searchview_facet {
position: relative;
cursor: pointer;
@@ -1439,9 +1246,6 @@
}
.openerp .oe_searchview .oe_searchview_facets .oe_searchview_facet .oe_facet_values {
background: #f0f0fa;
- -moz-border-radius: 0 3px 3px 0;
- -webkit-border-radius: 0 3px 3px 0;
- border-radius: 0 3px 3px 0;
}
.openerp .oe_searchview .oe_searchview_facets .oe_searchview_facet .oe_facet_category, .openerp .oe_searchview .oe_searchview_facets .oe_searchview_facet .oe_facet_value {
padding: 0 4px;
@@ -1455,12 +1259,14 @@
}
.openerp .oe_searchview .oe_searchview_facets .oe_searchview_facet .oe_facet_value {
border-left: 1px solid #afafb6;
- text-shadow: 0 1px 1px white;
- color: #4c4c4c;
+ color: #4C4C4C;
}
.openerp .oe_searchview .oe_searchview_facets .oe_searchview_facet .oe_facet_value:last-child {
padding-right: 16px;
}
+.openerp .oe_searchview .oe_searchview_facets .oe_searchview_facet .oe_facet_value:first-child {
+ border-left: none;
+}
.openerp .oe_searchview .oe_searchview_facets .oe_searchview_facet .oe_facet_remove {
position: absolute;
top: 3px;
@@ -1486,8 +1292,8 @@
.openerp .oe_searchview .oe-autocomplete {
display: none;
position: absolute;
- width: 300px;
background-color: white;
+ width: 400px;
border: 1px solid #afafb6;
z-index: 666;
margin-top: 2px;
@@ -1495,9 +1301,6 @@
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
border-radius: 3px;
- -moz-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
- -webkit-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
- box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}
.openerp .oe_searchview .oe-autocomplete ul {
list-style-type: none;
@@ -1529,216 +1332,120 @@
.openerp .oe_searchview .oe-autocomplete ul li.oe-separator:last-child {
display: none;
}
-.openerp .oe_searchview_drawer_container {
- overflow: auto;
-}
-.openerp .oe_searchview_drawer {
- display: none;
+.openerp .oe-search-options a {
+ padding-left: 25px;
+ padding-right: 25px;
width: 100%;
- cursor: default;
- display: none;
- overflow: hidden;
- border-bottom: 1px solid #afafb6;
- text-align: left;
- padding: 8px 0;
+ -webkit-user-select: none;
+ -moz-user-select: none;
+ user-select: none;
}
-.openerp .oe_searchview_drawer .badge {
- font-size: 12px;
- line-height: 12px;
+.openerp .oe-search-options .oe-apply-filter {
+ margin-left: 25px;
}
-.openerp .oe_searchview_drawer > div:first-child {
- border: none;
- padding-left: 0;
-}
-.openerp .oe_searchview_drawer > div:first-child li:hover:not(.badge) {
- background-color: #f0f0fa;
-}
-.openerp .oe_searchview_drawer .col-md-5 {
- padding-left: 0;
-}
-.openerp .oe_searchview_drawer dl {
- margin-bottom: 0;
-}
-.openerp .oe_searchview_drawer dt {
- color: #7c7bad;
- font-size: 13px;
- line-height: 24px;
-}
-.openerp .oe_searchview_drawer dd {
- line-height: 24px;
- font-size: 13px;
- padding-top: 3px;
-}
-.openerp .oe_searchview_drawer h4, .openerp .oe_searchview_drawer h4 * {
- margin: 0 0 0 2px;
- padding-left: 20px;
- cursor: pointer;
- font-weight: normal;
- display: inline-block;
-}
-.openerp .oe_searchview_drawer h4:hover, .openerp .oe_searchview_drawer h4 *:hover {
- background-color: #f0f0fa;
-}
-.openerp .oe_searchview_drawer h4:before {
- content: "▸ ";
- color: #a3a3a3;
-}
-.openerp .oe_searchview_drawer button {
- margin: 4px 0;
-}
-.openerp .oe_searchview_drawer .button {
- border: none;
- background: transparent;
- padding: 0 2px;
- -moz-box-shadow: none;
- -webkit-box-shadow: none;
- box-shadow: none;
- -moz-border-radius: 0;
- -webkit-border-radius: 0;
- border-radius: 0;
-}
-.openerp .oe_searchview_drawer .oe_searchview_section ul {
- margin: 0 8px;
- padding: 0;
- list-style: none;
- display: inline;
-}
-.openerp .oe_searchview_drawer .oe_searchview_section li {
- display: inline-block;
- cursor: pointer;
- position: relative;
- margin-right: 8px;
-}
-.openerp .oe_searchview_drawer .oe_searchview_section li > span {
- display: inline-block;
- max-width: 250px;
- text-overflow: ellipsis;
- vertical-align: bottom;
- overflow: hidden;
-}
-.openerp .oe_searchview_drawer form {
- margin-left: 12px;
-}
-.openerp .oe_searchview_drawer form p {
- margin: 4px 0;
- line-height: 18px;
-}
-.openerp .oe_searchview_drawer form button {
- margin: 0 0 8px -3px;
-}
-.openerp .oe_searchview_drawer .oe_searchview_savefilter form {
+.openerp .oe-search-options .oe-add-filter-menu {
display: none;
}
-.openerp .oe_searchview_drawer .oe_searchview_custom {
- display: none;
-}
-.openerp .oe_searchview_drawer .oe_searchview_custom li {
- cursor: pointer;
- position: relative;
- line-height: 14px;
- margin-right: 0;
-}
-.openerp .oe_searchview_drawer .oe_searchview_custom li button {
- position: absolute;
- top: 0;
- right: 5px;
-}
-.openerp .oe_searchview_drawer .oe_searchview_custom li a {
+.openerp .oe-search-options .oe-add-condition {
+ width: auto;
margin-left: 10px;
- position: inherit;
- visibility: hidden;
- display: inline-block;
+ padding-left: 0;
+ padding-right: 10px;
}
-.openerp .oe_searchview_drawer .oe_searchview_custom li span:hover:not(.badge) {
- background-color: #f0f0fa;
+.openerp .oe-search-options .oe-group-selector {
+ margin: 3px 25px;
+ min-width: calc(100% - 40px);
+ max-width: 250px;
+ width: auto;
}
-.openerp .oe_searchview_drawer .oe_searchview_custom li:hover a {
- visibility: visible;
-}
-.openerp .oe_searchview_drawer .oe_searchview_custom label {
- font-weight: normal;
-}
-.openerp .oe_searchview_drawer .oe_searchview_dashboard form {
+.openerp .oe-search-options .divider {
display: none;
- margin-top: 2px;
}
-.openerp .oe_searchview_drawer .oe_searchview_advanced {
- overflow: auto;
+.openerp .oe-search-options .filters-menu .divider {
+ display: list-item;
}
-.openerp .oe_searchview_drawer .oe_searchview_advanced form {
+.openerp .oe-search-options .closed-menu a:before {
+ font-family: FontAwesome;
+ position: absolute;
+ left: 12px;
+ top: 3px;
+ content: "";
+}
+.openerp .oe-search-options .open-menu a:before {
+ font-family: FontAwesome;
+ position: absolute;
+ left: 9px;
+ top: 3px;
+ content: "";
+}
+.openerp .oe-search-options .oe-select-group {
+ margin: 3px 25px;
+}
+.openerp .oe-search-options .oe-add-group {
display: none;
- margin-top: 8px;
}
-.openerp .oe_searchview_drawer .oe_searchview_advanced button.oe_add_condition:before {
- content: "Z";
- font-family: "entypoRegular" !important;
- font-size: 24px;
- font-weight: 300 !important;
- margin-right: 4px;
+.openerp .oe-search-options .oe-save-name {
+ display: none;
+ margin: 3px 25px;
}
-.openerp .oe_searchview_drawer .oe_searchview_advanced ul {
- list-style: none;
- padding: 0;
-}
-.openerp .oe_searchview_drawer .oe_searchview_advanced li {
- position: relative;
- list-style: none;
- margin: 0;
+.openerp .oe-search-options .oe-save-name span {
white-space: nowrap;
}
-.openerp .oe_searchview_drawer .oe_searchview_advanced li:first-child .searchview_extended_prop_or {
- visibility: hidden;
- margin-left: -14px;
+.openerp .oe-search-options .oe-save-name span input {
+ margin-left: 0;
}
-.openerp .oe_searchview_drawer .oe_searchview_advanced .searchview_extended_prop_or {
- opacity: 0.5;
- margin-left: -14px;
+.openerp .oe-search-options .searchview_extended_prop_field {
+ display: inline;
+ width: calc(100% - 20px);
}
-.openerp .oe_searchview_drawer .oe_opened h4:before {
- content: "▾ ";
- position: relative;
- top: -1px;
+.openerp .oe-search-options .searchview_extended_prop_op {
+ margin: 3px 0;
+ width: calc(100% - 20px);
}
-.openerp .oe_searchview_drawer .oe_opened form {
- display: block;
+.openerp .oe-search-options .searchview_extended_delete_prop {
+ float: right;
+ display: inline;
}
-.openerp .oe_searchview_drawer .oe_searchview_custom_delete, .openerp .oe_searchview_drawer .searchview_extended_delete_prop {
- display: inline-block;
- width: 12px;
- height: 12px;
- line-height: 12px;
- padding: 1px;
- color: #8786b7;
- line-height: 8px;
- text-align: center;
- font-weight: bold;
- text-shadow: 0 1px 1px white;
+.openerp .oe-search-options .searchview_extended_prop_value {
+ width: calc(100% - 20px);
}
-.openerp .oe_searchview_drawer .oe_searchview_custom_delete:hover, .openerp .oe_searchview_drawer .searchview_extended_delete_prop:hover {
- text-decoration: none;
- color: white;
- background: #8786b7;
- text-shadow: 0 1px 1px rgba(0, 0, 0, 0.4);
- -moz-border-radius: 2px;
- -webkit-border-radius: 2px;
- border-radius: 2px;
+.openerp .oe-search-options .searchview_extended_prop_value > select, .openerp .oe-search-options .searchview_extended_prop_value > input {
+ width: calc(100% - 20px);
}
-.openerp .oe_searchview_drawer .oe_searchview_custom_delete {
- display: none;
+.openerp .oe-search-options .searchview_extended_prop_value .oe_datepicker_main {
+ width: calc(100% - 20px);
+}
+.openerp .oe-search-options .searchview_extended_prop_value .oe_datepicker_master {
+ width: 100%;
+}
+.openerp .oe-search-options .searchview_extended_prop_value .fa-calendar {
+ margin-left: -21px;
+ cursor: pointer;
+}
+.openerp .oe-search-options span.fa-trash-o {
position: absolute;
- bottom: 1px;
- right: 4px;
+ top: 6px;
+ right: 10px;
+ cursor: pointer;
}
-.openerp .oe_searchview_drawer .oe_searchview_custom_private:hover .oe_searchview_custom_delete, .openerp .oe_searchview_drawer .oe_searchview_custom_public:hover .oe_searchview_custom_delete {
+.openerp .oe-search-options .dropdown-menu > li {
+ position: relative;
+ white-space: nowrap;
+}
+.openerp .oe-search-options .dropdown-menu li.oe-filter-condition {
+ white-space: normal;
+ padding-left: 25px;
+ padding-right: 10px;
+ margin-bottom: 5px;
+}
+.openerp .oe-search-options a {
display: inline-block;
}
-.openerp .oe_searchview_drawer .oe_searchview_custom_public:after {
- content: ",";
- font-family: "entypoRegular" !important;
- font-size: 22px;
- font-weight: 300 !important;
- margin: 0 0 0 4px;
- padding: 0;
+.openerp input.oe-save-name {
+ width: auto;
+}
+.openerp .oe_pager_value {
+ display: inline-block;
}
.openerp .oe_view_nocontent {
padding: 15px;
@@ -1783,8 +1490,8 @@
display: inline-block;
}
.openerp .oe_form_invalid input, .openerp .oe_form_invalid select, .openerp .oe_form_invalid textarea {
- background-color: #ff6666 !important;
- border: 1px solid #dd0000 !important;
+ background-color: #F66 !important;
+ border: 1px solid #D00 !important;
}
.openerp .oe_view_manager_current .oe_form_editable .oe_highlight {
color: #404040;
@@ -1878,7 +1585,7 @@
}
.openerp .oe_application .oe_form_sheetbg {
background: url(/web/static/src/img/form_sheetbg.png);
- border-bottom: 1px solid #dddddd;
+ border-bottom: 1px solid #ddd;
}
.openerp .oe_application .oe_form_sheetbg .oe_subtotal_footer label {
font-weight: bold;
@@ -1938,7 +1645,7 @@
padding: 16px 16px 48px;
}
.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;
+ color: #aaa;
max-width: 650px;
}
.openerp .oe_form div.oe_form_configuration label {
@@ -1979,8 +1686,8 @@
font-weight: normal !important;
}
.openerp .oe_form .oe_form_box_info {
- background: #ffee99;
- border-bottom: 1px solid #ccbb66;
+ background: #fe9;
+ border-bottom: 1px solid #cb6;
padding: 4px;
}
.openerp .oe_form .oe_form_box_info > p {
@@ -1988,7 +1695,7 @@
}
.openerp .oe_form .oe_form_box_warning {
background: #bd362f;
- border-bottom: 1px solid #990000;
+ border-bottom: 1px solid #900;
padding: 4px;
}
.openerp .oe_form .oe_form_box_warning * {
@@ -2002,7 +1709,7 @@
margin: 2px;
}
.openerp .oe_form td.oe_form_group_cell_label {
- border-right: 1px solid #dddddd;
+ border-right: 1px solid #ddd;
padding: 2px 0px;
}
.openerp .oe_form td.oe_form_group_cell_label label {
@@ -2027,7 +1734,7 @@
}
.openerp .oe_form .oe_form_label_help[for] span, .openerp .oe_form .oe_form_label[for] span {
font-size: 80%;
- color: darkgreen;
+ color: darkGreen;
vertical-align: top;
position: relative;
top: -4px;
@@ -2040,13 +1747,13 @@
font-weight: bold;
font-size: 20px;
margin: 15px 0px 10px 0px;
- color: #7c7bad;
+ color: #7C7BAD;
}
.openerp .oe_horizontal_separator:empty {
height: 5px;
}
.openerp .oe_vertical_separator {
- border-left: 1px solid #666666;
+ border-left: 1px solid #666;
padding: 0 4px 0 4px;
}
.openerp .oe_form_field_progressbar {
@@ -2060,7 +1767,7 @@
-moz-box-sizing: border-box;
-ms-box-sizing: border-box;
box-sizing: border-box;
- border: 1px solid #999999;
+ border: 1px solid #999;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
border-radius: 3px;
@@ -2141,8 +1848,8 @@
font-family: "Lucida Grande", Helvetica, Verdana, Arial, sans-serif;
}
.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] {
- background: #e5e5e5 !important;
- color: #666666;
+ background: #E5E5E5 !important;
+ color: #666;
}
.openerp .oe_form textarea[disabled] {
border: none;
@@ -2156,7 +1863,7 @@
color: #4c4c4c;
}
.openerp .oe_form textarea.oe_inline[disabled] {
- border-left: 8px solid #eeeeee;
+ border-left: 8px solid #eee;
}
.openerp .oe_form .oe_form_field_url button img {
vertical-align: top;
@@ -2172,12 +1879,16 @@
.openerp .oe_form .oe_datepicker_root {
display: inline-block;
}
+.openerp .oe_form .oe_datepicker_root .datepickerbutton {
+ margin-left: 5px;
+ cursor: pointer;
+}
.openerp .oe_form .oe_form_required input:not([disabled]):not([readonly]), .openerp .oe_form .oe_form_required select:not([disabled]):not([readonly]), .openerp .oe_form .oe_form_required textarea:not([disabled]):not([readonly]) {
- background-color: #d2d2ff !important;
+ background-color: #D2D2FF !important;
}
.openerp .oe_form .oe_form_invalid input, .openerp .oe_form .oe_form_invalid select, .openerp .oe_form .oe_form_invalid textarea {
- background-color: #ff6666 !important;
- border: 1px solid #dd0000 !important;
+ background-color: #F66 !important;
+ border: 1px solid #D00 !important;
}
.openerp .oe_form .oe_input_icon {
cursor: pointer;
@@ -2267,7 +1978,7 @@
width: 100%;
display: none;
text-align: center;
- color: #eeeeee;
+ color: #eee;
background: rgba(37, 37, 37, 0.9);
-moz-border-radius: 3px 3px 0 0;
-webkit-border-radius: 3px 3px 0 0;
@@ -2304,7 +2015,7 @@
.openerp .oe_fileupload .oe_add button.oe_attach {
width: 24px;
background: transparent;
- color: #7c7bad;
+ color: #7C7BAD;
box-shadow: none;
border: none;
text-shadow: none;
@@ -2323,7 +2034,7 @@
cursor: pointer;
}
.openerp .oe_fileupload .oe_add .oe_attach_label {
- color: #7c7bad;
+ color: #7C7BAD;
margin-left: -3px;
}
.openerp .oe_fileupload .oe_attachments {
@@ -2349,7 +2060,7 @@
background: white;
}
.openerp .oe_fileupload .oe_attachments .oe_attachment:nth-child(even) {
- background: #f4f5fa;
+ background: #F4F5FA;
}
.openerp .oe_form_field_many2one {
display: inline-block;
@@ -2510,7 +2221,7 @@
background-image: linear-gradient(to bottom, #e8e8e8, #cacaca);
}
.openerp ul.oe_form_status_clickable li > .label {
- color: #7c7bad;
+ color: #7C7BAD;
}
.openerp ul.oe_form_status_clickable li.oe_active:hover {
background-color: #3a699f;
@@ -2580,7 +2291,7 @@
background-color: #d2d2ff;
}
.openerp .oe_form_editable .oe_list_editable .oe_list_content td.oe_readonly {
- background-color: #eeeeee;
+ background-color: #eee;
}
.openerp .oe_list_editable .oe_list_content td.oe_list_field_cell {
padding: 4px 6px 3px;
@@ -2617,7 +2328,7 @@
-moz-border-radius: 0;
-webkit-border-radius: 0;
border-radius: 0;
- border: 1px solid #aaaaff;
+ border: 1px solid #aaf;
margin: 0;
}
.openerp .oe_list.oe_list_editable.oe_editing .oe_form_field input, .openerp .oe_list.oe_list_editable.oe_editing .oe_form_field textarea, .openerp .oe_list.oe_list_editable.oe_editing .oe_form_field select {
@@ -2709,7 +2420,7 @@
}
.openerp .oe_list_content > thead {
border-bottom: 2px solid #cacaca;
- background: #eeeeee;
+ background: #eee;
vertical-align: top;
}
.openerp .oe_list_content td, .openerp .oe_list_content th {
@@ -2728,7 +2439,7 @@
margin-top: 7px;
border-width: 0 4px 4px;
border-style: solid;
- border-color: black transparent;
+ border-color: #000 transparent;
visibility: hidden;
}
.openerp .oe_list_content th.sortup div:after {
@@ -2745,7 +2456,7 @@
border-bottom: none;
border-left: 4px solid transparent;
border-right: 4px solid transparent;
- border-top: 4px solid black;
+ border-top: 4px solid #000;
visibility: visible;
-moz-box-shadow: none;
-webkit-box-shadow: none;
@@ -2758,7 +2469,7 @@
}
.openerp .oe_list_content > tbody > tr {
height: 27px;
- border-top: 1px solid #dddddd;
+ border-top: 1px solid #ddd;
}
.openerp .oe_list_content > tbody > tr > td.oe_list_field_cell {
padding: 3px 6px;
@@ -2797,7 +2508,7 @@
.openerp .oe_list_content > tfoot {
border-top: 2px solid #cacaca;
border-bottom: 1px solid #cacaca;
- background: #eeeeee;
+ background: #eee;
font-weight: bold;
}
.openerp .oe_list_content .numeric {
@@ -2828,7 +2539,7 @@
.openerp .oe_list_content td.oe_list_field_handle .oe_list_handle:before {
font: 18px "entypoRegular";
content: "}";
- color: #e0e0e0;
+ color: #E0E0E0;
}
.openerp .oe_list_content .oe_list_field_progressbar progress {
width: 100%;
@@ -2913,6 +2624,8 @@
}
.openerp .oe_debug_view {
float: left;
+ margin-top: 5px;
+ width: auto;
}
.openerp .oe_debug_view_log {
font-size: 95%;
@@ -2972,9 +2685,6 @@
font-size: 11px;
background-color: #7c7bad;
}
-.openerp button, .openerp body {
- line-height: normal;
-}
.openerp h1, .openerp h2 {
font-weight: bold;
}
@@ -2990,7 +2700,7 @@
-webkit-margin-end: 0px;
}
.openerp pre {
- background-color: white;
+ background-color: #FFFFFF;
border: none;
padding: 10px 0 3px 0;
}
@@ -3012,9 +2722,6 @@
}
@-moz-document url-prefix() {
- .openerp .oe_searchview .oe_searchview_search {
- top: -1px;
- }
.openerp .oe_form_field_many2one .oe_m2o_cm_button {
line-height: 18px;
}
@@ -3022,7 +2729,6 @@
top: 0px;
}
}
-
.kitten-mode-activated {
background-size: cover;
background-attachment: fixed;
@@ -3035,9 +2741,9 @@
-moz-border-radius: 15px;
-webkit-border-radius: 15px;
border-radius: 15px;
- -moz-box-shadow: 0 0 5px 5px #999999;
- -webkit-box-shadow: 0 0 5px 5px #999999;
- box-shadow: 0 0 5px 5px #999999;
+ -moz-box-shadow: 0 0 5px 5px #999;
+ -webkit-box-shadow: 0 0 5px 5px #999;
+ box-shadow: 0 0 5px 5px #999;
}
div.ui-widget-overlay {
@@ -3076,7 +2782,7 @@ div.ui-widget-overlay {
background: #f0f0fa;
}
.ui-menu .ui-menu-item a.ui-state-hover, .ui-menu .ui-menu-item a.ui-state-active {
- background: #7c7bad;
+ background: #7C7BAD;
}
.ui-corner-all {
@@ -3090,7 +2796,7 @@ div.ui-widget-overlay {
}
body.oe_single_form {
- background: #eeeeee url(/web/static/src/img/form_sheetbg.png);
+ background: #eee url(/web/static/src/img/form_sheetbg.png);
height: 100%;
}
body.oe_single_form .oe_single_form_logo {
@@ -3124,7 +2830,7 @@ body.oe_single_form .oe_single_form_container {
width: 80px;
}
.openerp_ie .oe_form_field_boolean input {
- background: white;
+ background: #fff;
}
.openerp_ie .db_option_table .oe_form_field_selection {
width: auto;
@@ -3315,7 +3021,7 @@ body.oe_single_form .oe_single_form_container {
max-width: 350px;
}
.tooltip .tooltip-inner .oe_tooltip_string {
- color: #ffdd55;
+ color: #FD5;
font-weight: bold;
font-size: 13px;
}
@@ -3339,7 +3045,7 @@ body.oe_single_form .oe_single_form_container {
color: white;
}
.tooltip .tooltip-inner .oe_tooltip_close:hover {
- color: #999999;
+ color: #999;
cursor: pointer;
}
.tooltip .tooltip-inner .oe_tooltip_message {
@@ -3414,7 +3120,7 @@ div.tour-backdrop {
bottom: 0;
left: 0;
z-index: 1100;
- background-color: black;
+ background-color: #000;
opacity: 0.8;
}
diff --git a/addons/web/static/src/css/base.sass b/addons/web/static/src/css/base.sass
index a8efd0f29cb..e5b50b30652 100644
--- a/addons/web/static/src/css/base.sass
+++ b/addons/web/static/src/css/base.sass
@@ -267,7 +267,7 @@ $sheet-padding: 16px
font-size: inherit
// }}}
// Button style {{{
- a.button:link, a.button:visited, button, .oe_button, input[type='submit']
+ a.button:link, a.button:visited, .oe_button, input[type='submit']
display: inline-block
border: 1px solid rgba(0,0,0,0.4)
color: #4c4c4c
@@ -282,22 +282,22 @@ $sheet-padding: 16px
-webkit-font-smoothing: antialiased
outline: none
- a.button:hover, button:hover,.oe_button:hover, input[type='submit']:hover
+ a.button:hover,.oe_button:hover, input[type='submit']:hover
@include vertical-gradient(#f6f6f6, #e3e3e3)
cursor: pointer
background-position: 0
- a.button:focus, button:focus, .oe_button:focus, input[type='submit']:focus
+ a.button:focus, .oe_button:focus, input[type='submit']:focus
border: 1px solid #80bfff
background-position: 0
@include vertical-gradient(#f6f6f6, #e3e3e3)
@include box-shadow((0 0 3px #80bfff, 0 1px 1px rgba(255, 255, 255, .8) inset))
- a.button:active, a.button.active, button:active, .oe_button:active, .oe_button.active, input[type='submit']:active, input[type='submit'].active
+ a.button:active, a.button.active, .oe_button:active, .oe_button.active, input[type='submit']:active, input[type='submit'].active
@include vertical-gradient(#e3e3e3, #f6f6f6)
@include box-shadow(none)
- a.button.disabled, button:disabled, .oe_button:disabled, input[type='submit']:disabled
+ a.button.disabled, .oe_button:disabled, input[type='submit']:disabled
background: #efefef !important
border: 1px solid #d1d1d1 !important
@include box-shadow(none !important)
@@ -653,44 +653,6 @@ $sheet-padding: 16px
border-right: 4px solid transparent
border-top: 4px solid#404040
@include opacity(0.5)
- .oe_sidebar
- white-space: nowrap
- .oe_dropdown_menu
- .oe_sidebar_add_attachment
- height: 20px
- cursor: pointer
- padding-left: 6px
- margin-top: 6px
- span
- font-weight: bold
- .oe_hidden_input_file
- width: 200px
- &:hover
- @include vertical-gradient(#f0f0fa, #eeeef6)
- @include box-shadow(none)
- li
- .oe_sidebar_delete_item
- position: absolute
- top: 4px
- right: 4px
- display: none
- width: 12px
- height: 12px
- padding: 1px
- color: #8786b7
- line-height: 8px
- text-align: center
- font-weight: bold
- text-shadow: 0 1px 1px white
- &:hover
- text-decoration: none
- color: white
- background: #8786b7
- text-shadow: 0 1px 1px rgba(0, 0, 0, 0.4)
- @include radius(2px)
- &:hover
- .oe_sidebar_delete_item
- display: inline-block
// }}}
// Loading {{{
.oe_loading
@@ -899,202 +861,148 @@ $sheet-padding: 16px
.oe_application
width: 100%
height: 100%
- a
- color: $link-color
+ overflow: hidden
> div
position: relative
height: 100%
- > .oe_view_manager
- > .oe_view_manager_wrapper
- display: table-row
- height: 100%
- > div
- position: relative
- height: 100%
- > .oe_view_manager_body
- position: absolute
- position: static\9
- top: 0
- bottom: 0
- left: 0
- right: 0
- overflow: auto
+ .oe-view-manager
+ .oe-view-manager-debug
+ margin-right: 5px
+ .oe-view-manager-content
+ display: table-row
+ height: 100%
+ .oe-view-manager-body
+ position: relative
+ height: 100%
+ a
+ color: $link-color
+ .oe-view-manager-view-kanban:not(:empty)
+ height: 100%
+ > div
+ position: absolute
+ top: 0
+ bottom: 0
+ left: 0
+ right: 0
+ overflow: auto
+ .oe_form_field_one2many
+ .oe-view-manager-views
+ position: initial
- .oe_breadcrumb_item:not(:last-child)
- max-width: 7em
- white-space: nowrap
- text-overflow: ellipsis
- .oe_breadcrumb_title > *
- display: inline-block
- overflow: hidden
- font-weight: bold
// }}}
// ViewManager common {{{
- .oe_view_manager
+ .oe-view-manager
display: table
- height: inherit
width: 100%
- .oe_view_manager_view_kanban:not(:empty)
- height: 100%
- &[data-view-type=kanban]
- .oe_view_manager_body
- display: table-row
-
- table.oe_view_manager_header
- border-collapse: separate
- width: 100%
- table-layout: fixed
- .oe_header_row
- //min-height: 26px
- //line-height: 26px
- clear: both
- text-shadow: 0 1px 1px white
- .oe_header_row:last-child
- td
- padding-top: 0
- .oe_header_row:first-child
- td
- padding-top: 8px
- .oe_view_manager_sidebar
- margin: 0px auto
- text-align: center
- .oe_dropdown_arrow:after
- opacity: 0.9
- td
- line-height: 26px
- h2
- font-size: 18px
- margin: 0
- float: left
- line-height: 30px
- a
- color: $link-color
- .oe_dropdown_menu
- line-height: normal
- .oe_button_group
- display: inline-block
- border: 1px solid #ababab
- @include radius(5px)
- li
- float: left
- border-right: 1px solid #ababab
- &:last-child
- border: none
- a
- color: #4c4c4c
- &:hover
- text-decoration: none
- .active
- background: #999
- @include box-shadow(0 1px 4px rgba(0,0,0,0.3) inset)
- a
- color: #fff
- text-shadow: 0 1px 2px rgba(0,0,0,0.4)
- .oe_view_manager_buttons
- white-space: nowrap
- // }}}
- // ViewManager.switches {{{
- .oe_view_manager_switch
- padding: 0
- margin: 0 0 0 8px
+ height: 100%
+ .oe-view-manager-header
+ display: table-row
+ background-color: rgb(240, 238, 238)
+ border-bottom: 1px solid #afafb6
+ -webkit-user-select: none
+ -moz-user-select: none
+ user-select: none
+ .dropdown-menu
li
- margin: 0
- width: 24px
- height: 24px
- line-height: 16px
- padding: 0
- text-align: center
- list-style-type: none
+ position: relative
a
- position: relative
- .oe_vm_switch_list:after, .oe_vm_switch_tree:after
- padding: 2px
- content: "i"
- .oe_vm_switch_form:after
- content: "m"
- .oe_vm_switch_graph:after
- font-family: "mnmliconsRegular" !important
- font-size: 21px
- font-weight: 300 !important
- content: "}"
- top: -2px
- position: relative
- .oe_vm_switch_gantt:after
- font-family: "mnmliconsRegular" !important
- font-size: 21px
- font-weight: 300 !important
- content: "y"
- top: -2px
- position: relative
- .oe_vm_switch_calendar:after
- content: "P"
- .oe_vm_switch_kanban:after
- content: "k"
- .oe_vm_switch_diagram:after
- content: "f"
- // }}}
- // List pager {{{
- .oe_list_pager
- line-height: 26px
- .oe_pager_value
- float: left
- margin-right: 8px
- ul.oe_pager_group
- padding: 0
- margin: 0
- .oe_pager_group
- float: left
- height: 24px
- line-height: 24px
- display: inline-block
- border: 1px solid #ababab
- cursor: pointer
- @include radius(5px)
- li
- height: 24px
- line-height: 24px
- padding: 0
+ padding: 3px 25px
+ .oe-right-toolbar
+ float: right
+ > div
+ display: inline-block
+ .row
margin: 0
- list-style-type: none
- float: left
- border-right: 1px solid #ababab
- &:last-child
- border: none
- a
- color: #4c4c4c
- padding: 0 8px
- &:hover
- text-decoration: none
- .active
- background: #999
- @include box-shadow(0 1px 4px rgba(0,0,0,0.3) inset)
- a
- color: #fff
- text-shadow: 0 1px 2px rgba(0,0,0,0.4)
- .oe_list_pager.oe_list_pager_single_page .oe_pager_group
- display: none
- // }}}
- // ViewManager application {{{
- .oe_view_manager_current
- height: 100%
- > .oe_view_manager_header
- border-bottom: 1px solid #cacaca
- @include vertical-gradient(#fcfcfc, #dedede)
- @include box-shadow((0 1px 0 rgba(255,255,255,0.4), 0 0 9px rgba(0,0,0,0.1)))
- .oe_header_row
- td
- padding: 8px
- .oe_header_row:first-child
- td
- padding-top: 8px
- // }}}
- // ViewManager inline {{{
+ .row:first-child
+ padding-top: 3px
+ padding-bottom: 3px
+ .row:last-child
+ padding-bottom: 10px
+ .oe_tag
+ @include radius(0px)
+ .oe-view-title
+ font-size: 18px
+ padding-left: 0
+ margin: 0
+ background-color: rgb(240, 238, 238)
+ li
+ -moz-user-select: initial
+ -webkit-user-select: initial
+ user-select: initial
+ .oe-view-manager-search-view
+ padding-top: 5px
+ .oe-view-manager-switch
+ .oe-vm-switch-kanban:before
+ content: "\f009"
+ .oe-vm-switch-list:before
+ content: ""
+ .oe-vm-switch-form:before
+ content: "\f044"
+ .oe-vm-switch-graph:before
+ content: "\f080"
+ .oe-vm-switch-calendar:before
+ content: "\f073"
+ .oe-vm-switch-gantt:before
+ content: "\f0ae"
+ .oe-vm-switch-pivot:before
+ content: "\f0ce"
+ .oe-view-manager-buttons
+ display: inline-block
+ > div
+ display: none
+ .oe-view-manager-sidebar
+ display: inline-block
+ float: right
+ .oe_form_binary_form
+ cursor: pointer
+ span
+ padding: 3px 20px
+ input.oe_form_binary_file
+ width: 100%
+
+ .oe_form_binary_form:hover
+ background-color: #f5f5f5
+ .oe_file_attachment
+ padding: 3px 20px
+ display: inline-block
+ .oe_sidebar_delete_item
+ padding: 0
+ display: inline-block
+ .dropdown-menu
+ li
+ a
+ width: 100%
+ .oe_form_buttons
+ padding: 0
+ .oe-pager-buttons
+ min-height: 30px
.oe_view_manager_inline, .oe_view_manager_inlineview
- height: 100%
- > .oe_view_manager_header
+ > .oe-view-manager-header
display: none
- // }}}
+ .oe-search-options
+ .selected
+ display: block
+ a
+ font-weight: bold
+ a:before
+ font-family: FontAwesome
+ position: absolute
+ left: 6px
+ top: 3px
+ content: "\f00c"
+
+ .oe_application
+ > div
+ > div
+ > .oe-view-manager-body
+ position: absolute
+ top: 90px
+ bottom: 0
+ left: 0
+ right: 0
+ overflow: auto
+ // }}}
// FormPopup {{{
.oe_popup_form
display: table
@@ -1106,98 +1014,53 @@ $sheet-padding: 16px
// End of customize
.oe_popup_list_pager
float: right
+ .oe_popup_search
+ width: 50%
+ float: right
// }}}
// SearchView {{{
.oe_searchview
cursor: text
position: relative
- float: right
- padding: 1px 0
- line-height: 18px
- min-width: 400px
- border: 1px solid #ababab
- background: white
- @include radius(13px)
- @include box-shadow(0 1px 2px rgba(0,0,0,0.2) inset)
- input, textarea
- padding: 3px
- height: 14px
- font-size: 12px
- line-height: 18px
- //Customize searchview input, select
- input:not([type]), input[type="text"], input[type="number"]
- width: 156px
- height: 22px
- input[type="checkbox"]
- margin: 3px 3px 3px 4px
- select
- margin: 2px 4px 2px 0
- //End of customize
- &.oe_focused
- border-color: $tag-border-selected
- @include box-shadow(0 1px 2px $tag-border-selected inset)
- .oe_searchview_clear
- cursor: pointer
- position: absolute
- top: 0
- right: 18px
- width: 15px
- height: 24px
- background: url(../img/search_reset.gif) center center no-repeat
+ display: none
+ height: auto
+ padding-top: 1px
+ padding-bottom: 1px
.oe_searchview_unfold_drawer
position: absolute
- top: 0
- right: 0
- height: 24px
- padding: 0 7px 0 4px
- color: #ccc
+ top: 8px
+ right: 5px
cursor: pointer
- &:hover
- color: #999
- &:before
- position: absolute
- top: 10px
- right: 7px
- width: 0
- height: 0
- display: inline-block
- content: ""
- vertical-align: top
- border-top: 5px solid #4C4C4C
- border-left: 5px solid transparent
- border-right: 5px solid transparent
- @include opacity()
-
.oe_searchview_search
- @include text-to-icon("r", #a3a3a3)
- @include box-shadow(none)
- @include radius(0)
+ cursor: pointer
position: absolute
- left: 3px
- top: 1px
- padding: 0
- border: none
- background: transparent
-
+ top: 8px
+ left: 5px
.oe_searchview_facets
min-height: 22px
- margin: 0 35px 0 15px
+ margin: 2px 20px 0 0
*
vertical-align: top
display: inline-block
- line-height: 17px
+ font-size: 100%
.oe_searchview_facet
margin: 1px 0
font-size: 11px
&:focus
outline: none
+ .label
+ @include radius(0px)
.oe_searchview_input
- padding: 0 0 0 6px
+ padding: 2px 0 0 6px
font-size: 12px
height: 16px
- margin-top: 3px
+ -webkit-user-select: initial
+ -moz-user-select: initial
+ user-select: initial
&:focus
outline: none
+ .oe_searchview_input:first-child
+ margin-left: 10px
.oe_searchview_facet
position: relative
cursor: pointer
@@ -1209,7 +1072,6 @@ $sheet-padding: 16px
@include box-shadow(0 0 3px 1px $tag-border-selected)
.oe_facet_values
background: $tag-bg-light
- @include radius(0 3px 3px 0)
.oe_facet_category, .oe_facet_value
padding: 0 4px
.oe_facet_category
@@ -1218,11 +1080,12 @@ $sheet-padding: 16px
.oe_facet_category.oe_i
font-size: 16px
.oe_facet_value
- border-left: 1px solid $tag-border
- text-shadow: 0 1px 1px white
+ border-left: 1px solid #afafb6
color: #4C4C4C
&:last-child
padding-right: 16px
+ &:first-child
+ border-left: none
.oe_facet_remove
position: absolute
top: 3px
@@ -1245,14 +1108,13 @@ $sheet-padding: 16px
.oe-autocomplete
display: none
position: absolute
- width: 300px
background-color: white
+ width: 400px
border: 1px solid #afafb6
z-index: 666
margin-top: 2px
cursor: default
@include radius(3px)
- @include box-shadow(0 1px 4px rgba(0, 0, 0, 0.3))
ul
list-style-type: none
padding-left: 0
@@ -1276,180 +1138,102 @@ $sheet-padding: 16px
li.oe-separator:last-child
display: none
-
- .oe_searchview_drawer_container
- overflow: auto
- .oe_searchview_drawer
- display: none
- width: 100%
- cursor: default
- display: none
- overflow: hidden
- border-bottom: 1px solid $tag-border
- text-align: left
- padding: 8px 0
- .badge
- font-size: 12px
- line-height: 12px
- > div:first-child
- border: none
- padding-left: 0
- li:hover:not(.badge)
- background-color: $hover-background
- .col-md-5
- padding-left: 0
- dl
- margin-bottom: 0
- dt
- color: $section-title-color
- font-size: 13px
- line-height: 24px
- dd
- line-height: 24px
- font-size: 13px
- padding-top: 3px
- h4, h4 *
- margin: 0 0 0 2px
- padding-left: 20px
- cursor: pointer
- font-weight: normal
- display: inline-block
- &:hover
- background-color: $hover-background
- h4:before
- content: "▸ "
- color: #a3a3a3
- button
- margin: 4px 0
- .button
- border: none
- background: transparent
- padding: 0 2px
- @include box-shadow(none)
- @include radius(0)
- .oe_searchview_section
- ul
- margin: 0 8px
- padding: 0
- list-style: none
- display: inline
- li
- display: inline-block
- cursor: pointer
- position: relative
- margin-right: 8px
- > span
- display: inline-block
- max-width: 250px
- text-overflow: ellipsis
- vertical-align: bottom
- overflow: hidden
- form
- margin-left: 12px
- p
- margin: 4px 0
- line-height: 18px
- button
- margin: 0 0 8px -3px // Managed margin-left according bootstrap3
- .oe_searchview_savefilter
- form
- display: none
- .oe_searchview_custom
+ .oe-search-options
+ a
+ padding-left: 25px
+ padding-right: 25px
+ width: 100%
+ -webkit-user-select: none
+ -moz-user-select: none
+ user-select: none
+ .oe-apply-filter
+ margin-left: 25px
+ .oe-add-filter-menu
display: none
- li
- cursor: pointer
- position: relative
- line-height: 14px
- margin-right: 0
- button
- position: absolute
- top: 0
- right: 5px
- a
- margin-left: 10px
- position: inherit
- visibility: hidden
- display: inline-block
- span:hover:not(.badge)
- background-color: $hover-background
- li:hover a
- visibility: visible
- //Customize for searchview label
- label
- font-weight: normal
- //End of Customize
- .oe_searchview_dashboard
- form
- display: none
- margin-top: 2px
+ .oe-add-condition
+ width: auto
+ margin-left: 10px
+ padding-left: 0
+ padding-right: 10px
+ .oe-group-selector
+ margin: 3px 25px
+ min-width: calc(100% - 40px)
+ max-width: 250px
+ width: auto
+ .divider
+ display: none
+ .filters-menu
+ .divider
+ display: list-item
+ .closed-menu
+ a:before
+ font-family: FontAwesome
+ position: absolute
+ left: 12px
+ top: 3px
+ content: "\f0da"
+ .open-menu
+ a:before
+ font-family: FontAwesome
+ position: absolute
+ left: 9px
+ top: 3px
+ content: "\f0d7"
- .oe_searchview_advanced
- overflow: auto
- form
- display: none
- margin-top: 8px
- button.oe_add_condition:before
- content: "Z"
- font-family: "entypoRegular" !important
- font-size: 24px
- font-weight: 300 !important
- margin-right: 4px
- ul
- list-style: none
- padding: 0
- li
- position: relative
- list-style: none
- margin: 0
+ .oe-select-group
+ margin: 3px 25px
+ .oe-add-group
+ display: none
+ .oe-save-name
+ display: none
+ margin: 3px 25px
+ span
white-space: nowrap
- &:first-child .searchview_extended_prop_or
- visibility: hidden
- margin-left: -14px
- .searchview_extended_prop_or
- opacity: 0.5
- margin-left: -14px //Customize 'or' in searchview
- .oe_opened
- h4:before
- content: "▾ "
- position: relative
- top: -1px
- form
- display: block
-
- // delete buttons
- .oe_searchview_custom_delete, .searchview_extended_delete_prop
- display: inline-block
- width: 12px
- height: 12px
- line-height: 12px
- padding: 1px
- color: #8786b7
- line-height: 8px
- text-align: center
- font-weight: bold
- text-shadow: 0 1px 1px white
- &:hover
- text-decoration: none
- color: white
- background: #8786b7
- text-shadow: 0 1px 1px rgba(0, 0, 0, 0.4)
- @include radius(2px)
- .oe_searchview_custom_delete
- display: none
+ input
+ margin-left: 0
+ .searchview_extended_prop_field
+ display: inline
+ width: calc(100% - 20px)
+
+ .searchview_extended_prop_op
+ margin: 3px 0
+ width: calc(100% - 20px)
+ .searchview_extended_delete_prop
+ float: right
+ display: inline
+ .searchview_extended_prop_value
+ width: calc(100% - 20px)
+ > select, > input
+ width: calc(100% - 20px)
+ .oe_datepicker_main
+ width: calc(100% - 20px)
+ .oe_datepicker_master
+ width: 100%
+ .fa-calendar
+ margin-left: -21px
+ cursor: pointer
+ span.fa-trash-o
position: absolute
- bottom: 1px
- right: 4px
- .oe_searchview_custom_private, .oe_searchview_custom_public
- &:hover
- .oe_searchview_custom_delete
- display: inline-block
- .oe_searchview_custom_public:after
- content: ","
- font-family: "entypoRegular" !important
- font-size: 22px
- font-weight: 300 !important
- margin: 0 0 0 4px
- padding: 0
+ top: 6px
+ right: 10px
+ cursor: pointer
+ .dropdown-menu
+ > li
+ position: relative
+ white-space: nowrap
+ li.oe-filter-condition
+ white-space: normal
+ padding-left: 25px
+ padding-right: 10px
+ margin-bottom: 5px
+ a
+ display: inline-block
+
+ input.oe-save-name
+ width: auto
+ .oe_pager_value
+ display: inline-block
+
// }}}
// Views Common {{{
.oe_view_nocontent
@@ -1784,6 +1568,9 @@ $sheet-padding: 16px
width: auto
.oe_datepicker_root
display: inline-block
+ .datepickerbutton
+ margin-left: 5px
+ cursor: pointer
.oe_form_required
input:not([disabled]):not([readonly]), select:not([disabled]):not([readonly]), textarea:not([disabled]):not([readonly])
background-color: #D2D2FF !important
@@ -2360,6 +2147,8 @@ $sheet-padding: 16px
content: "[newline]"
.oe_debug_view
float: left
+ margin-top: 5px
+ width: auto
.oe_debug_view_log
font-size: 95%
line-height: 1.2em
@@ -2410,8 +2199,6 @@ $sheet-padding: 16px
background-color: #7c7bad
// Customize for global tags
- button, body
- line-height: normal
h1,h2
font-weight: bold
h3
@@ -2447,8 +2234,6 @@ $sheet-padding: 16px
@-moz-document url-prefix()
.openerp
- .oe_searchview .oe_searchview_search
- top: -1px
.oe_form_field_many2one .oe_m2o_cm_button
line-height: 18px
.oe_webclient
diff --git a/addons/web/static/src/js/openerpframework.js b/addons/web/static/src/js/openerpframework.js
index fd13bea49cb..b112783793f 100644
--- a/addons/web/static/src/js/openerpframework.js
+++ b/addons/web/static/src/js/openerpframework.js
@@ -287,7 +287,17 @@ openerp.ParentedMixin = {
});
this.setParent(undefined);
this.__parentedDestroyed = true;
- }
+ },
+ /**
+ * Find the closest ancestor matching predicate
+ */
+ findAncestor: function (predicate) {
+ var ancestor = this;
+ while (!(predicate(ancestor)) && ancestor && ancestor.getParent) {
+ ancestor = ancestor.getParent();
+ }
+ return ancestor;
+ },
};
/**
diff --git a/addons/web/static/src/js/search.js b/addons/web/static/src/js/search.js
index f14b8c010f1..416e64697e2 100644
--- a/addons/web/static/src/js/search.js
+++ b/addons/web/static/src/js/search.js
@@ -7,9 +7,6 @@ openerp.web.search = {};
var QWeb = instance.web.qweb,
_t = instance.web._t,
_lt = instance.web._lt;
-_.mixin({
- sum: function (obj) { return _.reduce(obj, function (a, b) { return a + b; }, 0); }
-});
/** @namespace */
var my = instance.web.search = {};
@@ -330,18 +327,15 @@ instance.web.SearchView = instance.web.Widget.extend(/** @lends instance.web.Sea
}
},
// search button
- 'click button.oe_searchview_search': function (e) {
+ 'click div.oe_searchview_search': function (e) {
e.stopImmediatePropagation();
this.do_search();
},
- 'click .oe_searchview_clear': function (e) {
- e.stopImmediatePropagation();
- this.query.reset();
- },
'click .oe_searchview_unfold_drawer': function (e) {
e.stopImmediatePropagation();
- if (this.drawer)
- this.drawer.toggle();
+ $(e.target).toggleClass('fa-caret-down fa-caret-up');
+ localStorage.visible_search_menu = (localStorage.visible_search_menu !== 'true');
+ this.toggle_buttons();
},
'keydown .oe_searchview_input, .oe_searchview_facet': function (e) {
switch(e.which) {
@@ -379,84 +373,248 @@ instance.web.SearchView = instance.web.Widget.extend(/** @lends instance.web.Sea
disable_custom_filters: false,
});
this._super(parent);
+ this.query = undefined;
this.dataset = dataset;
- this.model = dataset.model;
this.view_id = view_id;
-
+ this.search_fields = [];
+ this.filters = [];
+ this.groupbys = [];
+ this.visible_filters = (localStorage.visible_search_menu === 'true');
+ this.input_subviews = []; // for user input in searchbar
this.defaults = defaults || {};
- this.has_defaults = !_.isEmpty(this.defaults);
+ this.headless = this.options.hidden && _.isEmpty(this.defaults);
+ this.$buttons = this.options.$buttons;
- this.headless = this.options.hidden && !this.has_defaults;
-
- this.input_subviews = [];
- this.view_manager = null;
- this.$view_manager_header = null;
-
- this.ready = $.Deferred();
- this.drawer_ready = $.Deferred();
- this.fields_view_get = $.Deferred();
- this.drawer = new instance.web.SearchViewDrawer(parent, this);
-
- },
+ this.filter_menu = undefined;
+ this.groupby_menu = undefined;
+ this.favorite_menu = undefined
+ },
start: function() {
- var self = this;
- var p = this._super();
-
- this.$view_manager_header = this.$el.parents(".oe_view_manager_header").first();
-
+ if (this.headless) {
+ this.$el.hide();
+ }
+ this.toggle_visibility(false);
+ this.$facets_container = this.$('div.oe_searchview_facets');
this.setup_global_completion();
this.query = new my.SearchQuery()
.on('add change reset remove', this.proxy('do_search'))
.on('change', this.proxy('renderChangedFacets'))
.on('add reset remove', this.proxy('renderFacets'));
+ var load_view = instance.web.fields_view_get({
+ model: this.dataset._model,
+ view_id: this.view_id,
+ view_type: 'search',
+ context: this.dataset.get_context(),
+ });
+ this.$('.oe_searchview_unfold_drawer')
+ .toggleClass('fa-caret-down', !this.visible_filters)
+ .toggleClass('fa-caret-up', this.visible_filters);
+ return this.alive($.when(this._super(), load_view.then(this.view_loaded.bind(this))));
+ },
+ view_loaded: function (r) {
+ var self = this;
+ this.fields_view_get = r;
+ this.prepare_search_inputs();
+ if (this.$buttons) {
- if (this.options.hidden) {
- this.$el.hide();
+ var fields_def = new instance.web.Model(this.dataset.model).call('fields_get', {
+ context: this.dataset.context
+ });
+
+ this.groupby_menu = new my.GroupByMenu(this, this.groupbys, fields_def);
+ this.filter_menu = new my.FilterMenu(this, this.filters, fields_def);
+ this.favorite_menu = new my.FavoriteMenu(this, this.query, this.dataset.model);
+
+ this.filter_menu.appendTo(this.$buttons);
+ this.groupby_menu.appendTo(this.$buttons);
+ var custom_filters_ready = this.favorite_menu.appendTo(this.$buttons);
}
- if (this.headless) {
- this.ready.resolve();
- } else {
- var load_view = instance.web.fields_view_get({
- model: this.dataset._model,
- view_id: this.view_id,
- view_type: 'search',
- context: this.dataset.get_context(),
- });
-
- this.alive($.when(load_view)).then(function (r) {
- self.fields_view_get.resolve(r);
- return self.search_view_loaded(r);
- }).fail(function () {
- self.ready.reject.apply(null, arguments);
+ return $.when(custom_filters_ready).then(this.proxy('set_default_filters'));
+ },
+ // it should parse the arch field of the view, instantiate the corresponding
+ // filters/fields, and put them in the correct variables:
+ // * this.search_fields is a list of all the fields,
+ // * this.filters: groups of filters
+ // * this.group_by: group_bys
+ prepare_search_inputs: function () {
+ var self = this,
+ arch = this.fields_view_get.arch;
+
+ var filters = [].concat.apply([], _.map(arch.children, function (item) {
+ return item.tag !== 'group' ? eval_item(item) : item.children.map(eval_item);
+ }));
+ function eval_item (item) {
+ var category = 'filters';
+ if (item.attrs.context) {
+ try {
+ var context = instance.web.pyeval.eval('context', item.attrs.context);
+ if (context.group_by) {
+ category = 'group_by';
+ }
+ } catch (e) {}
+ }
+ return {
+ item: item,
+ category: category,
+ }
+ }
+ var current_group = [],
+ current_category = 'filters',
+ categories = {filters: this.filters, group_by: this.groupbys};
+
+ _.each(filters.concat({category:'filters', item: 'separator'}), function (filter) {
+ if (filter.item.tag === 'filter' && filter.category === current_category) {
+ return current_group.push(new my.Filter(filter.item, self));
+ }
+ if (current_group.length) {
+ var group = new my.FilterGroup(current_group, self);
+ categories[current_category].push(group);
+ current_group = [];
+ }
+ if (filter.item.tag === 'field') {
+ var attrs = filter.item.attrs,
+ field = self.fields_view_get.fields[attrs.name],
+ Obj = my.fields.get_any([attrs.widget, field.type]);
+ if (Obj) {
+ self.search_fields.push(new (Obj) (filter.item, field, self));
+ }
+ }
+ if (filter.item.tag === 'filter') {
+ current_group.push(new my.Filter(filter.item, self));
+ }
+ current_category = filter.category;
+ });
+ },
+ set_default_filters: function () {
+ var self = this,
+ default_custom_filter = this.$buttons && this.favorite_menu.get_default_filter();
+ if (default_custom_filter) {
+ return this.favorite_menu.toggle_filter(default_custom_filter, true);
+ }
+ if (!_.isEmpty(this.defaults)) {
+ var inputs = this.search_fields.concat(this.filters, this.groupbys),
+ defaults = _.invoke(inputs, 'facet_for_defaults', this.defaults);
+ return $.when.apply(null, defaults).then(function () {
+ self.query.reset(_(arguments).compact(), {preventSearch: true});
});
+ }
+ this.query.reset([], {preventSearch: true});
+ return $.when();
+ },
+ /**
+ * Performs the search view collection of widget data.
+ *
+ * If the collection went well (all fields are valid), then triggers
+ * :js:func:`instance.web.SearchView.on_search`.
+ *
+ * If at least one field failed its validation, triggers
+ * :js:func:`instance.web.SearchView.on_invalid` instead.
+ *
+ * @param [_query]
+ * @param {Object} [options]
+ */
+ do_search: function (_query, options) {
+ if (options && options.preventSearch) {
+ return;
}
-
- var view_manager = this.getParent();
- while (!(view_manager instanceof instance.web.ViewManager) &&
- view_manager && view_manager.getParent) {
- view_manager = view_manager.getParent();
- }
-
- if (view_manager) {
- this.view_manager = view_manager;
- view_manager.on('switch_mode', this, function (e) {
- self.drawer.toggle(e === 'graph');
- });
- }
- return $.when(p, this.ready);
+ var search = this.build_search_data();
+ this.trigger('search_data', search.domains, search.contexts, search.groupbys);
},
+ /**
+ * Extract search data from the view's facets.
+ *
+ * Result is an object with 3 (own) properties:
+ *
+ * domains
+ * Array of domains
+ * contexts
+ * Array of contexts
+ * groupbys
+ * Array of domains, in groupby order rather than view order
+ *
+ * @return {Object}
+ */
+ build_search_data: function () {
+ var domains = [], contexts = [], groupbys = [];
- set_drawer: function (drawer) {
- this.drawer = drawer;
+ this.query.each(function (facet) {
+ var field = facet.get('field');
+ var domain = field.get_domain(facet);
+ if (domain) {
+ domains.push(domain);
+ }
+ var context = field.get_context(facet);
+ if (context) {
+ contexts.push(context);
+ }
+ var group_by = field.get_groupby(facet);
+ if (group_by) {
+ groupbys.push.apply(groupbys, group_by);
+ }
+ });
+ return {
+ domains: domains,
+ contexts: contexts,
+ groupbys: groupbys,
+ };
+ },
+ toggle_visibility: function (is_visible) {
+ this.$el.toggle(!this.headless && is_visible);
+ this.$buttons && this.$buttons.toggle(!this.headless && is_visible && this.visible_filters);
},
-
- show: function () {
- this.$el.show();
+ toggle_buttons: function (is_visible) {
+ this.visible_filters = is_visible || !this.visible_filters;
+ this.$buttons && this.$buttons.toggle(this.visible_filters);
},
- hide: function () {
- this.$el.hide();
+ /**
+ * Sets up search view's view-wide auto-completion widget
+ */
+ setup_global_completion: function () {
+ var self = this;
+ this.autocomplete = new my.AutoComplete(this, {
+ source: this.proxy('complete_global_search'),
+ select: this.proxy('select_completion'),
+ delay: 0,
+ get_search_string: function () {
+ return self.$('div.oe_searchview_input').text();
+ },
+ });
+ this.autocomplete.appendTo(this.$el);
+ },
+ /**
+ * Provide auto-completion result for req.term (an array to `resp`)
+ *
+ * @param {Object} req request to complete
+ * @param {String} req.term searched term to complete
+ * @param {Function} resp response callback
+ */
+ complete_global_search: function (req, resp) {
+ var inputs = this.search_fields.concat(this.filters, this.groupbys);
+ $.when.apply(null, _(inputs).chain()
+ .filter(function (input) { return input.visible(); })
+ .invoke('complete', req.term)
+ .value()).then(function () {
+ resp(_(arguments).chain()
+ .compact()
+ .flatten(true)
+ .value());
+ });
+ },
+ /**
+ * Action to perform in case of selection: create a facet (model)
+ * and add it to the search collection
+ *
+ * @param {Object} e selection event, preventDefault to avoid setting value on object
+ * @param {Object} ui selection information
+ * @param {Object} ui.item selected completion item
+ */
+ select_completion: function (e, ui) {
+ e.preventDefault();
+ var input_index = _(this.input_subviews).indexOf(
+ this.subviewForRoot(
+ this.$('div.oe_searchview_input:focus')[0]));
+ this.query.add(ui.item.facet, {at: input_index / 2});
},
-
subviewForRoot: function (subview_root) {
return _(this.input_subviews).detect(function (subview) {
return subview.$el[0] === subview_root;
@@ -481,77 +639,6 @@ instance.web.SearchView = instance.web.Widget.extend(/** @lends instance.web.Sea
this.subviewForRoot(subview_root), +1, true)
.$el.focus();
},
-
- /**
- * Sets up search view's view-wide auto-completion widget
- */
- setup_global_completion: function () {
- var self = this;
- this.autocomplete = new instance.web.search.AutoComplete(this, {
- source: this.proxy('complete_global_search'),
- select: this.proxy('select_completion'),
- delay: 0,
- get_search_string: function () {
- return self.$('div.oe_searchview_input').text();
- },
- width: this.$el.width(),
- });
- this.autocomplete.appendTo(this.$el);
- },
- /**
- * Provide auto-completion result for req.term (an array to `resp`)
- *
- * @param {Object} req request to complete
- * @param {String} req.term searched term to complete
- * @param {Function} resp response callback
- */
- complete_global_search: function (req, resp) {
- $.when.apply(null, _(this.drawer.inputs).chain()
- .filter(function (input) { return input.visible(); })
- .invoke('complete', req.term)
- .value()).then(function () {
- resp(_(arguments).chain()
- .compact()
- .flatten(true)
- .value());
- });
- },
-
- /**
- * Action to perform in case of selection: create a facet (model)
- * and add it to the search collection
- *
- * @param {Object} e selection event, preventDefault to avoid setting value on object
- * @param {Object} ui selection information
- * @param {Object} ui.item selected completion item
- */
- select_completion: function (e, ui) {
- e.preventDefault();
-
- var input_index = _(this.input_subviews).indexOf(
- this.subviewForRoot(
- this.$('div.oe_searchview_input:focus')[0]));
- this.query.add(ui.item.facet, {at: input_index / 2});
- },
- childFocused: function () {
- this.$el.addClass('oe_focused');
- },
- childBlurred: function () {
- var val = this.$el.val();
- this.$el.val('');
- this.$el.removeClass('oe_focused')
- .trigger('blur');
- this.autocomplete.close();
- },
- /**
- * Call the renderFacets method with the correct arguments.
- * This is due to the fact that change events are called with two arguments
- * (model, options) while add, reset and remove events are called with
- * (collection, model, options) as arguments
- */
- renderChangedFacets: function (model, options) {
- this.renderFacets(undefined, model, options);
- },
/**
* @param {openerp.web.search.SearchQuery | undefined} Undefined if event is change
* @param {openerp.web.search.Facet}
@@ -560,20 +647,19 @@ instance.web.SearchView = instance.web.Widget.extend(/** @lends instance.web.Sea
renderFacets: function (collection, model, options) {
var self = this;
var started = [];
- var $e = this.$('div.oe_searchview_facets');
_.invoke(this.input_subviews, 'destroy');
this.input_subviews = [];
var i = new my.InputView(this);
- started.push(i.appendTo($e));
+ started.push(i.appendTo(this.$facets_container));
this.input_subviews.push(i);
this.query.each(function (facet) {
var f = new my.FacetView(this, facet);
- started.push(f.appendTo($e));
+ started.push(f.appendTo(self.$facets_container));
self.input_subviews.push(f);
var i = new my.InputView(this);
- started.push(i.appendTo($e));
+ started.push(i.appendTo(self.$facets_container));
self.input_subviews.push(i);
}, this);
_.each(this.input_subviews, function (childView) {
@@ -594,320 +680,22 @@ instance.web.SearchView = instance.web.Widget.extend(/** @lends instance.web.Sea
input_to_focus.$el.focus();
});
},
-
- search_view_loaded: function(data) {
- var self = this;
- this.fields_view = data;
- if (data.type !== 'search' ||
- data.arch.tag !== 'search') {
- throw new Error(_.str.sprintf(
- "Got non-search view after asking for a search view: type %s, arch root %s",
- data.type, data.arch.tag));
- }
-
- return this.drawer_ready
- .then(this.proxy('setup_default_query'))
- .then(function () {
- self.trigger("search_view_loaded", data);
- self.ready.resolve();
- });
+ childFocused: function () {
+ this.$el.addClass('active');
},
- setup_default_query: function () {
- // Hacky implementation of CustomFilters#facet_for_defaults ensure
- // CustomFilters will be ready (and CustomFilters#filters will be
- // correctly filled) by the time this method executes.
- var custom_filters = this.drawer.custom_filters.filters;
- if (!this.options.disable_custom_filters && !_(custom_filters).isEmpty()) {
- // Check for any is_default custom filter
- var personal_filter = _(custom_filters).find(function (filter) {
- return filter.user_id && filter.is_default;
- });
- if (personal_filter) {
- this.drawer.custom_filters.toggle_filter(personal_filter, true);
- return;
- }
-
- var global_filter = _(custom_filters).find(function (filter) {
- return !filter.user_id && filter.is_default;
- });
- if (global_filter) {
- this.drawer.custom_filters.toggle_filter(global_filter, true);
- return;
- }
- }
- // No custom filter, or no is_default custom filter, apply view defaults
- this.query.reset(_(arguments).compact(), {preventSearch: true});
+ childBlurred: function () {
+ this.$el.val('').removeClass('active').trigger('blur');
+ this.autocomplete.close();
},
/**
- * Extract search data from the view's facets.
- *
- * Result is an object with 4 (own) properties:
- *
- * errors
- * An array of any error generated during data validation and
- * extraction, contains the validation error objects
- * domains
- * Array of domains
- * contexts
- * Array of contexts
- * groupbys
- * Array of domains, in groupby order rather than view order
- *
- * @return {Object}
+ * Call the renderFacets method with the correct arguments.
+ * This is due to the fact that change events are called with two arguments
+ * (model, options) while add, reset and remove events are called with
+ * (collection, model, options) as arguments
*/
- build_search_data: function () {
- var domains = [], contexts = [], groupbys = [], errors = [];
-
- this.query.each(function (facet) {
- var field = facet.get('field');
- try {
- var domain = field.get_domain(facet);
- if (domain) {
- domains.push(domain);
- }
- var context = field.get_context(facet);
- if (context) {
- contexts.push(context);
- }
- var group_by = field.get_groupby(facet);
- if (group_by) {
- groupbys.push.apply(groupbys, group_by);
- }
- } catch (e) {
- if (e instanceof instance.web.search.Invalid) {
- errors.push(e);
- } else {
- throw e;
- }
- }
- });
- return {
- domains: domains,
- contexts: contexts,
- groupbys: groupbys,
- errors: errors
- };
- },
- /**
- * Performs the search view collection of widget data.
- *
- * If the collection went well (all fields are valid), then triggers
- * :js:func:`instance.web.SearchView.on_search`.
- *
- * If at least one field failed its validation, triggers
- * :js:func:`instance.web.SearchView.on_invalid` instead.
- *
- * @param [_query]
- * @param {Object} [options]
- */
- do_search: function (_query, options) {
- if (options && options.preventSearch) {
- return;
- }
- var search = this.build_search_data();
- if (!_.isEmpty(search.errors)) {
- this.on_invalid(search.errors);
- return;
- }
- this.trigger('search_data', search.domains, search.contexts, search.groupbys);
+ renderChangedFacets: function (model, options) {
+ this.renderFacets(undefined, model, options);
},
- /**
- * Triggered after the SearchView has collected all relevant domains and
- * contexts.
- *
- * It is provided with an Array of domains and an Array of contexts, which
- * may or may not be evaluated (each item can be either a valid domain or
- * context, or a string to evaluate in order in the sequence)
- *
- * It is also passed an array of contexts used for group_by (they are in
- * the correct order for group_by evaluation, which contexts may not be)
- *
- * @event
- * @param {Array} domains an array of literal domains or domain references
- * @param {Array} contexts an array of literal contexts or context refs
- * @param {Array} groupbys ordered contexts which may or may not have group_by keys
- */
- /**
- * Triggered after a validation error in the SearchView fields.
- *
- * Error objects have three keys:
- * * ``field`` is the name of the invalid field
- * * ``value`` is the invalid value
- * * ``message`` is the (in)validation message provided by the field
- *
- * @event
- * @param {Array} errors a never-empty array of error objects
- */
- on_invalid: function (errors) {
- this.do_notify(_t("Invalid Search"), _t("triggered from search view"));
- this.trigger('invalid_search', errors);
- },
-
- // The method appendTo is overwrited to be able to insert the drawer anywhere
- appendTo: function ($searchview_parent, $searchview_drawer_node) {
- var $searchview_drawer_node = $searchview_drawer_node || $searchview_parent;
-
- return $.when(
- this._super($searchview_parent),
- this.drawer.appendTo($searchview_drawer_node)
- );
- },
-
- destroy: function () {
- this.drawer.destroy();
- this.getParent().destroy.call(this);
- }
-});
-
-instance.web.SearchViewDrawer = instance.web.Widget.extend({
- template: "SearchViewDrawer",
-
- init: function(parent, searchview) {
- this._super(parent);
- this.searchview = searchview;
- this.searchview.set_drawer(this);
- this.ready = searchview.drawer_ready;
- this.controls = [];
- this.inputs = [];
- },
-
- toggle: function (visibility) {
- this.$el.toggle(visibility);
- var $view_manager_body = this.$el.closest('.oe_view_manager_body');
- if ($view_manager_body.length) {
- $view_manager_body.scrollTop(0);
- }
- },
-
- start: function() {
- var self = this;
- if (this.searchview.headless) return $.when(this._super(), this.searchview.ready);
- var filters_ready = this.searchview.fields_view_get
- .then(this.proxy('prepare_filters'));
- return $.when(this._super(), filters_ready).then(function () {
- var defaults = arguments[1][0];
- self.ready.resolve.apply(null, defaults);
- });
- },
- prepare_filters: function (data) {
- this.make_widgets(
- data['arch'].children,
- data.fields);
-
- this.add_common_inputs();
-
- // build drawer
- var in_drawer = this.select_for_drawer();
-
- var $first_col = this.$(".col-md-7"),
- $snd_col = this.$(".col-md-5");
-
- var add_custom_filters = in_drawer[0].appendTo($first_col),
- add_filters = in_drawer[1].appendTo($first_col),
- add_rest = $.when.apply(null, _(in_drawer.slice(2)).invoke('appendTo', $snd_col)),
- defaults_fetched = $.when.apply(null, _(this.inputs).invoke(
- 'facet_for_defaults', this.searchview.defaults));
-
- return $.when(defaults_fetched, add_custom_filters, add_filters, add_rest);
- },
- /**
- * Sets up thingie where all the mess is put?
- */
- select_for_drawer: function () {
- return _(this.inputs).filter(function (input) {
- return input.in_drawer();
- });
- },
-
- /**
- * Builds a list of widget rows (each row is an array of widgets)
- *
- * @param {Array} items a list of nodes to convert to widgets
- * @param {Object} fields a mapping of field names to (ORM) field attributes
- * @param {Object} [group] group to put the new controls in
- */
- make_widgets: function (items, fields, group) {
- if (!group) {
- group = new instance.web.search.Group(
- this, 'q', {attrs: {string: _t("Filters")}});
- }
- var self = this;
- var filters = [];
- _.each(items, function (item) {
- if (filters.length && item.tag !== 'filter') {
- group.push(new instance.web.search.FilterGroup(filters, group));
- filters = [];
- }
-
- switch (item.tag) {
- case 'separator': case 'newline':
- break;
- case 'filter':
- filters.push(new instance.web.search.Filter(item, group));
- break;
- case 'group':
- self.add_separator();
- self.make_widgets(item.children, fields,
- new instance.web.search.Group(group, 'w', item));
- self.add_separator();
- break;
- case 'field':
- var field = this.make_field(
- item, fields[item['attrs'].name], group);
- group.push(field);
- // filters
- self.make_widgets(item.children, fields, group);
- break;
- }
- }, this);
-
- if (filters.length) {
- group.push(new instance.web.search.FilterGroup(filters, this));
- }
- },
-
- add_separator: function () {
- if (!(_.last(this.inputs) instanceof instance.web.search.Separator))
- new instance.web.search.Separator(this);
- },
- /**
- * Creates a field for the provided field descriptor item (which comes
- * from fields_view_get)
- *
- * @param {Object} item fields_view_get node for the field
- * @param {Object} field fields_get result for the field
- * @param {Object} [parent]
- * @returns instance.web.search.Field
- */
- make_field: function (item, field, parent) {
- // M2O combined with selection widget is pointless and broken in search views,
- // but has been used in the past for unsupported hacks -> ignore it
- if (field.type === "many2one" && item.attrs.widget === "selection"){
- item.attrs.widget = undefined;
- }
- var obj = instance.web.search.fields.get_any( [item.attrs.widget, field.type]);
- if(obj) {
- return new (obj) (item, field, parent || this);
- } else {
- console.group('Unknown field type ' + field.type);
- console.error('View node', item);
- console.info('View field', field);
- console.info('In view', this);
- console.groupEnd();
- return null;
- }
- },
-
- add_common_inputs: function() {
- // add custom filters to this.inputs
- this.custom_filters = new instance.web.search.CustomFilters(this);
- // add Filters to this.inputs, need view.controls filled
- (new instance.web.search.Filters(this));
- (new instance.web.search.SaveFilter(this, this.custom_filters));
- // add Advanced to this.inputs
- (new instance.web.search.Advanced(this));
- },
-
});
/**
@@ -929,91 +717,17 @@ instance.web.search.fields = new instance.web.Registry({
'many2many': 'instance.web.search.CharField',
'one2many': 'instance.web.search.CharField'
});
-instance.web.search.Invalid = instance.web.Class.extend( /** @lends instance.web.search.Invalid# */{
- /**
- * Exception thrown by search widgets when they hold invalid values,
- * which they can not return when asked.
- *
- * @constructs instance.web.search.Invalid
- * @extends instance.web.Class
- *
- * @param field the name of the field holding an invalid value
- * @param value the invalid value
- * @param message validation failure message
- */
- init: function (field, value, message) {
- this.field = field;
- this.value = value;
- this.message = message;
- },
- toString: function () {
- return _.str.sprintf(
- _t("Incorrect value for field %(fieldname)s: [%(value)s] is %(message)s"),
- {fieldname: this.field, value: this.value, message: this.message}
- );
- }
-});
-instance.web.search.Widget = instance.web.Widget.extend( /** @lends instance.web.search.Widget# */{
- template: null,
- /**
- * Root class of all search widgets
- *
- * @constructs instance.web.search.Widget
- * @extends instance.web.Widget
- *
- * @param parent parent of this widget
- */
- init: function (parent) {
- this._super(parent);
- var ancestor = parent;
- do {
- this.drawer = ancestor;
- } while (!(ancestor instanceof instance.web.SearchViewDrawer)
- && (ancestor = (ancestor.getParent && ancestor.getParent())));
- this.view = this.drawer.searchview || this.drawer;
- }
-});
-instance.web.search.add_expand_listener = function($root) {
- $root.find('a.searchview_group_string').click(function (e) {
- $root.toggleClass('folded expanded');
- e.stopPropagation();
- e.preventDefault();
- });
-};
-instance.web.search.Group = instance.web.search.Widget.extend({
- init: function (parent, icon, node) {
- this._super(parent);
- var attrs = node.attrs;
- this.modifiers = attrs.modifiers =
- attrs.modifiers ? JSON.parse(attrs.modifiers) : {};
- this.attrs = attrs;
- this.icon = icon;
- this.name = attrs.string;
- this.children = [];
-
- this.drawer.controls.push(this);
- },
- push: function (input) {
- this.children.push(input);
- },
- visible: function () {
- return !this.modifiers.invisible;
- },
-});
-
-instance.web.search.Input = instance.web.search.Widget.extend( /** @lends instance.web.search.Input# */{
- _in_drawer: false,
+instance.web.search.Input = instance.web.Widget.extend( /** @lends instance.web.search.Input# */{
/**
* @constructs instance.web.search.Input
- * @extends instance.web.search.Widget
+ * @extends instance.web.Widget
*
* @param parent
*/
init: function (parent) {
this._super(parent);
this.load_attrs({});
- this.drawer.inputs.push(this);
},
/**
* Fetch auto-completion values for the widget.
@@ -1045,9 +759,6 @@ instance.web.search.Input = instance.web.search.Widget.extend( /** @lends instan
}
return this.facet_for(defaults[this.attrs.name]);
},
- in_drawer: function () {
- return !!this._in_drawer;
- },
get_context: function () {
throw new Error(
"get_context not implemented for widget " + this.attrs.type);
@@ -1072,23 +783,12 @@ instance.web.search.Input = instance.web.search.Widget.extend( /** @lends instan
* @returns {Boolean}
*/
visible: function () {
- if (this.attrs.modifiers.invisible) {
- return false;
- }
- var parent = this;
- while ((parent = parent.getParent()) &&
- ( (parent instanceof instance.web.search.Group)
- || (parent instanceof instance.web.search.Input))) {
- if (!parent.visible()) {
- return false;
- }
- }
- return true;
+ return !this.attrs.modifiers.invisible;
},
});
instance.web.search.FilterGroup = instance.web.search.Input.extend(/** @lends instance.web.search.FilterGroup# */{
template: 'SearchView.filters',
- icon: 'q',
+ icon: "fa-filter",
completion_label: _lt("Filter on: %s"),
/**
* Inclusive group of filters, creates a continuous "button" with clickable
@@ -1112,10 +812,11 @@ instance.web.search.FilterGroup = instance.web.search.Input.extend(/** @lends in
}
this._super(parent);
this.filters = filters;
- this.view.query.on('add remove change reset', this.proxy('search_change'));
+ this.searchview = parent;
+ this.searchview.query.on('add remove change reset', this.proxy('search_change'));
},
start: function () {
- this.$el.on('click', 'li', this.proxy('toggle_filter'));
+ this.$el.on('click', 'a', this.proxy('toggle_filter'));
return $.when(null);
},
/**
@@ -1124,15 +825,15 @@ instance.web.search.FilterGroup = instance.web.search.Input.extend(/** @lends in
*/
search_change: function () {
var self = this;
- var $filters = this.$('> li').removeClass('badge');
- var facet = this.view.query.find(_.bind(this.match_facet, this));
+ var $filters = this.$el.removeClass('selected');
+ var facet = this.searchview.query.find(_.bind(this.match_facet, this));
if (!facet) { return; }
facet.values.each(function (v) {
var i = _(self.filters).indexOf(v.get('value'));
if (i === -1) { return; }
$filters.filter(function () {
return Number($(this).data('index')) === i;
- }).addClass('badge');
+ }).addClass('selected');
});
},
/**
@@ -1222,10 +923,16 @@ instance.web.search.FilterGroup = instance.web.search.Input.extend(/** @lends in
});
},
toggle_filter: function (e) {
- this.toggle(this.filters[Number($(e.target).data('index'))]);
+ e.stopPropagation();
+ this.toggle(this.filters[Number($(e.target).parent().data('index'))]);
},
- toggle: function (filter) {
- this.view.query.toggle(this.make_facet([this.make_value(filter)]));
+ toggle: function (filter, options) {
+ this.searchview.query.toggle(this.make_facet([this.make_value(filter)]), options);
+ },
+ is_visible: function () {
+ return _.some(this.filters, function (filter) {
+ return !filter.attrs.invisible;
+ });
},
complete: function (item) {
var self = this;
@@ -1256,10 +963,11 @@ instance.web.search.FilterGroup = instance.web.search.Input.extend(/** @lends in
}
});
instance.web.search.GroupbyGroup = instance.web.search.FilterGroup.extend({
- icon: 'w',
+ icon: 'fa-bars',
completion_label: _lt("Group by: %s"),
init: function (filters, parent) {
this._super(filters, parent);
+ this.searchview = parent;
// Not flanders: facet unicity is handled through the
// (category, field) pair of facet attributes. This is all well and
// good for regular filter groups where a group matches a facet, but for
@@ -1267,8 +975,8 @@ instance.web.search.GroupbyGroup = instance.web.search.FilterGroup.extend({
// view which proxies to the first GroupbyGroup, so it can be used
// for every GroupbyGroup and still provides the various methods needed
// by the search view. Use weirdo name to avoid risks of conflicts
- if (!this.view._s_groupby) {
- this.view._s_groupby = {
+ if (!this.searchview._s_groupby) {
+ this.searchview._s_groupby = {
help: "See GroupbyGroup#init",
get_context: this.proxy('get_context'),
get_domain: this.proxy('get_domain'),
@@ -1277,14 +985,14 @@ instance.web.search.GroupbyGroup = instance.web.search.FilterGroup.extend({
}
},
match_facet: function (facet) {
- return facet.get('field') === this.view._s_groupby;
+ return facet.get('field') === this.searchview._s_groupby;
},
make_facet: function (values) {
return {
category: _t("GroupBy"),
icon: this.icon,
values: values,
- field: this.view._s_groupby
+ field: this.searchview._s_groupby
};
}
});
@@ -1313,14 +1021,6 @@ instance.web.search.Filter = instance.web.search.Input.extend(/** @lends instanc
get_domain: function () { },
});
-instance.web.search.Separator = instance.web.search.Input.extend({
- _in_drawer: false,
-
- complete: function () {
- return {is_separator: true};
- }
-});
-
instance.web.search.Field = instance.web.search.Input.extend( /** @lends instance.web.search.Field# */ {
template: 'SearchView.field',
default_operator: '=',
@@ -1495,7 +1195,7 @@ instance.web.search.FloatField = instance.web.search.NumberField.extend(/** @len
function facet_from(field, pair) {
return {
field: field,
- category: field['attrs'].string,
+ category: field.attrs.string,
values: [{label: pair[1], value: pair[0]}]
};
}
@@ -1610,6 +1310,7 @@ instance.web.search.ManyToOneField = instance.web.search.CharField.extend({
init: function (view_section, field, parent) {
this._super(view_section, field, parent);
this.model = new instance.web.Model(this.attrs.relation);
+ this.searchview = parent;
},
complete: function (value) {
@@ -1633,7 +1334,7 @@ instance.web.search.ManyToOneField = instance.web.search.CharField.extend({
var self = this;
// FIXME: "concurrent" searches (multiple requests, mis-ordered responses)
var context = instance.web.pyeval.eval(
- 'contexts', [this.view.dataset.get_context()]);
+ 'contexts', [this.searchview.dataset.get_context()]);
return this.model.call('name_search', [], {
name: needle,
args: (typeof this.attrs.domain === 'string') ? [] : this.attrs.domain,
@@ -1693,40 +1394,287 @@ instance.web.search.ManyToOneField = instance.web.search.CharField.extend({
}
});
-instance.web.search.CustomFilters = instance.web.search.Input.extend({
- template: 'SearchView.Custom',
- _in_drawer: true,
- init: function () {
- this.is_ready = $.Deferred();
- this._super.apply(this,arguments);
+instance.web.search.FilterMenu = instance.web.Widget.extend({
+ template: 'SearchView.FilterMenu',
+ events: {
+ 'click .oe-add-filter': function () {
+ this.toggle_custom_filter_menu();
+ },
+ 'click li': function (event) {event.stopImmediatePropagation();},
+ 'hidden.bs.dropdown': function () {
+ this.toggle_custom_filter_menu(false);
+ },
+ 'click .oe-add-condition': 'append_proposition',
+ 'click .oe-apply-filter': 'commit_search',
+ },
+ init: function (parent, filters, fields_def) {
+ var self = this;
+ this._super(parent);
+ this.filters = filters || [];
+ this.searchview = parent;
+ this.propositions = [];
+ this.fields_def = fields_def.then(function (data) {
+ var fields = {
+ id: { string: 'ID', type: 'id', searchable: true }
+ };
+ _.each(data, function(field_def, field_name) {
+ if (field_def.selectable !== false && field_name !== 'id') {
+ fields[field_name] = field_def;
+ }
+ });
+ return fields;
+ });
},
start: function () {
var self = this;
+ this.$menu = this.$('.filters-menu');
+ this.$add_filter = this.$('.oe-add-filter');
+ this.$apply_filter = this.$('.oe-apply-filter');
+ this.$add_filter_menu = this.$('.oe-add-filter-menu');
+ _.each(this.filters, function (group) {
+ if (group.is_visible()) {
+ group.insertBefore(self.$add_filter);
+ $('
').insertBefore(self.$add_filter);
+ }
+ });
+ this.append_proposition().then(function (prop) {
+ prop.$el.hide();
+ });
+ },
+ toggle_custom_filter_menu: function (is_open) {
+ this.$add_filter
+ .toggleClass('closed-menu', !is_open)
+ .toggleClass('open-menu', is_open);
+ this.$add_filter_menu.toggle(is_open);
+ if (this.$add_filter.hasClass('closed-menu') && (!this.propositions.length)) {
+ this.append_proposition();
+ }
+ this.$('.oe-filter-condition').toggle(is_open);
+ },
+ append_proposition: function () {
+ var self = this;
+ return this.fields_def.then(function (fields) {
+ var prop = new instance.web.search.ExtendedSearchProposition(self, fields);
+ self.propositions.push(prop);
+ prop.insertBefore(self.$add_filter_menu);
+ self.$apply_filter.prop('disabled', false);
+ return prop;
+ });
+ },
+ remove_proposition: function (prop) {
+ this.propositions = _.without(this.propositions, prop);
+ if (!this.propositions.length) {
+ this.$apply_filter.prop('disabled', true);
+ }
+ prop.destroy();
+ },
+ commit_search: function () {
+ var filters = _.invoke(this.propositions, 'get_filter'),
+ filters_widgets = _.map(filters, function (filter) {
+ return new my.Filter(filter, this);
+ }),
+ filter_group = new my.FilterGroup(filters_widgets, this.searchview),
+ facets = filters_widgets.map(function (filter) {
+ return filter_group.make_facet([filter_group.make_value(filter)]);
+ });
+ filter_group.insertBefore(this.$add_filter);
+ $('').insertBefore(this.$add_filter);
+ this.searchview.query.add(facets, {silent: true});
+ this.searchview.query.trigger('reset');
+
+ _.invoke(this.propositions, 'destroy');
+ this.propositions = [];
+ this.append_proposition();
+ this.toggle_custom_filter_menu(false);
+ },
+});
+
+instance.web.search.GroupByMenu = instance.web.Widget.extend({
+ template: 'SearchView.GroupByMenu',
+ events: {
+ 'click li': function (event) {
+ event.stopImmediatePropagation();
+ },
+ 'hidden.bs.dropdown': function () {
+ this.toggle_add_menu(false);
+ },
+ 'click .add-custom-group a': function () {
+ this.toggle_add_menu();
+ },
+ },
+ init: function (parent, groups, fields_def) {
+ this._super(parent);
+ this.groups = groups || [];
+ this.groupable_fields = {};
+ this.searchview = parent;
+ this.fields_def = fields_def.then(this.proxy('get_groupable_fields'));
+ },
+ start: function () {
+ var self = this;
+ this.$menu = this.$('.group-by-menu');
+ var divider = this.$menu.find('.divider');
+ _.invoke(this.groups, 'insertBefore', divider);
+ if (this.groups.length) {
+ divider.show();
+ }
+ this.$add_group = this.$menu.find('.add-custom-group');
+ this.fields_def.then(function () {
+ self.$menu.append(QWeb.render('GroupByMenuSelector', self));
+ self.$add_group_menu = self.$('.oe-add-group');
+ self.$group_selector = self.$('.oe-group-selector');
+ self.$('.oe-select-group').click(function (event) {
+ self.toggle_add_menu(false);
+ var field = self.$group_selector.find(':selected').data('name');
+ self.add_groupby_to_menu(field);
+ });
+ });
+ },
+ get_groupable_fields: function (fields) {
+ var self = this,
+ groupable_types = ['many2one', 'char', 'boolean', 'selection', 'date', 'datetime'];
+
+ _.each(fields, function (field, name) {
+ if (field.store && _.contains(groupable_types, field.type)) {
+ self.groupable_fields[name] = field;
+ }
+ });
+ },
+ toggle_add_menu: function (is_open) {
+ this.$add_group
+ .toggleClass('closed-menu', !is_open)
+ .toggleClass('open-menu', is_open);
+ this.$add_group_menu.toggle(is_open);
+ if (this.$add_group.hasClass('open-menu')) {
+ this.$group_selector.focus();
+ }
+ },
+ add_groupby_to_menu: function (field_name) {
+ var filter = new my.Filter({attrs:{
+ context:"{'group_by':'" + field_name + "''}",
+ name: this.groupable_fields[field_name].string,
+ }}, this.searchview);
+ var group = new my.FilterGroup([filter], this.searchview),
+ divider = this.$('.divider').show();
+ group.insertBefore(divider);
+ group.toggle(filter);
+ },
+});
+
+instance.web.search.FavoriteMenu = instance.web.Widget.extend({
+ template: 'SearchView.FavoriteMenu',
+ events: {
+ 'click li': function (event) {
+ event.stopImmediatePropagation();
+ },
+ 'click .oe-save-search a': function () {
+ this.toggle_save_menu();
+ },
+ 'click .oe-save-name button': 'save_favorite',
+ 'hidden.bs.dropdown': function () {
+ this.close_menus();
+ },
+ },
+ init: function (parent, query, target_model) {
+ this._super.apply(this,arguments);
+ this.searchview = parent;
+ this.query = query;
+ this.target_model = target_model;
this.model = new instance.web.Model('ir.filters');
this.filters = {};
this.$filters = {};
- this.view.query
+ var action = instance.client.action_manager.inner_action;
+ this.action_id = action && action.id;
+ },
+ start: function () {
+ var self = this;
+ this.$save_search = this.$('.oe-save-search');
+ this.$save_name = this.$('.oe-save-name');
+ this.$inputs = this.$save_name.find('input');
+ this.$divider = this.$('.divider');
+ this.$inputs.eq(0).val(this.searchview.getParent().title);
+ var $shared_filter = this.$inputs.eq(1),
+ $default_filter = this.$inputs.eq(2);
+ $shared_filter.click(function () {$default_filter.prop('checked', false)});
+ $default_filter.click(function () {$shared_filter.prop('checked', false)});
+
+ this.query
.on('remove', function (facet) {
- if (!facet.get('is_custom_filter')) {
- return;
+ if (facet.get('is_custom_filter')) {
+ self.clear_selection();
}
- self.clear_selection();
})
.on('reset', this.proxy('clear_selection'));
- return this.model.call('get_filters', [this.view.model, this.get_action_id()])
- .then(this.proxy('set_filters'))
- .done(function () { self.is_ready.resolve(); })
- .fail(function () { self.is_ready.reject.apply(self.is_ready, arguments); });
+ return this.model.call('get_filters', [this.target_model, this.action_id])
+ .done(this.proxy('prepare_dropdown_menu'));
},
- get_action_id: function(){
- var action = instance.client.action_manager.inner_action;
- if (action) return action.id;
+ prepare_dropdown_menu: function (filters) {
+ filters.map(this.append_filter.bind(this));
},
- /**
- * Special implementation delaying defaults until CustomFilters is loaded
- */
- facet_for_defaults: function () {
- return this.is_ready;
+ toggle_save_menu: function (is_open) {
+ this.$save_search
+ .toggleClass('closed-menu', !is_open)
+ .toggleClass('open-menu', is_open);
+ this.$save_name.toggle(is_open);
+ if (this.$save_search.hasClass('open-menu')) {
+ this.$save_name.find('input').first().focus();
+ }
+ },
+ close_menus: function () {
+ this.toggle_save_menu(false);
+ },
+ save_favorite: function () {
+ var self = this,
+ filter_name = this.$inputs[0].value,
+ default_filter = this.$inputs[1].checked,
+ shared_filter = this.$inputs[2].checked;
+ if (!filter_name.length){
+ this.do_warn(_t("Error"), _t("Filter name is required."));
+ this.$inputs.first().focus();
+ return;
+ }
+ var search = this.searchview.build_search_data(),
+ results = instance.web.pyeval.sync_eval_domains_and_contexts({
+ domains: search.domains,
+ contexts: search.contexts,
+ group_by_seq: search.groupbys || [],
+ });
+ if (!_.isEmpty(results.group_by)) {
+ results.context.group_by = results.group_by;
+ }
+ // Don't save user_context keys in the custom filter, otherwise end
+ // up with e.g. wrong uid or lang stored *and used in subsequent
+ // reqs*
+ var ctx = results.context;
+ _(_.keys(instance.session.user_context)).each(function (key) {
+ delete ctx[key];
+ });
+ var filter = {
+ name: filter_name,
+ user_id: shared_filter ? false : instance.session.uid,
+ model_id: this.searchview.dataset.model,
+ context: results.context,
+ domain: results.domain,
+ is_default: default_filter,
+ action_id: this.action_id,
+ };
+ return this.model.call('create_or_replace', [filter]).done(function (id) {
+ filter.id = id;
+ self.toggle_save_menu(false);
+ self.$save_name.find('input').val('').prop('checked', false);
+ self.append_filter(filter);
+ self.toggle_filter(filter, true);
+ });
+ },
+ get_default_filter: function () {
+ var personal_filter = _.find(this.filters, function (filter) {
+ return filter.user_id && filter.is_default;
+ });
+ if (personal_filter) {
+ return personal_filter;
+ }
+ return _.find(this.filters, function (filter) {
+ return !filter.user_id && filter.is_default;
+ });
},
/**
* Generates a mapping key (in the filters and $filter mappings) for the
@@ -1742,9 +1690,9 @@ instance.web.search.CustomFilters = instance.web.search.Input.extend({
*/
key_for: function (filter) {
var user_id = filter.user_id,
- action_id = filter.action_id;
- var uid = (user_id instanceof Array) ? user_id[0] : user_id;
- var act_id = (action_id instanceof Array) ? action_id[0] : action_id;
+ action_id = filter.action_id,
+ uid = (user_id instanceof Array) ? user_id[0] : user_id,
+ act_id = (action_id instanceof Array) ? action_id[0] : action_id;
return _.str.sprintf('(%s)(%s)%s', uid, act_id, filter.name);
},
/**
@@ -1760,264 +1708,81 @@ instance.web.search.CustomFilters = instance.web.search.Input.extend({
facet_for: function (filter) {
return {
category: _t("Custom Filter"),
- icon: 'M',
+ icon: 'fa-star',
field: {
get_context: function () { return filter.context; },
get_groupby: function () { return [filter.context]; },
get_domain: function () { return filter.domain; }
},
- _id: filter['id'],
+ _id: filter.id,
is_custom_filter: true,
values: [{label: filter.name, value: null}]
};
},
clear_selection: function () {
- this.$('span.badge').removeClass('badge');
+ this.$('li.selected').removeClass('selected');
},
append_filter: function (filter) {
- var self = this;
- var key = this.key_for(filter);
- var warning = _t("This filter is global and will be removed for everybody if you continue.");
+ var self = this,
+ key = this.key_for(filter),
+ $filter,
+ warning = _t("This filter is global and will be removed for everybody if you continue.");
- var $filter;
+ this.$divider.show();
if (key in this.$filters) {
$filter = this.$filters[key];
} else {
- var id = filter.id;
this.filters[key] = filter;
$filter = $('')
- .appendTo(this.$('.oe_searchview_custom_list'))
+ .insertBefore(this.$divider)
.toggleClass('oe_searchview_custom_default', filter.is_default)
- .append(this.$filters[key] = $('
').text(filter.name));
+ .append($('').text(filter.name));
+ this.$filters[key] = $filter;
this.$filters[key].addClass(filter.user_id ? 'oe_searchview_custom_private'
: 'oe_searchview_custom_public')
-
- $('x')
- .click(function (e) {
- e.stopPropagation();
- if (!(filter.user_id || confirm(warning))) {
- return;
- }
- self.model.call('unlink', [id]).done(function () {
- $filter.remove();
- delete self.$filters[key];
- delete self.filters[key];
- if (_.isEmpty(self.filters)) {
- self.hide();
- }
- });
+ $('')
+ .addClass('fa fa-trash-o')
+ .click(function (event) {
+ event.stopImmediatePropagation();
+ self.remove_filter(filter, $filter, key);
})
.appendTo($filter);
}
-
this.$filters[key].unbind('click').click(function () {
self.toggle_filter(filter);
});
- this.show();
},
toggle_filter: function (filter, preventSearch) {
- var current = this.view.query.find(function (facet) {
+ var current = this.query.find(function (facet) {
return facet.get('_id') === filter.id;
});
if (current) {
- this.view.query.remove(current);
- this.$filters[this.key_for(filter)].removeClass('badge');
+ this.query.remove(current);
+ this.$filters[this.key_for(filter)].removeClass('selected');
return;
}
- this.view.query.reset([this.facet_for(filter)], {
+ this.query.reset([this.facet_for(filter)], {
preventSearch: preventSearch || false});
- this.$filters[this.key_for(filter)].addClass('badge');
+ this.$filters[this.key_for(filter)].addClass('selected');
},
- set_filters: function (filters) {
- _(filters).map(_.bind(this.append_filter, this));
- if (!filters.length) {
- this.hide();
- }
- },
- hide: function () {
- this.$el.hide();
- },
- show: function () {
- this.$el.show();
- },
-});
-
-instance.web.search.SaveFilter = instance.web.search.Input.extend({
- template: 'SearchView.SaveFilter',
- _in_drawer: true,
- init: function (parent, custom_filters) {
- this._super(parent);
- this.custom_filters = custom_filters;
- },
- start: function () {
+ remove_filter: function (filter, $filter, key) {
var self = this;
- this.model = new instance.web.Model('ir.filters');
- this.$el.on('submit', 'form', this.proxy('save_current'));
- this.$el.on('click', 'input[type=checkbox]', function() {
- $(this).siblings('input[type=checkbox]').prop('checked', false);
- });
- this.$el.on('click', 'h4', function () {
- self.$el.toggleClass('oe_opened');
- });
- },
- save_current: function () {
- var self = this;
- var $name = this.$('input:first');
- var private_filter = !this.$('#oe_searchview_custom_public').prop('checked');
- var set_as_default = this.$('#oe_searchview_custom_default').prop('checked');
- if (_.isEmpty($name.val())){
- this.do_warn(_t("Error"), _t("Filter name is required."));
- return false;
+ var warning = _t("This filter is global and will be removed for everybody if you continue.");
+ if (!(filter.user_id || confirm(warning))) {
+ return;
}
- var search = this.view.build_search_data();
- instance.web.pyeval.eval_domains_and_contexts({
- domains: search.domains,
- contexts: search.contexts,
- group_by_seq: search.groupbys || []
- }).done(function (results) {
- if (!_.isEmpty(results.group_by)) {
- results.context.group_by = results.group_by;
+ this.model.call('unlink', [filter.id]).done(function () {
+ $filter.remove();
+ delete self.$filters[key];
+ delete self.filters[key];
+ if (_.isEmpty(self.filters)) {
+ self.$('li.divider').remove();
}
- // Don't save user_context keys in the custom filter, otherwise end
- // up with e.g. wrong uid or lang stored *and used in subsequent
- // reqs*
- var ctx = results.context;
- _(_.keys(instance.session.user_context)).each(function (key) {
- delete ctx[key];
- });
- var filter = {
- name: $name.val(),
- user_id: private_filter ? instance.session.uid : false,
- model_id: self.view.model,
- context: results.context,
- domain: results.domain,
- is_default: set_as_default,
- action_id: self.custom_filters.get_action_id()
- };
- // FIXME: current context?
- return self.model.call('create_or_replace', [filter]).done(function (id) {
- filter.id = id;
- if (self.custom_filters) {
- self.custom_filters.append_filter(filter);
- }
- self.$el
- .removeClass('oe_opened')
- .find('form')[0].reset();
- });
- });
- return false;
+ });
},
});
-instance.web.search.Filters = instance.web.search.Input.extend({
- template: 'SearchView.Filters',
- _in_drawer: true,
- start: function () {
- var self = this;
- var is_group = function (i) { return i instanceof instance.web.search.FilterGroup; };
- var visible_filters = _(this.drawer.controls).chain().reject(function (group) {
- return _(_(group.children).filter(is_group)).isEmpty()
- || group.modifiers.invisible;
- });
-
- var groups = visible_filters.map(function (group) {
- var filters = _(group.children).filter(is_group);
- return {
- name: _.str.sprintf("%s %s",
- group.icon, group.name),
- filters: filters,
- length: _(filters).chain().map(function (i) {
- return i.filters.length; }).sum().value()
- };
- }).value();
-
- var $dl = $('').appendTo(this.$el);
-
- var rendered_lines = _.map(groups, function (group) {
- $('- ').html(group.name).appendTo($dl);
- var $dd = $('
- ').appendTo($dl);
- return $.when.apply(null, _(group.filters).invoke('appendTo', $dd));
- });
-
- return $.when.apply(this, rendered_lines);
- },
-});
-
-instance.web.search.Advanced = instance.web.search.Input.extend({
- template: 'SearchView.advanced',
- _in_drawer: true,
- start: function () {
- var self = this;
- this.$el
- .on('keypress keydown keyup', function (e) { e.stopPropagation(); })
- .on('click', 'h4', function () {
- self.$el.toggleClass('oe_opened');
- }).on('click', 'button.oe_add_condition', function () {
- self.append_proposition();
- }).on('submit', 'form', function (e) {
- e.preventDefault();
- self.commit_search();
- });
- return $.when(
- this._super(),
- new instance.web.Model(this.view.model).call('fields_get', {
- context: this.view.dataset.context
- }).done(function(data) {
- self.fields = {
- id: { string: 'ID', type: 'id', searchable: true }
- };
- _.each(data, function(field_def, field_name) {
- if (field_def.selectable !== false && field_name != 'id') {
- self.fields[field_name] = field_def;
- }
- });
- })).done(function () {
- self.append_proposition();
- });
- },
- append_proposition: function () {
- var self = this;
- return (new instance.web.search.ExtendedSearchProposition(this, this.fields))
- .appendTo(this.$('ul')).done(function () {
- self.$('button.oe_apply').prop('disabled', false);
- });
- },
- remove_proposition: function (prop) {
- // removing last proposition, disable apply button
- if (this.getChildren().length <= 1) {
- this.$('button.oe_apply').prop('disabled', true);
- }
- prop.destroy();
- },
- commit_search: function () {
- // Get domain sections from all propositions
- var children = this.getChildren();
- var propositions = _.invoke(children, 'get_proposition');
- var domain = _(propositions).pluck('value');
- for (var i = domain.length; --i;) {
- domain.unshift('|');
- }
-
- this.view.query.add({
- category: _t("Advanced"),
- values: propositions,
- field: {
- get_context: function () { },
- get_domain: function () { return domain;},
- get_groupby: function () { }
- }
- });
-
- // remove all propositions
- _.invoke(children, 'destroy');
- // add new empty proposition
- this.append_proposition();
- // TODO: API on searchview
- this.view.$el.removeClass('oe_searchview_open_drawer');
- }
-});
-
instance.web.search.ExtendedSearchProposition = instance.web.Widget.extend(/** @lends instance.web.search.ExtendedSearchProposition# */{
template: 'SearchView.extended_search.proposition',
events: {
@@ -2026,7 +1791,7 @@ instance.web.search.ExtendedSearchProposition = instance.web.Widget.extend(/** @
'click .searchview_extended_delete_prop': function (e) {
e.stopPropagation();
this.getParent().remove_proposition(this);
- }
+ },
},
/**
* @constructs instance.web.search.ExtendedSearchProposition
@@ -2097,18 +1862,22 @@ instance.web.search.ExtendedSearchProposition = instance.web.Widget.extend(/** @
this.value.appendTo($value_loc);
},
- get_proposition: function() {
+ get_filter: function () {
if (this.attrs.selected === null || this.attrs.selected === undefined)
return null;
- var field = this.attrs.selected;
- var op_select = this.$('.searchview_extended_prop_op')[0];
- var operator = op_select.options[op_select.selectedIndex];
+ var field = this.attrs.selected,
+ op_select = this.$('.searchview_extended_prop_op')[0],
+ operator = op_select.options[op_select.selectedIndex];
return {
- label: this.value.get_label(field, operator),
- value: this.value.get_domain(field, operator),
+ attrs: {
+ domain: [this.value.get_domain(field, operator)],
+ string: this.value.get_label(field, operator),
+ },
+ children: [],
+ tag: 'filter',
};
- }
+ },
});
instance.web.search.ExtendedSearchProposition.Field = instance.web.Widget.extend({
@@ -2333,7 +2102,6 @@ instance.web.search.AutoComplete = instance.web.Widget.extend({
this.delay = options.delay;
this.select = options.select,
this.get_search_string = options.get_search_string;
- this.width = options.width || 400;
this.current_result = null;
@@ -2343,7 +2111,6 @@ instance.web.search.AutoComplete = instance.web.Widget.extend({
},
start: function () {
var self = this;
- this.$el.width(this.width);
this.$input.on('keyup', function (ev) {
if (ev.which === $.ui.keyCode.RIGHT) {
self.searching = true;
diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js
index ce5fab9a8a2..b12e608ed4a 100644
--- a/addons/web/static/src/js/view_form.js
+++ b/addons/web/static/src/js/view_form.js
@@ -85,8 +85,6 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM
* @param {instance.web.Session} session the current openerp session
* @param {instance.web.DataSet} dataset the dataset this view will work with
* @param {String} view_id the identifier of the OpenERP view object
- * @param {Object} options
- * - resize_textareas : [true|false|max_height]
*
* @property {instance.web.Registry} registry=instance.web.form.widgets widgets registry for this form view instance
*/
@@ -257,7 +255,7 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM
this.dataset.ids.push(state.id);
}
this.dataset.select_id(state.id);
- this.do_show({ reload: warm });
+ this.do_show();
}
},
/**
@@ -425,7 +423,6 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM
$el.removeAttr("disabled");
});
});
- this.do_update_pager();
},
do_update_pager: function(hide_index) {
this.$pager.toggle(this.dataset.ids.length > 1);
@@ -3973,7 +3970,6 @@ instance.web.form.FieldOne2Many = instance.web.form.AbstractField.extend({
disable_utility_classes: true,
init: function(field_manager, node) {
this._super(field_manager, node);
- lazy_build_o2m_kanban_view();
this.is_loaded = $.Deferred();
this.initial_is_loaded = this.is_loaded;
this.form_last_update = $.Deferred();
@@ -4143,14 +4139,7 @@ instance.web.form.FieldOne2Many = instance.web.form.AbstractField.extend({
/**
* Returns the current active view if any.
*/
- if (this.viewmanager && this.viewmanager.views && this.viewmanager.active_view &&
- this.viewmanager.views[this.viewmanager.active_view] &&
- this.viewmanager.views[this.viewmanager.active_view].controller) {
- return {
- type: this.viewmanager.active_view,
- controller: this.viewmanager.views[this.viewmanager.active_view].controller
- };
- }
+ return (this.viewmanager && this.viewmanager.active_view);
},
set_value: function(value_) {
value_ = value_ || [];
@@ -4242,12 +4231,12 @@ instance.web.form.FieldOne2Many = instance.web.form.AbstractField.extend({
save_any_view: function() {
var view = this.get_active_view();
if (view) {
- if (this.viewmanager.active_view === "form") {
+ if (this.viewmanager.active_view.type === "form") {
if (view.controller.is_initialized.state() !== 'resolved') {
return $.when(false);
}
return $.when(view.controller.save());
- } else if (this.viewmanager.active_view === "list") {
+ } else if (this.viewmanager.active_view.type === "list") {
return $.when(view.controller.ensure_saved());
}
}
@@ -4258,7 +4247,7 @@ instance.web.form.FieldOne2Many = instance.web.form.AbstractField.extend({
if (!view){
return true;
}
- switch (this.viewmanager.active_view) {
+ switch (this.viewmanager.active_view.type) {
case 'form':
return _(view.controller.fields).chain()
.invoke('is_valid')
@@ -4275,10 +4264,9 @@ instance.web.form.One2ManyViewManager = instance.web.ViewManager.extend({
template: 'One2Many.viewmanager',
init: function(parent, dataset, views, flags) {
this._super(parent, dataset, views, _.extend({}, flags, {$sidebar: false}));
- this.registry = this.registry.extend({
+ this.registry = instance.web.views.extend({
list: 'instance.web.form.One2ManyListView',
form: 'instance.web.form.One2ManyFormView',
- kanban: 'instance.web.form.One2ManyKanbanView',
});
this.__ignore_blur = false;
},
@@ -4548,13 +4536,6 @@ instance.web.form.One2ManyFormView = instance.web.FormView.extend({
}
});
-var lazy_build_o2m_kanban_view = function() {
- if (! instance.web_kanban || instance.web.form.One2ManyKanbanView)
- return;
- instance.web.form.One2ManyKanbanView = instance.web_kanban.KanbanView.extend({
- });
-};
-
instance.web.form.FieldMany2ManyTags = instance.web.form.AbstractField.extend(instance.web.form.CompletionFieldMixin, instance.web.form.ReinitializeFieldMixin, {
template: "FieldMany2ManyTags",
tag_template: "FieldMany2ManyTag",
@@ -5147,8 +5128,7 @@ instance.web.form.AbstractFormPopup = instance.web.Widget.extend({
this.domain = domain || [];
this.context = context || {};
this.options = options;
- _.defaults(this.options, {
- });
+ _.defaults(this.options, {});
},
init_dataset: function() {
var self = this;
@@ -5293,22 +5273,20 @@ instance.web.form.SelectCreatePopup = instance.web.form.AbstractFormPopup.extend
this.display_popup();
},
start: function() {
- var self = this;
this.init_dataset();
if (this.options.initial_view == "search") {
- instance.web.pyeval.eval_domains_and_contexts({
+ var context = instance.web.pyeval.sync_eval_domains_and_contexts({
domains: [],
contexts: [this.context]
- }).done(function (results) {
- var search_defaults = {};
- _.each(results.context, function (value_, key) {
- var match = /^search_default_(.*)$/.exec(key);
- if (match) {
- search_defaults[match[1]] = value_;
- }
- });
- self.setup_search_view(search_defaults);
+ }).context;
+ var search_defaults = {};
+ _.each(context, function (value_, key) {
+ var match = /^search_default_(.*)$/.exec(key);
+ if (match) {
+ search_defaults[match[1]] = value_;
+ }
});
+ this.setup_search_view(search_defaults);
} else { // "form"
this.new_object();
}
@@ -5318,12 +5296,9 @@ instance.web.form.SelectCreatePopup = instance.web.form.AbstractFormPopup.extend
if (this.searchview) {
this.searchview.destroy();
}
- if (this.searchview_drawer) {
- this.searchview_drawer.destroy();
- }
+ var $buttons = this.$('.oe-search-options');
this.searchview = new instance.web.SearchView(this,
- this.dataset, false, search_defaults);
- this.searchview_drawer = new instance.web.SearchViewDrawer(this, this.searchview);
+ this.dataset, false, search_defaults, {$buttons: $buttons});
this.searchview.on('search_data', self, function(domains, contexts, groupbys) {
if (self.initial_ids) {
self.do_search(domains.concat([[["id", "in", self.initial_ids]], self.domain]),
@@ -5333,7 +5308,8 @@ instance.web.form.SelectCreatePopup = instance.web.form.AbstractFormPopup.extend
self.do_search(domains.concat([self.domain]), contexts.concat(self.context), groupbys);
}
});
- this.searchview.on("search_view_loaded", self, function() {
+ this.searchview.appendTo(this.$(".oe_popup_search")).done(function() {
+ self.searchview.toggle_visibility(true);
self.view_list = new instance.web.form.SelectCreateListView(self,
self.dataset, false,
_.extend({'deletable': false,
@@ -5368,8 +5344,7 @@ instance.web.form.SelectCreatePopup = instance.web.form.AbstractFormPopup.extend
self.new_object();
});
});
- });
- this.searchview.appendTo(this.$(".oe_popup_search"));
+ });
},
do_search: function(domains, contexts, groupbys) {
var self = this;
diff --git a/addons/web/static/src/js/view_list.js b/addons/web/static/src/js/view_list.js
index d7e867ad665..3a3e1fe52f6 100644
--- a/addons/web/static/src/js/view_list.js
+++ b/addons/web/static/src/js/view_list.js
@@ -289,7 +289,7 @@ instance.web.ListView = instance.web.View.extend( /** @lends instance.web.ListVi
// Pager
if (!this.$pager) {
- this.$pager = $(QWeb.render("ListView.pager", {'widget':self}));
+ this.$pager = $(QWeb.render("ListView.pager", {'widget':self})).hide();
if (this.options.$buttons) {
this.$pager.appendTo(this.options.$pager);
} else {
@@ -404,11 +404,8 @@ instance.web.ListView = instance.web.View.extend( /** @lends instance.web.ListVi
var total = dataset.size();
var limit = this.limit() || total;
- if (total === 0)
- this.$pager.hide();
- else
- this.$pager.css("display", "");
- this.$pager.toggleClass('oe_list_pager_single_page', (total <= limit));
+ this.$pager.find('.oe-pager-button').toggle(total > limit);
+ this.$pager.find('.oe_pager_value').toggle(total !== 0);
var spager = '-';
if (total) {
var range_start = this.page * limit + 1;
@@ -1517,12 +1514,10 @@ instance.web.ListView.Groups = instance.web.Class.extend( /** @lends instance.we
}))
.end()
.find('button[data-pager-action=previous]')
- .css('visibility',
- page === 0 ? 'hidden' : '')
+ .toggleClass('disabled', page === 0)
.end()
.find('button[data-pager-action=next]')
- .css('visibility',
- page === pages - 1 ? 'hidden' : '');
+ .toggleClass('disabled', page === pages - 1);
}
}
diff --git a/addons/web/static/src/js/view_pivot.js b/addons/web/static/src/js/view_pivot.js
new file mode 100644
index 00000000000..9aa294ead55
--- /dev/null
+++ b/addons/web/static/src/js/view_pivot.js
@@ -0,0 +1,89 @@
+/*---------------------------------------------------------
+ * Odoo Pivot Table view
+ *---------------------------------------------------------*/
+
+(function () {
+'use strict';
+
+var instance = openerp,
+ _lt = instance.web._lt,
+ _t = instance.web._t,
+ QWeb = instance.web.qweb;
+
+instance.web.views.add('pivot', 'instance.web.PivotView');
+
+instance.web.PivotView = instance.web.View.extend({
+ template: 'PivotView',
+ display_name: _lt('Pivot'),
+ view_type: 'pivot',
+
+ init: function(parent, dataset, view_id, options) {
+ this._super(parent, dataset, view_id, options);
+ this.model = new instance.web.Model(dataset.model, {group_by_no_leaf: true});
+ this.action_manager = parent.action_manager;
+
+ this.$buttons = options.$buttons;
+ this.fields = {};
+ this.measures = {};
+ this.groupable_fields = {};
+
+ this.row_groupbys = [];
+ this.col_groupbys = [];
+ this.active_measures = [];
+ },
+ start: function () {
+ var self = this,
+ load_fields = this.model.call('fields_get', [])
+ .then(this.prepare_fields.bind(this));
+
+ return $.when(this._super(), load_fields).then(function () {
+ var context = {measures: _.pairs(self.measures)};
+ self.$buttons.html(QWeb.render('PivotView.buttons', self), context);
+ });
+ },
+ view_loading: function (fvg) {
+ var self = this;
+ this.do_push_state({});
+ fvg.arch.children.forEach(function (field) {
+ var name = field.attrs.name + (field.attrs.interval || '');
+ //noinspection FallThroughInSwitchStatementJS
+ switch (field.attrs.type) {
+ case 'measure':
+ self.active_measures.push(name);
+ break;
+ case 'col':
+ self.col_groupbys.push(name);
+ break;
+ default:
+ if ('operator' in field.attrs) {
+ self.active_measures.push(name);
+ break;
+ }
+ case 'row':
+ self.row_groupbys.push(name);
+ }
+ });
+ },
+ prepare_fields: function (fields) {
+ var self = this,
+ groupable_types = ['many2one', 'char', 'boolean',
+ 'selection', 'date', 'datetime'];
+ this.fields = fields;
+ _.each(fields, function (field, name) {
+ if ((name !== 'id') && (field.store === true)) {
+ if (field.type === 'integer' || field.type === 'float') {
+ self.measures[name] = field;
+ }
+ if (_.contains(groupable_types, field.type)) {
+ self.groupable_fields[name] = field;
+ }
+ }
+ });
+ },
+ do_search: function (domain, context, group_by) {
+ },
+});
+
+
+})();
+
diff --git a/addons/web/static/src/js/views.js b/addons/web/static/src/js/views.js
index 248436357ad..b71817e867c 100644
--- a/addons/web/static/src/js/views.js
+++ b/addons/web/static/src/js/views.js
@@ -3,6 +3,7 @@
*---------------------------------------------------------*/
(function() {
+"use strict";
var instance = openerp;
openerp.web.views = {};
@@ -14,16 +15,11 @@ instance.web.ActionManager = instance.web.Widget.extend({
this._super(parent);
this.inner_action = null;
this.inner_widget = null;
+ this.webclient = parent;
this.dialog = null;
this.dialog_widget = null;
- this.breadcrumbs = [];
- this.on('history_back', this, function() {
- return this.history_back();
- });
- },
- start: function() {
- this._super.apply(this, arguments);
- this.$el.on('click', 'a.oe_breadcrumb_item', this.on_breadcrumb_clicked);
+ this.widgets = [];
+ this.on('history_back', this, this.proxy('history_back'));
},
dialog_stop: function (reason) {
if (this.dialog) {
@@ -32,210 +28,136 @@ instance.web.ActionManager = instance.web.Widget.extend({
this.dialog = null;
},
/**
- * Add a new item to the breadcrumb
+ * Add a new widget to the action manager
*
- * If the title of an item is an array, the multiple title mode is in use.
- * (eg: a widget with multiple views might need to display a title for each view)
- * In multiple title mode, the show() callback can check the index it receives
- * in order to detect which of its titles has been clicked on by the user.
- *
- * @param {Object} item breadcrumb item
- * @param {Object} item.widget widget containing the view(s) to be added to the breadcrumb added
- * @param {Function} [item.show] triggered whenever the widget should be shown back
- * @param {Function} [item.hide] triggered whenever the widget should be shown hidden
- * @param {Function} [item.destroy] triggered whenever the widget should be destroyed
- * @param {String|Array} [item.title] title(s) of the view(s) to be displayed in the breadcrumb
- * @param {Function} [item.get_title] should return the title(s) of the view(s) to be displayed in the breadcrumb
+ * widget: typically, widgets added are instance.web.ViewManager. The action manager
+ * uses this list of widget to handle the breadcrumbs.
+ * action: new action
+ * clear_breadcrumbs: boolean, if true, current widgets are destroyed
*/
- push_breadcrumb: function(item) {
- var last = this.breadcrumbs.slice(-1)[0];
- if (last) {
- last.hide();
+ push_widget: function(widget, action, clear_breadcrumbs) {
+ var self = this,
+ old_widget = this.inner_widget;
+
+ if (clear_breadcrumbs) {
+ var to_destroy = this.widgets;
+ this.widgets = [];
}
- item = _.extend({
- show: function(index) {
- this.widget.$el.show();
- },
- hide: function() {
- this.widget.$el.hide();
- },
- destroy: function() {
- this.widget.destroy();
- },
- get_title: function() {
- return this.title || this.widget.get('title');
- }
- }, item);
- item.id = _.uniqueId('breadcrumb_');
- this.breadcrumbs.push(item);
- },
- history_back: function() {
- var last = this.breadcrumbs.slice(-1)[0];
- if (!last) {
- return false;
- }
- var title = last.get_title();
- if (_.isArray(title) && title.length > 1) {
- return this.select_breadcrumb(this.breadcrumbs.length - 1, title.length - 2);
- } else if (this.breadcrumbs.length === 1) {
- // Only one single titled item in breadcrumb, most of the time you want to trigger back to home
- return false;
+ if (widget instanceof instance.web.ViewManager) {
+ this.widgets.push(widget);
} else {
- var prev = this.breadcrumbs[this.breadcrumbs.length - 2];
- title = prev.get_title();
- return this.select_breadcrumb(this.breadcrumbs.length - 2, _.isArray(title) ? title.length - 1 : undefined);
- }
- },
- on_breadcrumb_clicked: function(ev) {
- var $e = $(ev.target);
- var id = $e.data('id');
- var index;
- for (var i = this.breadcrumbs.length - 1; i >= 0; i--) {
- if (this.breadcrumbs[i].id == id) {
- index = i;
- break;
- }
- }
- var subindex = $e.parent().find('a.oe_breadcrumb_item[data-id=' + $e.data('id') + ']').index($e);
- this.select_breadcrumb(index, subindex);
- },
- select_breadcrumb: function(index, subindex) {
- var next_item = this.breadcrumbs[index + 1];
- if (next_item && next_item.on_reverse_breadcrumb) {
- next_item.on_reverse_breadcrumb(this.breadcrumbs[index].widget);
- }
- for (var i = this.breadcrumbs.length - 1; i >= 0; i--) {
- if (i > index) {
- if (this.remove_breadcrumb(i) === false) {
- return false;
- }
- }
- }
- var item = this.breadcrumbs[index];
- item.show(subindex);
- this.inner_widget = item.widget;
- this.inner_action = item.action;
- return true;
- },
- clear_breadcrumbs: function() {
- for (var i = this.breadcrumbs.length - 1; i >= 0; i--) {
- if (this.remove_breadcrumb(0) === false) {
- break;
- }
- }
- },
- remove_breadcrumb: function(index) {
- var item = this.breadcrumbs.splice(index, 1)[0];
- if (item) {
- var dups = _.filter(this.breadcrumbs, function(it) {
- return item.widget === it.widget;
+ this.widgets.push({
+ view_stack: [{
+ controller: {get: function () {return action.display_name || action.name; }},
+ }],
+ destroy: function () {},
});
- if (!dups.length) {
- if (this.getParent().has_uncommitted_changes()) {
- this.inner_widget = item.widget;
- this.inner_action = item.action;
- this.breadcrumbs.splice(index, 0, item);
- return false;
- } else {
- item.destroy();
- }
- }
}
- var last_widget = this.breadcrumbs.slice(-1)[0];
- if (last_widget) {
- this.inner_widget = last_widget.widget;
- this.inner_action = last_widget.action;
- }
- },
- add_breadcrumb_url: function (url, label) {
- // Add a pseudo breadcrumb that will redirect to an url
- this.push_breadcrumb({
- show: function() {
- instance.web.redirect(url);
- },
- hide: function() {},
- destroy: function() {},
- get_title: function() {
- return label;
+ this.inner_action = action;
+ this.inner_widget = widget;
+ return $.when(this.inner_widget.appendTo(this.$el)).done(function () {
+ (action.target !== 'inline') && (!action.flags.headless) && widget.$header && widget.$header.show();
+ old_widget && old_widget.$el.hide();
+ if (clear_breadcrumbs) {
+ self.clear_widgets(to_destroy)
}
});
},
- get_title: function() {
- var titles = [];
- for (var i = 0; i < this.breadcrumbs.length; i += 1) {
- var item = this.breadcrumbs[i];
- var tit = item.get_title();
- if (item.hide_breadcrumb) {
- continue;
- }
- if (!_.isArray(tit)) {
- tit = [tit];
- }
- for (var j = 0; j < tit.length; j += 1) {
- var label = _.escape(tit[j]);
- if (i === this.breadcrumbs.length - 1 && j === tit.length - 1) {
- titles.push(_.str.sprintf('%s', label));
- } else {
- titles.push(_.str.sprintf('%s', item.id, label));
- }
- }
+ get_breadcrumbs: function () {
+ return _.flatten(_.map(this.widgets, function (vm) {
+ return vm.view_stack.map(function (view, index) {
+ return {
+ title: view.controller.get('title') || vm.title,
+ index: index,
+ view_manager: vm,
+ };
+ });
+ }), true);
+ },
+ history_back: function() {
+ var widget = _.last(this.widgets),
+ nbr_views = widget.view_stack.length;
+ if (nbr_views > 1) {
+ this.select_widget(widget, nbr_views - 2);
+ } else if (this.widgets.length > 1) {
+ widget = this.widgets[this.widgets.length -2];
+ nbr_views = widget.view_stack.length;
+ this.select_view(widgets, nbr_views - 2)
+ }
+ },
+ select_widget: function(widget, index) {
+ var self = this;
+ if (this.webclient.has_uncommitted_changes()) {
+ return false;
+ }
+ var vm_index = this.widgets.indexOf(widget);
+ if (widget.select_view) {
+ widget.select_view(index).done(function () {
+ _.each(self.widgets.splice(vm_index + 1), function (vm) {
+ vm.destroy();
+ });
+ self.inner_widget = _.last(self.widgets);
+ self.inner_widget.display_breadcrumbs();
+ self.inner_widget.$el.show();
+ });
+ }
+ },
+ clear_widgets: function(vms) {
+ _.each(vms || this.widgets, function (vm) {
+ vm.destroy();
+ });
+ if (!vms) {
+ this.widgets = [];
+ this.inner_widget = null;
}
- return titles.join(' / ');
},
do_push_state: function(state) {
+ if (!this.webclient || !this.webclient.do_push_state || this.dialog) {
+ return;
+ }
state = state || {};
- if (this.getParent() && this.getParent().do_push_state) {
- if (this.inner_action) {
- if (this.inner_action._push_me === false) {
- // this action has been explicitly marked as not pushable
- return;
- }
- state['title'] = this.inner_action.name;
- if(this.inner_action.type == 'ir.actions.act_window') {
- state['model'] = this.inner_action.res_model;
- }
- if (this.inner_action.menu_id) {
- state['menu_id'] = this.inner_action.menu_id;
- }
- if (this.inner_action.id) {
- state['action'] = this.inner_action.id;
- } else if (this.inner_action.type == 'ir.actions.client') {
- state['action'] = this.inner_action.tag;
- var params = {};
- _.each(this.inner_action.params, function(v, k) {
- if(_.isString(v) || _.isNumber(v)) {
- params[k] = v;
- }
- });
- state = _.extend(params || {}, state);
- }
- if (this.inner_action.context) {
- var active_id = this.inner_action.context.active_id;
- if (active_id) {
- state["active_id"] = active_id;
- }
- var active_ids = this.inner_action.context.active_ids;
- if (active_ids && !(active_ids.length === 1 && active_ids[0] === active_id)) {
- // We don't push active_ids if it's a single element array containing the active_id
- // This makes the url shorter in most cases.
- state["active_ids"] = this.inner_action.context.active_ids.join(',');
- }
- }
+ if (this.inner_action) {
+ if (this.inner_action._push_me === false) {
+ // this action has been explicitly marked as not pushable
+ return;
}
- if(!this.dialog) {
- this.getParent().do_push_state(state);
+ state.title = this.inner_action.name;
+ if(this.inner_action.type == 'ir.actions.act_window') {
+ state.model = this.inner_action.res_model;
+ }
+ if (this.inner_action.menu_id) {
+ state.menu_id = this.inner_action.menu_id;
+ }
+ if (this.inner_action.id) {
+ state.action = this.inner_action.id;
+ } else if (this.inner_action.type == 'ir.actions.client') {
+ state.action = this.inner_action.tag;
+ var params = {};
+ _.each(this.inner_action.params, function(v, k) {
+ if(_.isString(v) || _.isNumber(v)) {
+ params[k] = v;
+ }
+ });
+ state = _.extend(params || {}, state);
+ }
+ if (this.inner_action.context) {
+ var active_id = this.inner_action.context.active_id;
+ if (active_id) {
+ state.active_id = active_id;
+ }
+ var active_ids = this.inner_action.context.active_ids;
+ if (active_ids && !(active_ids.length === 1 && active_ids[0] === active_id)) {
+ // We don't push active_ids if it's a single element array containing the active_id
+ // This makes the url shorter in most cases.
+ state.active_ids = this.inner_action.context.active_ids.join(',');
+ }
}
}
+ this.webclient.do_push_state(state);
},
do_load_state: function(state, warm) {
var self = this,
action_loaded;
- if (!warm && 'return_label' in state) {
- var return_url = state.return_url || document.referrer;
- if (return_url) {
- this.add_breadcrumb_url(return_url, state.return_label);
- }
- }
if (state.action) {
if (_.isString(state.action) && instance.web.client_actions.contains(state.action)) {
var action_client = {
@@ -390,7 +312,7 @@ instance.web.ActionManager = instance.web.Widget.extend({
},
null_action: function() {
this.dialog_stop();
- this.clear_breadcrumbs();
+ this.clear_widgets();
},
/**
*
@@ -403,14 +325,7 @@ instance.web.ActionManager = instance.web.Widget.extend({
* @return {*}
*/
ir_actions_common: function(executor, options) {
- if (this.inner_widget && executor.action.target !== 'new') {
- if (this.getParent().has_uncommitted_changes()) {
- return $.Deferred().reject();
- } else if (options.clear_breadcrumbs) {
- this.clear_breadcrumbs();
- }
- }
- var widget = executor.widget();
+ var widget;
if (executor.action.target === 'new') {
var pre_dialog = (this.dialog && !this.dialog.isDestroyed()) ? this.dialog : null;
if (pre_dialog){
@@ -442,41 +357,38 @@ instance.web.ActionManager = instance.web.Widget.extend({
}
};
this.dialog.on("closing", null, this.dialog.on_close);
+ widget = executor.widget();
if (widget instanceof instance.web.ViewManager) {
_.extend(widget.flags, {
$buttons: this.dialog.$buttons,
footer_to_buttons: true,
});
+ if (widget.action.view_mode === 'form') {
+ widget.flags.headless = true;
+ }
}
this.dialog_widget = widget;
this.dialog_widget.setParent(this.dialog);
var initialized = this.dialog_widget.appendTo(this.dialog.$el);
this.dialog.open();
return initialized;
- } else {
- // explicitly passing a closing action to dialog_stop() prevents
- // it from reloading the original form view - we're opening a
- // completely new action anyway
- this.dialog_stop(executor.action);
- this.inner_action = executor.action;
- this.inner_widget = widget;
- executor.post_process(widget);
- return this.inner_widget.appendTo(this.$el);
}
+ if (this.inner_widget && this.webclient.has_uncommitted_changes()) {
+ return $.Deferred().reject();
+ }
+ widget = executor.widget();
+ this.dialog_stop(executor.action);
+ return this.push_widget(widget, executor.action, options.clear_breadcrumbs);
},
ir_actions_act_window: function (action, options) {
var self = this;
return this.ir_actions_common({
- widget: function () { return new instance.web.ViewManagerAction(self, action); },
+ widget: function () {
+ return new instance.web.ViewManager(self, null, null, null, action);
+ },
action: action,
klass: 'oe_act_window',
- post_process: function (widget) {
- widget.add_breadcrumb({
- on_reverse_breadcrumb: options.on_reverse_breadcrumb,
- hide_breadcrumb: options.hide_breadcrumb,
- });
- },
}, options);
},
ir_actions_client: function (action, options) {
@@ -498,18 +410,9 @@ instance.web.ActionManager = instance.web.Widget.extend({
widget: function () { return new ClientWidget(self, action); },
action: action,
klass: 'oe_act_client',
- post_process: function(widget) {
- self.push_breadcrumb({
- widget: widget,
- title: action.name,
- on_reverse_breadcrumb: options.on_reverse_breadcrumb,
- hide_breadcrumb: options.hide_breadcrumb,
- });
- if (action.tag !== 'reload') {
- self.do_push_state({});
- }
- }
- }, options);
+ }, options).then(function () {
+ if (action.tag !== 'reload') {self.do_push_state({});}
+ });
},
ir_actions_act_window_close: function (action, options) {
if (!this.dialog) {
@@ -578,247 +481,238 @@ instance.web.ActionManager = instance.web.Widget.extend({
instance.web.ViewManager = instance.web.Widget.extend({
template: "ViewManager",
- init: function(parent, dataset, views, flags) {
+ /**
+ * @param {Object} [dataset] null object (... historical reasons)
+ * @param {Array} [views] List of [view_id, view_type]
+ * @param {Object} [flags] various boolean describing UI state
+ */
+ init: function(parent, dataset, views, flags, action) {
+ if (action) {
+ var flags = action.flags || {};
+ if (!('auto_search' in flags)) {
+ flags.auto_search = action.auto_search !== false;
+ }
+ if (action.res_model === 'board.board' && action.view_mode === 'form') {
+ action.target = 'inline';
+ // Special case for Dashboards
+ _.extend(flags, {
+ views_switcher : false,
+ display_title : false,
+ search_view : false,
+ pager : false,
+ sidebar : false,
+ action_buttons : false
+ });
+ }
+ this.action = action;
+ this.action_manager = parent;
+ var dataset = new instance.web.DataSetSearch(this, action.res_model, action.context, action.domain);
+ if (action.res_id) {
+ dataset.ids.push(action.res_id);
+ dataset.index = 0;
+ }
+ views = action.views;
+ }
+ var self = this;
this._super(parent);
- this.url_states = {};
- this.model = dataset ? dataset.model : undefined;
+
+ this.flags = flags || {};
this.dataset = dataset;
- this.searchview = null;
+ this.view_order = [];
+ this.url_states = {};
+ this.views = {};
+ this.view_stack = []; // used for breadcrumbs
this.active_view = null;
- this.views_src = _.map(views, function(x) {
- if (x instanceof Array) {
- var view_type = x[1];
- var View = instance.web.views.get_object(view_type, true);
- var view_label = View ? View.prototype.display_name : (void 'nope');
- return {
- view_id: x[0],
- view_type: view_type,
+ this.searchview = null;
+ this.active_search = null;
+ this.registry = instance.web.views;
+ this.title = this.action && this.action.name;
+
+ _.each(views, function (view) {
+ var view_type = view[1] || view.view_type,
+ View = instance.web.views.get_object(view_type, true),
+ view_label = View ? View.prototype.display_name: (void 'nope'),
+ view = {
+ controller: null,
+ options: view.options || {},
+ view_id: view[0] || view.view_id,
+ type: view_type,
label: view_label,
+ embedded_view: view.embedded_view,
+ title: self.action && self.action.name,
button_label: View ? _.str.sprintf(_t('%(view_type)s view'), {'view_type': (view_label || view_type)}) : (void 'nope'),
};
- } else {
- return x;
- }
+ self.view_order.push(view);
+ self.views[view_type] = view;
});
- this.ActionManager = parent;
- this.views = {};
- this.flags = flags || {};
- this.registry = instance.web.views;
- this.views_history = [];
- this.view_completely_inited = $.Deferred();
+ this.multiple_views = (self.view_order.length - ('form' in this.views ? 1 : 0)) > 1;
},
/**
* @returns {jQuery.Deferred} initial view loading promise
*/
start: function() {
- this._super();
var self = this;
- this.$el.find('.oe_view_manager_switch a').click(function() {
- self.switch_mode($(this).data('view-type'));
- }).tooltip();
- var views_ids = {};
- _.each(this.views_src, function(view) {
- self.views[view.view_type] = $.extend({}, view, {
- deferred : $.Deferred(),
- controller : null,
- options : _.extend({
- $buttons : self.$el.find('.oe_view_manager_buttons'),
- $sidebar : self.flags.sidebar ? self.$el.find('.oe_view_manager_sidebar') : undefined,
- $pager : self.$el.find('.oe_view_manager_pager'),
- action : self.action,
- action_views_ids : views_ids
- }, self.flags, self.flags[view.view_type] || {}, view.options || {})
- });
+ var default_view = this.flags.default_view || this.view_order[0].type,
+ default_options = this.flags[default_view] && this.flags[default_view].options;
- views_ids[view.view_type] = view.view_id;
- });
- if (this.flags.views_switcher === false) {
- this.$el.find('.oe_view_manager_switch').hide();
+ if (this.flags.headless) {
+ this.$('.oe-view-manager-header').hide();
}
- // If no default view defined, switch to the first one in sequence
- var default_view = this.flags.default_view || this.views_src[0].view_type;
-
- return this.switch_mode(default_view, null, this.flags[default_view] && this.flags[default_view].options);
+ this._super();
+ var $sidebar = this.flags.sidebar ? this.$('.oe-view-manager-sidebar') : undefined,
+ $pager = this.$('.oe-view-manager-pager');
+ this.$breadcrumbs = this.$('.oe-view-title');
+ this.$switch_buttons = this.$('.oe-view-manager-switch button');
+ this.$header = this.$('.oe-view-manager-header');
+ this.$header_col = this.$header.find('.oe-header-title');
+ this.$search_col = this.$header.find('.oe-view-manager-search-view');
+ this.$switch_buttons.click(function (event) {
+ if (!$(event.target).hasClass('active')) {
+ self.switch_mode($(this).data('view-type'));
+ }
+ });
+ var views_ids = {};
+ _.each(this.views, function (view) {
+ views_ids[view.type] = view.view_id;
+ view.options = _.extend({
+ $buttons: self.$('.oe-' + view.type + '-buttons'),
+ $sidebar : $sidebar,
+ $pager : $pager,
+ action : self.action,
+ action_views_ids : views_ids,
+ }, self.flags, self.flags[view.type], view.options);
+ if (view.type !== 'form') {
+ self.$('.oe-vm-switch-' + view.type).tooltip();
+ }
+ });
+ this.$('.oe_debug_view').click(this.on_debug_changed);
+ this.$el.addClass("oe_view_manager_" + ((this.action && this.action.target) || 'current'));
+ this.search_view_loaded = this.setup_search_view();
+ var main_view_loaded = this.switch_mode(default_view, null, default_options);
+
+ return $.when(main_view_loaded, this.search_view_loaded);
},
+
switch_mode: function(view_type, no_store, view_options) {
- var self = this;
- var view = this.views[view_type];
- var view_promise;
- var form = this.views['form'];
- if (!view || (form && form.controller && !form.controller.can_be_discarded())) {
+ var self = this,
+ view = this.views[view_type];
+
+ if (!view) {
return $.Deferred().reject();
}
- if (!no_store) {
- this.views_history.push(view_type);
- }
- this.active_view = view_type;
+ if (view_type !== 'form') {
+ this.view_stack = [];
+ }
- if (!view.controller) {
- view_promise = this.do_create_view(view_type);
- } else if (this.searchview
- && self.flags.auto_search
+ this.view_stack.push(view);
+ this.active_view = view;
+ if (!view.created) {
+ view.created = this.create_view.bind(this)(view);
+ }
+ this.active_search = $.Deferred();
+
+ if (this.searchview
+ && this.flags.auto_search
&& view.controller.searchable !== false) {
- this.searchview.ready.done(this.searchview.do_search);
+ $.when(this.search_view_loaded, view.created).done(this.searchview.do_search);
+ } else {
+ this.active_search.resolve();
}
- if (this.searchview) {
- this.searchview[(view.controller.searchable === false || this.searchview.options.hidden) ? 'hide' : 'show']();
- }
-
- this.$el.find('.oe_view_manager_switch a').parent().removeClass('active');
- this.$el
- .find('.oe_view_manager_switch a').filter('[data-view-type="' + view_type + '"]')
- .parent().addClass('active');
- this.$el.attr("data-view-type", view_type);
- return $.when(view_promise).done(function () {
- _.each(_.keys(self.views), function(view_name) {
- var controller = self.views[view_name].controller;
- if (controller) {
- var container = self.$el.find("> div > div > .oe_view_manager_body > .oe_view_manager_view_" + view_name);
- if (view_name === view_type) {
- container.show();
- controller.do_show(view_options || {});
- } else {
- container.hide();
- controller.do_hide();
- }
- }
- });
+ self.update_header();
+ return $.when(view.created, this.active_search).done(function () {
+ self.active_view = view;
+ self._display_view(view.type, view_options);
self.trigger('switch_mode', view_type, no_store, view_options);
+ if (self.session.debug) {
+ self.$('.oe_debug_view').html(QWeb.render('ViewManagerDebug', {
+ view: self.active_view.controller,
+ view_manager: self,
+ }));
+ }
});
},
- do_create_view: function(view_type) {
- // Lazy loading of views
+ update_header: function () {
+ this.$switch_buttons.removeClass('active');
+ this.$('.oe-vm-switch-' + this.active_view.type).addClass('active');
+ },
+ _display_view: function (view_type, view_options) {
var self = this;
- var view = this.views[view_type];
- var viewclass = this.registry.get_object(view_type);
- var options = _.clone(view.options);
- if (view_type === "form" && this.action && (this.action.target == 'new' || this.action.target == 'inline')) {
+ this.active_view.$container.show();
+ $.when(this.active_view.controller.do_show(view_options)).done(function () {
+ _.each(self.views, function (view) {
+ if (view.type !== view_type) {
+ view.controller && view.controller.do_hide();
+ view.$container && view.$container.hide();
+ view.options.$buttons && view.options.$buttons.hide();
+ }
+ });
+ self.active_view.options.$buttons && self.active_view.options.$buttons.show();
+ if (self.searchview) {
+ var is_hidden = self.active_view.controller.searchable === false;
+ self.searchview.toggle_visibility(!is_hidden);
+ self.$header_col.toggleClass('col-md-6', !is_hidden).toggleClass('col-md-12', is_hidden);
+ self.$search_col.toggle(!is_hidden);
+ }
+ self.display_breadcrumbs();
+ });
+ },
+ display_breadcrumbs: function () {
+ var self = this;
+ if (!this.action_manager) return;
+ var breadcrumbs = this.action_manager.get_breadcrumbs();
+ var $breadcrumbs = _.map(_.initial(breadcrumbs), function (bc) {
+ var $link = $('').text(bc.title);
+ $link.click(function () {
+ self.action_manager.select_widget(bc.view_manager, bc.index);
+ });
+ return $('
- ').append($link);
+ });
+ $breadcrumbs.push($('
- ').addClass('active').text(_.last(breadcrumbs).title));
+ this.$breadcrumbs
+ .empty()
+ .append($breadcrumbs);
+ },
+ create_view: function(view) {
+ var self = this,
+ View = this.registry.get_object(view.type),
+ options = _.clone(view.options),
+ view_loaded = $.Deferred();
+
+ if (view.type === "form" && this.action && (this.action.target === 'new' || this.action.target === 'inline')) {
options.initial_mode = 'edit';
}
- var controller = new viewclass(this, this.dataset, view.view_id, options);
+ var controller = new View(this, this.dataset, view.view_id, options),
+ $container = this.$(".oe-view-manager-view-" + view.type + ":first");
- controller.on('history_back', this, function() {
- var am = self.getParent();
- if (am && am.trigger) {
- return am.trigger('history_back');
- }
- });
-
- controller.on("change:title", this, function() {
- if (self.active_view === view_type) {
- self.set_title(controller.get('title'));
- }
- });
+ $container.hide();
+ view.controller = controller;
+ view.$container = $container;
if (view.embedded_view) {
controller.set_embedded_view(view.embedded_view);
}
- controller.on('switch_mode', self, this.switch_mode);
- controller.on('previous_view', self, this.prev_view);
-
- var container = this.$el.find("> div > div > .oe_view_manager_body > .oe_view_manager_view_" + view_type);
- var view_promise = controller.appendTo(container);
- this.views[view_type].controller = controller;
- return $.when(view_promise).done(function() {
- self.views[view_type].deferred.resolve(view_type);
- if (self.searchview
- && self.flags.auto_search
- && view.controller.searchable !== false) {
- self.searchview.ready.done(self.searchview.do_search);
- } else {
- self.view_completely_inited.resolve();
- }
- self.trigger("controller_inited",view_type,controller);
+ controller.on('switch_mode', this, this.switch_mode.bind(this));
+ controller.on('history_back', this, function () {
+ self.action_manager && self.action_manager.trigger('history_back');
});
- },
-
- /**
- * @returns {Number|Boolean} the view id of the given type, false if not found
- */
- get_view_id: function(view_type) {
- return this.views[view_type] && this.views[view_type].view_id || false;
- },
- set_title: function(title) {
- this.$el.find('.oe_view_title_text:first').text(title);
- },
- add_breadcrumb: function(options) {
- options = options || {};
- var self = this;
- var views = [this.active_view || this.views_src[0].view_type];
- this.on('switch_mode', self, function(mode) {
- var last = views.slice(-1)[0];
- if (mode !== last) {
- if (mode !== 'form') {
- views.length = 0;
- }
- views.push(mode);
- }
- instance.web.bus.trigger('view_switch_mode', self, mode);
+ controller.on("change:title", this, function() {
+ self.display_breadcrumbs();
});
- var item = _.extend({
- widget: this,
- action: this.action,
- show: function(index) {
- var view_to_select = views[index];
- var state = self.url_states[view_to_select];
- self.do_push_state(state || {});
- $.when(self.switch_mode(view_to_select)).done(function() {
- self.$el.show();
+ controller.on('view_loaded', this, function () {
+ view_loaded.resolve();
+ });
+ return $.when(controller.appendTo($container), view_loaded)
+ .done(function () {
+ self.trigger("controller_inited", view.type, controller);
});
- },
- get_title: function() {
- var id;
- var currentIndex;
- _.each(self.getParent().breadcrumbs, function(bc, i) {
- if (bc.widget === self) {
- currentIndex = i;
- }
- });
- var next = self.getParent().breadcrumbs.slice(currentIndex + 1)[0];
- var titles = _.map(views, function(v) {
- var controller = self.views[v].controller;
- if (v === 'form') {
- id = controller.datarecord.id;
- }
- return controller.get('title');
- });
- if (next && next.action && next.action.res_id && self.dataset &&
- self.active_view === 'form' && self.dataset.model === next.action.res_model && id === next.action.res_id) {
- // If the current active view is a formview and the next item in the breadcrumbs
- // is an action on same object (model / res_id), then we omit the current formview's title
- titles.pop();
- }
- return titles;
- }
- }, options);
- this.getParent().push_breadcrumb(item);
},
- /**
- * Returns to the view preceding the caller view in this manager's
- * navigation history (the navigation history is appended to via
- * switch_mode)
- *
- * @param {Object} [options]
- * @param {Boolean} [options.created=false] resource was created
- * @param {String} [options.default=null] view to switch to if no previous view
- * @returns {$.Deferred} switching end signal
- */
- prev_view: function (options) {
- options = options || {};
- var current_view = this.views_history.pop();
- var previous_view = this.views_history[this.views_history.length - 1] || options['default'];
- if (options.created && current_view === 'form' && previous_view === 'list') {
- // APR special case: "If creation mode from list (and only from a list),
- // after saving, go to page view (don't come back in list)"
- return this.switch_mode('form');
- } else if (options.created && !previous_view && this.action && this.action.flags.default_view === 'form') {
- // APR special case: "If creation from dashboard, we have no previous view
- return this.switch_mode('form');
- }
- return this.switch_mode(previous_view, true);
+ select_view: function (index) {
+ var view_type = this.view_stack[index].type;
+ this.view_stack.splice(index);
+ return this.switch_mode(view_type);
},
/**
* Sets up the current viewmanager's search view.
@@ -826,25 +720,38 @@ instance.web.ViewManager = instance.web.Widget.extend({
* @param {Number|false} view_id the view to use or false for a default one
* @returns {jQuery.Deferred} search view startup deferred
*/
- setup_search_view: function(view_id, search_defaults) {
- var self = this;
+ setup_search_view: function() {
if (this.searchview) {
this.searchview.destroy();
}
+ var view_id = (this.action && this.action.search_view_id && this.action.search_view_id[0]) || false;
+
+ var search_defaults = {};
+
+ var context = this.action ? this.action.context : [];
+ _.each(context, function (value, key) {
+ var match = /^search_default_(.*)$/.exec(key);
+ if (match) {
+ search_defaults[match[1]] = value;
+ }
+ });
+
+
var options = {
hidden: this.flags.search_view === false,
disable_custom_filters: this.flags.search_disable_custom_filters,
+ $buttons: this.$('.oe-search-options'),
};
- this.searchview = new instance.web.SearchView(this, this.dataset, view_id, search_defaults, options);
+ var SearchView = instance.web.SearchView;
+ this.searchview = new SearchView(this, this.dataset, view_id, search_defaults, options);
- this.searchview.on('search_data', self, this.do_searchview_search);
- return this.searchview.appendTo(this.$(".oe_view_manager_view_search"),
- this.$(".oe_searchview_drawer_container"));
+ this.searchview.on('search_data', this, this.search.bind(this));
+ return this.searchview.appendTo(this.$(".oe-view-manager-search-view:first"));
},
- do_searchview_search: function(domains, contexts, groupbys) {
+ search: function(domains, contexts, groupbys) {
var self = this,
- controller = this.views[this.active_view].controller,
+ controller = this.active_view.controller,
action_context = this.action.context || {};
instance.web.pyeval.eval_domains_and_contexts({
domains: [this.action.domain || []].concat(domains || []),
@@ -865,114 +772,33 @@ instance.web.ViewManager = instance.web.Widget.extend({
groupby = [groupby];
}
$.when(controller.do_search(results.domain, results.context, groupby || [])).then(function() {
- self.view_completely_inited.resolve();
+ self.active_search.resolve();
});
});
},
- /**
- * Called when one of the view want to execute an action
- */
- on_action: function(action) {
- },
- on_create: function() {
- },
- on_remove: function() {
- },
- on_edit: function() {
- },
- /**
- * Called by children view after executing an action
- */
- on_action_executed: function () {
- },
-});
-
-instance.web.ViewManagerAction = instance.web.ViewManager.extend({
- template:"ViewManagerAction",
- /**
- * @constructs instance.web.ViewManagerAction
- * @extends instance.web.ViewManager
- *
- * @param {instance.web.ActionManager} parent parent object/widget
- * @param {Object} action descriptor for the action this viewmanager needs to manage its views.
- */
- init: function(parent, action) {
- // dataset initialization will take the session from ``this``, so if we
- // do not have it yet (and we don't, because we've not called our own
- // ``_super()``) rpc requests will blow up.
- var flags = action.flags || {};
- if (!('auto_search' in flags)) {
- flags.auto_search = action.auto_search !== false;
+ do_push_state: function(state) {
+ if (this.action_manager) {
+ state.view_type = this.active_view.type;
+ this.action_manager.do_push_state(state);
}
- if (action.res_model == 'board.board' && action.view_mode === 'form') {
- // Special case for Dashboards
- _.extend(flags, {
- views_switcher : false,
- display_title : false,
- search_view : false,
- pager : false,
- sidebar : false,
- action_buttons : false
- });
- }
- this._super(parent, null, action.views, flags);
- this.session = parent.session;
- this.action = action;
- var context = action.context;
- if (action.target === 'current'){
- var active_context = {
- active_model: action.res_model,
- };
- context = new instance.web.CompoundContext(context, active_context).eval();
- delete context['active_id'];
- delete context['active_ids'];
- if (action.res_id){
- context['active_id'] = action.res_id;
- context['active_ids'] = [action.res_id];
- }
- }
- var dataset = new instance.web.DataSetSearch(this, action.res_model, context, action.domain);
- if (action.res_id) {
- dataset.ids.push(action.res_id);
- dataset.index = 0;
- }
- this.dataset = dataset;
- },
- /**
- * Initializes the ViewManagerAction: sets up the searchview (if the
- * searchview is enabled in the manager's action flags), calls into the
- * parent to initialize the primary view and (if the VMA has a searchview)
- * launches an initial search after both views are done rendering.
- */
- start: function() {
+ },
+ do_load_state: function(state, warm) {
var self = this,
- searchview_loaded,
- search_defaults = {};
- _.each(this.action.context, function (value, key) {
- var match = /^search_default_(.*)$/.exec(key);
- if (match) {
- search_defaults[match[1]] = value;
- }
+ def = this.active_view.created;
+ if (state.view_type && state.view_type !== this.active_view.type) {
+ def = def.then(function() {
+ return self.switch_mode(state.view_type, true);
+ });
+ }
+ def.done(function() {
+ self.active_view.controller.do_load_state(state, warm);
});
- // init search view
- var searchview_id = this.action['search_view_id'] && this.action['search_view_id'][0];
-
- searchview_loaded = this.setup_search_view(searchview_id || false, search_defaults);
-
- var main_view_loaded = this._super();
-
- var manager_ready = $.when(searchview_loaded, main_view_loaded, this.view_completely_inited);
-
- this.$el.find('.oe_debug_view').change(this.on_debug_changed);
- this.$el.addClass("oe_view_manager_" + (this.action.target || 'current'));
- return manager_ready;
},
on_debug_changed: function (evt) {
var self = this,
- $sel = $(evt.currentTarget),
- $option = $sel.find('option:selected'),
- val = $sel.val(),
- current_view = this.views[this.active_view].controller;
+ params = $(evt.target).data(),
+ val = params.action,
+ current_view = this.active_view.controller;
switch (val) {
case 'fvg':
var dialog = new instance.web.Dialog(this, { title: _t("Fields View Get") }).open();
@@ -1041,6 +867,7 @@ instance.web.ViewManagerAction = instance.web.ViewManager.extend({
case 'edit_workflow':
return this.do_action({
res_model : 'workflow',
+ name: _t('Edit Workflow'),
domain : [['osv', '=', this.dataset.model]],
views: [[false, 'list'], [false, 'form'], [false, 'diagram']],
type : 'ir.actions.act_window',
@@ -1048,11 +875,12 @@ instance.web.ViewManagerAction = instance.web.ViewManager.extend({
view_mode : 'list'
});
case 'edit':
- this.do_edit_resource($option.data('model'), $option.data('id'), { name : $option.text() });
+ this.do_edit_resource(params.model, params.id, evt.target.text);
break;
case 'manage_filters':
this.do_action({
res_model: 'ir.filters',
+ name: _t('Manage Filters'),
views: [[false, 'list'], [false, 'form']],
type: 'ir.actions.act_window',
context: {
@@ -1080,17 +908,20 @@ instance.web.ViewManagerAction = instance.web.ViewManager.extend({
});
}
break;
+ case 'leave_debug':
+ window.location.search="?";
+ break;
default:
if (val) {
- console.log("No debug handler for ", val);
+ console.warn("No debug handler for ", val);
}
}
- evt.currentTarget.selectedIndex = 0;
},
- do_edit_resource: function(model, id, action) {
- action = _.extend({
+ do_edit_resource: function(model, id, name) {
+ this.do_action({
res_model : model,
res_id : id,
+ name: name,
type : 'ir.actions.act_window',
view_type : 'form',
view_mode : 'form',
@@ -1098,64 +929,8 @@ instance.web.ViewManagerAction = instance.web.ViewManager.extend({
target : 'new',
flags : {
action_buttons : true,
- form : {
- resize_textareas : true
- }
+ headless: true,
}
- }, action || {});
- this.do_action(action);
- },
- switch_mode: function (view_type, no_store, options) {
- var self = this;
-
- return this.alive($.when(this._super.apply(this, arguments))).done(function () {
- var controller = self.views[self.active_view].controller;
- self.$el.find('.oe_debug_view').html(QWeb.render('ViewManagerDebug', {
- view: controller,
- view_manager: self
- }));
- self.set_title();
- });
- },
- do_create_view: function(view_type) {
- var self = this;
- return this._super.apply(this, arguments).then(function() {
- var view = self.views[view_type].controller;
- view.set({ 'title': self.action.name });
- });
- },
- get_action_manager: function() {
- var cur = this;
- while ((cur = cur.getParent())) {
- if (cur instanceof instance.web.ActionManager) {
- return cur;
- }
- }
- return undefined;
- },
- set_title: function(title) {
- this.$el.find('.oe_breadcrumb_title:first').html(this.get_action_manager().get_title());
- },
- do_push_state: function(state) {
- if (this.getParent() && this.getParent().do_push_state) {
- state["view_type"] = this.active_view;
- this.url_states[this.active_view] = state;
- this.getParent().do_push_state(state);
- }
- },
- do_load_state: function(state, warm) {
- var self = this,
- defs = [];
- if (state.view_type && state.view_type !== this.active_view) {
- defs.push(
- this.views[this.active_view].deferred.then(function() {
- return self.switch_mode(state.view_type, true);
- })
- );
- }
-
- $.when(this.views[this.active_view] ? this.views[this.active_view].deferred : $.when(), defs).done(function() {
- self.views[self.active_view].controller.do_load_state(state, warm);
});
},
});
@@ -1184,7 +959,7 @@ instance.web.Sidebar = instance.web.Widget.extend({
var self = this;
this._super(this);
this.redraw();
- this.$el.on('click','.oe_dropdown_menu li a', function(event) {
+ this.$el.on('click','.dropdown-menu li a', function(event) {
var section = $(this).data('section');
var index = $(this).data('index');
var item = self.items[section][index];
@@ -1331,7 +1106,7 @@ instance.web.Sidebar = instance.web.Widget.extend({
a.url = prefix + '&id=' + a.id + '&t=' + (new Date().getTime());
}
});
- self.items['files'] = attachments;
+ self.items.files = attachments;
self.redraw();
this.$('.oe_sidebar_add_attachment .oe_form_binary_file').change(this.on_attachment_changed);
this.$el.find('.oe_sidebar_delete_item').click(this.on_attachment_delete);
@@ -1342,7 +1117,7 @@ instance.web.Sidebar = instance.web.Widget.extend({
this.$el.find('form.oe_form_binary_form').submit();
$e.parent().find('input[type=file]').prop('disabled', true);
$e.parent().find('button').prop('disabled', true).find('img, span').toggle();
- this.$('.oe_sidebar_add_attachment span').text(_t('Uploading...'));
+ this.$('.oe_sidebar_add_attachment a').text(_t('Uploading...'));
instance.web.blockUI();
}
},
@@ -1519,9 +1294,7 @@ instance.web.View = instance.web.Widget.extend({
this.$el.hide();
},
is_active: function () {
- var manager = this.getParent();
- return !manager || !manager.active_view
- || manager.views[manager.active_view].controller === this;
+ return this.ViewManager.active_view.controller === this;
}, /**
* Wraps fn to only call it if the current view is the active one. If the
* current view is not active, doesn't call fn.
@@ -1544,7 +1317,8 @@ instance.web.View = instance.web.Widget.extend({
this.getParent().do_push_state(state);
}
},
- do_load_state: function(state, warm) {
+ do_load_state: function (state, warm) {
+
},
/**
* Switches to a specific view type
diff --git a/addons/web/static/src/xml/base.xml b/addons/web/static/src/xml/base.xml
index f99a96b649b..f7441cc3711 100644
--- a/addons/web/static/src/xml/base.xml
+++ b/addons/web/static/src/xml/base.xml
@@ -25,13 +25,6 @@