summaryrefslogtreecommitdiff
path: root/addons/web/static/src
diff options
context:
space:
mode:
authorXavier Morel <xmo@openerp.com>2012-05-22 15:22:46 +0200
committerXavier Morel <xmo@openerp.com>2012-05-22 15:22:46 +0200
commit74c3a2b2020dd3caa65346f0c702be6e58477ae4 (patch)
tree4987280cda5a68d8ed1a1666005f259b65961c68 /addons/web/static/src
parent174362aac03f2d19b655568c96fdc8aadb20826a (diff)
parentca6283de8efc7d790fe1d6d843ec264777b3ae47 (diff)
[MERGE] from trunk
bzr revid: xmo@openerp.com-20120522132246-49w7jbkaytd7q3k2
Diffstat (limited to 'addons/web/static/src')
-rw-r--r--addons/web/static/src/css/base.css105
-rw-r--r--addons/web/static/src/css/base.sass74
-rw-r--r--addons/web/static/src/js/chrome.js76
-rw-r--r--addons/web/static/src/js/corelib.js6
-rw-r--r--addons/web/static/src/js/coresetup.js27
-rw-r--r--addons/web/static/src/js/data.js38
-rw-r--r--addons/web/static/src/js/view_form.js428
-rw-r--r--addons/web/static/src/js/view_list.js1
-rw-r--r--addons/web/static/src/js/views.js15
-rw-r--r--addons/web/static/src/xml/base.xml29
10 files changed, 421 insertions, 378 deletions
diff --git a/addons/web/static/src/css/base.css b/addons/web/static/src/css/base.css
index c101e1beb0b..f2fcc9abf33 100644
--- a/addons/web/static/src/css/base.css
+++ b/addons/web/static/src/css/base.css
@@ -56,7 +56,6 @@
}
.openerp th, .openerp td {
padding: 0;
- line-height: 18px;
text-align: left;
}
.openerp th {
@@ -117,6 +116,9 @@
float: right;
margin-left: 8px;
}
+.openerp .oe_text_right {
+ text-align: right;
+}
.openerp .oe_clear {
clear: both;
}
@@ -515,6 +517,7 @@
border-right: 1px solid #afafb6;
text-shadow: 0 1px 1px white;
padding-bottom: 16px;
+ line-height: 18px;
}
.openerp a.oe_logo {
width: 220px;
@@ -1002,9 +1005,6 @@
.openerp .oe_view_manager_header .oe_view_manager_buttons {
white-space: nowrap;
}
-.openerp .oe_view_manager_body h4 {
- margin: 8px 0;
-}
.openerp .oe_view_manager_pager {
line-height: 26px;
}
@@ -1420,11 +1420,12 @@
}
.openerp .oe_view_nocontent > img {
float: left;
- margin-right: 1.5em;
+ margin: 1.5em;
}
.openerp .oe_view_nocontent > div {
overflow: hidden;
- padding: 6px;
+ padding: 35px 0px 0px 0px;
+ max-width: 700px;
font-size: 125%;
}
.openerp .oe_view_topbar {
@@ -1477,7 +1478,7 @@
}
.openerp .oe_form_topbar button {
font-size: 12px;
- height: 24px;
+ height: 24px !important;
line-height: 24px;
vertical-align: top;
padding: 0 10px;
@@ -1556,7 +1557,7 @@
padding: 8px 0;
border-bottom: 1px solid #dddddd;
}
-.openerp .oe_application .oe_form_sheet_width {
+.openerp .oe_application .oe_form_sheet_width, .openerp .oe_application .oe_form_bottom {
min-width: 650px;
max-width: 980px;
margin: 0 auto;
@@ -1570,44 +1571,30 @@
-webkit-box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
-box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
}
-.openerp .oe_form_autolayout .oe_button {
- height: 20px;
-}
-.openerp .oe_form_autolayout .oe_form_group_cell {
+.openerp .oe_form .oe_form_group_cell {
line-height: 18px;
padding: 2px;
height: 20px;
}
-.openerp .oe_form_autolayout .oe_form_group_cell > .oe_form_field_many2one,
-.openerp .oe_form_autolayout .oe_form_group_cell > .oe_form_field_many2one input,
-.openerp .oe_form_autolayout .oe_form_group_cell > .oe_form_field_char input,
-.openerp .oe_form_autolayout .oe_form_group_cell > .oe_form_field_text textarea,
-.openerp .oe_form_autolayout .oe_form_group_cell > .oe_form_field_email,
-.openerp .oe_form_autolayout .oe_form_group_cell > .oe_form_field_email input,
-.openerp .oe_form_autolayout .oe_form_group_cell > .oe_form_field_url,
-.openerp .oe_form_autolayout .oe_form_group_cell > .oe_form_field_url input,
-.openerp .oe_form_autolayout .oe_form_group_cell > .oe_form_field_float input,
-.openerp .oe_form_autolayout .oe_form_group_cell > .oe_form_field_selection select,
-.openerp .oe_form_autolayout .oe_form_group_cell > div > .oe_datepicker_root,
-.openerp .oe_form_autolayout .oe_form_group_cell > div > .oe_datepicker_root > input.oe_datepicker_master {
+.openerp .oe_form .oe_form_group_cell > .oe_form_field_many2one,
+.openerp .oe_form .oe_form_group_cell > .oe_form_field_many2one input,
+.openerp .oe_form .oe_form_group_cell > .oe_form_field_char input,
+.openerp .oe_form .oe_form_group_cell > .oe_form_field_text textarea,
+.openerp .oe_form .oe_form_group_cell > .oe_form_field_email,
+.openerp .oe_form .oe_form_group_cell > .oe_form_field_email input,
+.openerp .oe_form .oe_form_group_cell > .oe_form_field_url,
+.openerp .oe_form .oe_form_group_cell > .oe_form_field_url input,
+.openerp .oe_form .oe_form_group_cell > .oe_form_field_float input,
+.openerp .oe_form .oe_form_group_cell > .oe_form_field_selection select,
+.openerp .oe_form .oe_form_group_cell > div > .oe_datepicker_root,
+.openerp .oe_form .oe_form_group_cell > div > .oe_datepicker_root > input.oe_datepicker_master {
width: 100%;
}
-.openerp .oe_form_autolayout .oe_form_button.oe_button {
- color: #4c4c4c;
-}
-.openerp .oe_form_autolayout .oe_form_button.oe_button span {
- position: relative;
- vertical-align: top;
-}
-.openerp .oe_form_autolayout .oe_form_group_cell > .oe_form_button.oe_button {
- white-space: nowrap;
- min-width: 100%;
- width: 100%;
-}
-.openerp .oe_form_autolayout .oe_form_group_cell.oe_form_group_nested {
+.openerp .oe_form .oe_form_group_cell.oe_form_group_nested {
padding: 0;
}
.openerp .oe_form .oe_form_label_help[for], .openerp .oe_form .oe_form_label[for] {
+ font-weight: bold;
white-space: nowrap;
padding-right: 8px;
}
@@ -1666,7 +1653,6 @@
-moz-border-radius: 0px;
-webkit-border-radius: 0px;
border-radius: 0px;
- color: #666666;
}
.openerp .oe_form .oe_form_field_many2one input,
.openerp .oe_form .oe_form_field_binary input,
@@ -1735,6 +1721,7 @@
border: 1px solid #dd0000 !important;
}
.openerp .oe_form .oe_button.oe_field_button {
+ display: block;
-webkit-border-top-left-radius: 0px;
-webkit-border-bottom-left-radius: 0px;
-moz-border-radius-topleft: 0px;
@@ -1757,10 +1744,24 @@
right: 5px;
top: 3px;
}
+.openerp .oe_form .oe_form_button.oe_button {
+ height: 22px;
+ color: #4c4c4c;
+}
+.openerp .oe_form .oe_form_button.oe_button span {
+ position: relative;
+ vertical-align: top;
+}
.openerp .oe_form .oe_form_button > img {
vertical-align: -3px;
padding: 0 2px;
}
+.openerp .oe_form .oe_form_group_cell > .oe_form_button.oe_button {
+ display: block;
+ white-space: nowrap;
+ min-width: 100%;
+ width: 100%;
+}
.openerp .oe_form .oe-binary-file-set {
overflow: hidden;
position: relative;
@@ -1780,6 +1781,9 @@
margin: 0;
padding: 0;
}
+.openerp .oe_horizontal_border {
+ border-bottom: 1px solid black;
+}
.openerp .oe_horizontal_separator {
font-weight: bold;
font-size: 16px;
@@ -1904,7 +1908,30 @@
}
.openerp .oe_form .oe_form_group_odd_border > tbody > tr.oe_form_group_row > td.oe_form_group_cell,
.openerp .oe_form .oe_form_group_label_border > tbody > tr.oe_form_group_row > td.oe_form_group_cell {
- padding: 2px 2px 2px 8px !important;
+ padding-left: 8px;
+}
+.openerp .oe_form .oe_form_subtotal_footer {
+ float: right;
+}
+.openerp .oe_form .oe_form_subtotal_footer > div {
+ text-align: right;
+ padding: 3px;
+}
+.openerp .oe_form .oe_form_subtotal_footer label {
+ font-weight: normal !important;
+}
+.openerp .oe_form .oe_form_subtotal_footer span {
+ display: inline-block;
+ min-width: 80px;
+ text-align: right;
+}
+.openerp .oe_form .oe_form_subtotal_footer .oe_form_subtotal_footer_separator {
+ border-top: 1px solid #cacaca;
+ font-size: 120%;
+ font-weight: bold;
+}
+.openerp .oe_form .oe_form_subtotal_footer .oe_form_subtotal_footer_separator label {
+ font-weight: bold !important;
}
.openerp .oe-listview-content {
width: 100%;
diff --git a/addons/web/static/src/css/base.sass b/addons/web/static/src/css/base.sass
index ca47ebf1edb..3dcde9c9f70 100644
--- a/addons/web/static/src/css/base.sass
+++ b/addons/web/static/src/css/base.sass
@@ -118,7 +118,6 @@ $colour4: #8a89ba
border-right: none
th, td
padding: 0
- line-height: 18px
text-align: left
th
font-weight: bold
@@ -156,6 +155,8 @@ $colour4: #8a89ba
.oe_right
float: right
margin-left: 8px
+ .oe_text_right
+ text-align: right
.oe_clear
clear: both
.oe_wait
@@ -434,6 +435,7 @@ $colour4: #8a89ba
border-right: 1px solid #afafb6
text-shadow: 0 1px 1px white
padding-bottom: 16px
+ line-height: 18px
a.oe_logo
width: 220px
display: block
@@ -795,11 +797,6 @@ $colour4: #8a89ba
.oe_view_manager_buttons
white-space: nowrap
// }}}
- // ViewManager.body {{{
- .oe_view_manager_body
- h4
- margin: 8px 0
- // }}}
// ViewManager.pager {{{
.oe_view_manager_pager
line-height: 26px
@@ -1161,11 +1158,12 @@ $colour4: #8a89ba
.oe_view_nocontent
> img
float: left
- margin-right: 1.5em
+ margin: 1.5em
> div
// don't encroach on my arrow
overflow: hidden
- padding: 6px
+ padding: 35px 0px 0px 0px
+ max-width: 700px
font-size: 125%
.oe_view_topbar
border-bottom: 1px solid #cacaca
@@ -1203,7 +1201,7 @@ $colour4: #8a89ba
line-height: 30px
button
font-size: 12px
- height: 24px
+ height: 24px !important
line-height: 24px
vertical-align: top
padding: 0 10px
@@ -1269,7 +1267,7 @@ $colour4: #8a89ba
background: url(/web/static/src/img/form_sheetbg.png)
padding: 8px 0
border-bottom: 1px solid #ddd
- .oe_form_sheet_width
+ .oe_form_sheet_width, .oe_form_bottom
min-width: 650px
max-width: 980px
margin: 0 auto
@@ -1280,10 +1278,8 @@ $colour4: #8a89ba
border: 1px solid #afafb6
@include box-shadow(0 0 10px rgba(0,0,0,0.3))
// }}}
- // FormView.autolayout {{{
- .oe_form_autolayout
- .oe_button
- height: 20px
+ // FormView.layout {{{
+ .oe_form
.oe_form_group_cell
line-height: 18px
padding: 2px
@@ -1301,21 +1297,13 @@ $colour4: #8a89ba
.oe_form_group_cell > div > .oe_datepicker_root,
.oe_form_group_cell > div > .oe_datepicker_root > input.oe_datepicker_master
width: 100%
- .oe_form_button.oe_button
- color: #4c4c4c
- span
- position: relative
- vertical-align: top
- .oe_form_group_cell > .oe_form_button.oe_button
- white-space: nowrap
- min-width: 100%
- width: 100%
.oe_form_group_cell.oe_form_group_nested
padding: 0
// }}}
// FormView.label {{{
.oe_form
.oe_form_label_help[for], .oe_form_label[for]
+ font-weight: bold
white-space: nowrap
padding-right: 8px
span
@@ -1367,7 +1355,6 @@ $colour4: #8a89ba
padding-left: 8px
@include box-shadow(none)
@include radius(0px)
- color: #666
.oe_form_field_many2one input,
.oe_form_field_binary input,
.oe_form_field_binary input,
@@ -1424,10 +1411,8 @@ $colour4: #8a89ba
input, select, textarea
background-color: #F66 !important
border: 1px solid #D00 !important
- // }}}
- // FormView.buttons {{{
- .oe_form
.oe_button.oe_field_button
+ display: block
-webkit-border-top-left-radius: 0px
-webkit-border-bottom-left-radius: 0px
-moz-border-radius-topleft: 0px
@@ -1447,9 +1432,23 @@ $colour4: #8a89ba
filter: alpha(opacity=50)
right: 5px
top: 3px
+ // }}}
+ // FormView.buttons {{{
+ .oe_form
+ .oe_form_button.oe_button
+ height: 22px
+ color: #4c4c4c
+ span
+ position: relative
+ vertical-align: top
.oe_form_button > img
vertical-align: -3px
padding: 0 2px
+ .oe_form_group_cell > .oe_form_button.oe_button
+ display: block
+ white-space: nowrap
+ min-width: 100%
+ width: 100%
// }}}
// FormView.binaryfile {{{
/* http://www.quirksmode.org/dom/inputfile.html
@@ -1476,6 +1475,8 @@ $colour4: #8a89ba
padding: 0
// }}}
// FormView.separator {{{
+ .oe_horizontal_border
+ border-bottom: 1px solid black
.oe_horizontal_separator
font-weight: bold
font-size: 16px
@@ -1587,7 +1588,24 @@ $colour4: #8a89ba
min-width: 120px
.oe_form_group_odd_border > tbody > tr.oe_form_group_row > td.oe_form_group_cell,
.oe_form_group_label_border > tbody > tr.oe_form_group_row > td.oe_form_group_cell
- padding: 2px 2px 2px 8px !important
+ padding-left: 8px
+ .oe_form_subtotal_footer
+ float: right
+ > div
+ text-align: right
+ padding: 3px
+ label
+ font-weight: normal !important
+ span
+ display: inline-block
+ min-width: 80px
+ text-align: right
+ .oe_form_subtotal_footer_separator
+ border-top: 1px solid #cacaca
+ font-size: 120%
+ font-weight: bold
+ label
+ font-weight: bold !important
// }}}
// ListView {{{
.oe-listview-content
diff --git a/addons/web/static/src/js/chrome.js b/addons/web/static/src/js/chrome.js
index b740c61c9df..47983ed322d 100644
--- a/addons/web/static/src/js/chrome.js
+++ b/addons/web/static/src/js/chrome.js
@@ -43,11 +43,15 @@ instance.web.Notification = instance.web.Widget.extend({
}
});
+/**
+ * The very minimal function everything should call to create a dialog
+ * in OpenERP Web Client.
+ */
instance.web.dialog = function(element) {
var result = element.dialog.apply(element, _.rest(_.toArray(arguments)));
result.dialog("widget").addClass("openerp");
return result;
-}
+};
instance.web.Dialog = instance.web.Widget.extend({
dialog_title: "",
@@ -162,7 +166,7 @@ instance.web.CrashManager = instance.web.CallbackEnabled.extend({
}
},
on_managed_error: function(error) {
- instance.web.dialog($('<div>' + QWeb.render('CrashManager.warning', {error: error}) + '</div>'), {
+ instance.web.dialog($('<div>' + QWeb.render('CrashManager.warning', {error: error}) + '</div>'), {
title: "OpenERP " + _.str.capitalize(error.type),
buttons: [
{text: _t("Ok"), click: function() { $(this).dialog("close"); }}
@@ -181,7 +185,7 @@ instance.web.CrashManager = instance.web.CallbackEnabled.extend({
// Call the send method from server to send mail with details
new instance.web.DataSet(self, 'publisher_warranty.contract').call_and_eval('send', [error.data,explanation,remark,issuename]).then(function(result){
if (result === false) {
- alert('There was a communication error.')
+ alert('There was a communication error.');
} else {
$this.dialog('close');
}
@@ -269,12 +273,12 @@ instance.web.DatabaseManager = instance.web.Widget.extend({
start: function() {
var self = this;
var fetch_db = this.rpc("/web/database/get_list", {}).pipe(
- function(result) {
- self.db_list = result.db_list;
+ function(result) {
+ self.db_list = result.db_list;
},
- function (_, ev) {
+ function (_, ev) {
ev.preventDefault();
- self.db_list = null;
+ self.db_list = null;
});
var fetch_langs = this.rpc("/web/session/get_lang_list", {}).then(function(result) {
self.lang_list = result.lang_list;
@@ -284,11 +288,15 @@ instance.web.DatabaseManager = instance.web.Widget.extend({
do_render: function() {
var self = this;
self.$element.html(QWeb.render("DatabaseManager", { widget : self }));
- self.$element.find(".oe_database_manager_menu").tabs();
+ self.$element.find(".oe_database_manager_menu").tabs({
+ show: function(event, ui) {
+ $('*[autofocus]:first', ui.panel).focus();
+ }
+ });
self.$element.find("form[name=create_db_form]").validate({ submitHandler: self.do_create });
- self.$element.find("form[name=drop_db_form]").validate({ submitHandler: self.do_drop });
- self.$element.find("form[name=backup_db_form]").validate({ submitHandler: self.do_backup });
- self.$element.find("form[name=restore_db_form]").validate({ submitHandler: self.do_restore });
+ self.$element.find("form[name=drop_db_form]").validate({ submitHandler: self.do_drop });
+ self.$element.find("form[name=backup_db_form]").validate({ submitHandler: self.do_backup });
+ self.$element.find("form[name=restore_db_form]").validate({ submitHandler: self.do_restore });
self.$element.find("form[name=change_pwd_form]").validate({
messages: {
old_pwd: "Please enter your previous password",
@@ -300,7 +308,7 @@ instance.web.DatabaseManager = instance.web.Widget.extend({
},
submitHandler: self.do_change_password
});
- self.$element.find("#back_to_login").click(self.do_exit);
+ self.$element.find("#back_to_login").click(self.do_exit);
},
destroy: function () {
this.$element.find('#db-create, #db-drop, #db-backup, #db-restore, #db-change-password, #back-to-login').unbind('click').end().empty();
@@ -409,12 +417,12 @@ instance.web.DatabaseManager = instance.web.Widget.extend({
self.display_error({
title: 'Access Denied',
error: 'Incorrect super-administrator password'
- })
+ });
} else {
self.display_error({
title: 'Restore Database',
error: 'Could not restore the database'
- })
+ });
}
},
complete: function() {
@@ -451,7 +459,7 @@ instance.web.Login = instance.web.Widget.extend({
if (this.has_local_storage && this.remember_credentials) {
this.selected_db = localStorage.getItem('last_db_login_success');
this.selected_login = localStorage.getItem('last_login_login_success');
- if (jQuery.deparam(jQuery.param.querystring()).debug != undefined) {
+ if (jQuery.deparam(jQuery.param.querystring()).debug !== undefined) {
this.selected_password = localStorage.getItem('last_password_login_success');
}
}
@@ -471,7 +479,7 @@ instance.web.Login = instance.web.Widget.extend({
self.$element.find('.oe_login_bottom').show();
self.$element.find('.oe_login_pane').show();
self.load_db_list();
- })
+ });
});
self.load_db_list();
},
@@ -486,7 +494,7 @@ instance.web.Login = instance.web.Widget.extend({
});
},
set_db_list: function (list) {
- this.$element.find("[name=db]").replaceWith(instance.web.qweb.render('Login.dblist', { db_list: list, selected_db: this.selected_db}))
+ this.$element.find("[name=db]").replaceWith(instance.web.qweb.render('Login.dblist', { db_list: list, selected_db: this.selected_db}));
},
on_submit: function(ev) {
if(ev) {
@@ -525,7 +533,7 @@ instance.web.Login = instance.web.Widget.extend({
if(self.remember_credentials) {
localStorage.setItem('last_db_login_success', db);
localStorage.setItem('last_login_login_success', login);
- if (jQuery.deparam(jQuery.param.querystring()).debug != undefined) {
+ if (jQuery.deparam(jQuery.param.querystring()).debug !== undefined) {
localStorage.setItem('last_password_login_success', password);
}
} else {
@@ -641,8 +649,9 @@ instance.web.Menu = instance.web.Widget.extend({
* @param {Number} id the action_id to match
*/
open_action: function (id) {
- var menu_id, $menu = this.$element.add(this.$secondary_menus).find('a[data-action-id=' + id + ']');
- if (menu_id = $menu.data('menu')) {
+ var $menu = this.$element.add(this.$secondary_menus).find('a[data-action-id=' + id + ']');
+ var menu_id = $menu.data('menu');
+ if (menu_id) {
this.open_menu(menu_id);
}
},
@@ -669,7 +678,7 @@ instance.web.Menu = instance.web.Widget.extend({
action_id = $items.data('action-id');
id = $items.data('menu');
}
- }
+ }
}
this.open_menu(id);
this.current_menu = id;
@@ -709,7 +718,9 @@ instance.web.UserMenu = instance.web.Widget.extend({
});
this.$element.on('click', '.oe_dropdown_options li a[data-menu]', function() {
var f = self['on_menu_' + $(this).data('menu')];
- f && f($(this));
+ if (f) {
+ f($(this));
+ }
self.$element.find('.oe_dropdown_options').hide();
return false;
});
@@ -837,7 +848,7 @@ instance.web.WebClient = instance.web.Widget.extend({
start: function() {
var self = this;
this.$element.addClass("openerp openerp-web-client-container");
- if (jQuery.param != undefined && jQuery.deparam(jQuery.param.querystring()).kitten != undefined) {
+ if (jQuery.param !== undefined && jQuery.deparam(jQuery.param.querystring()).kitten !== undefined) {
this.$element.addClass("kitten-mode-activated");
this.$element.delegate('img.oe-record-edit-link-img', 'hover', function(e) {
self.$element.toggleClass('clark-gable');
@@ -899,7 +910,7 @@ instance.web.WebClient = instance.web.Widget.extend({
message: message,
data: {debug: file + ':' + line}
});
- }
+ };
}
this.notification = new instance.web.Notification(this);
this.notification.appendTo(this.$element);
@@ -954,9 +965,18 @@ instance.web.WebClient = instance.web.Widget.extend({
}
},
on_hashchange: function(event) {
+ var self = this;
var state = event.getState(true);
if (!_.isEqual(this._current_state, state)) {
- this.action_manager.do_load_state(state, !!this._current_state);
+ if(state.action_id === undefined && state.menu_id) {
+ self.menu.has_been_loaded.then(function() {
+ self.menu.do_reload().then(function() {
+ self.menu.menu_click(state.menu_id)
+ });
+ });
+ } else {
+ this.action_manager.do_load_state(state, !!this._current_state);
+ }
}
this._current_state = state;
},
@@ -970,7 +990,7 @@ instance.web.WebClient = instance.web.Widget.extend({
},
do_action: function(action) {
var self = this;
- // TODO replace by client action menuclick
+ // TODO replace by client action menuclick
if(action.menu_id) {
this.do_reload().then(function () {
self.menu.menu_click(action.menu_id);
@@ -989,7 +1009,7 @@ instance.web.EmbeddedClient = instance.web.Widget.extend({
template: 'EmptyComponent',
init: function(parent, action_id, options) {
this._super(parent);
- // TODO take the xmlid of a action instead of its id
+ // TODO take the xmlid of a action instead of its id
this.action_id = action_id;
this.options = options || {};
this.am = new instance.web.ActionManager(this);
@@ -1030,7 +1050,7 @@ instance.web.embed = function (origin, dbname, login, key, action, options) {
});
});
-}
+};
};
diff --git a/addons/web/static/src/js/corelib.js b/addons/web/static/src/js/corelib.js
index b30350a9502..93796ab4282 100644
--- a/addons/web/static/src/js/corelib.js
+++ b/addons/web/static/src/js/corelib.js
@@ -710,6 +710,12 @@ instance.web.Widget = instance.web.Class.extend(instance.web.WidgetMixin, {
}
},
/**
+ * Shortcut for $element.find() like backbone
+ */
+ "$": function() {
+ return this.$element.find.apply(this.$element,arguments);
+ },
+ /**
* Informs the action manager to do an action. This supposes that
* the action manager can be found amongst the ancestors of the current widget.
* If that's not the case this method will simply return `false`.
diff --git a/addons/web/static/src/js/coresetup.js b/addons/web/static/src/js/coresetup.js
index 8e7b5d4f75d..5a8a2b50722 100644
--- a/addons/web/static/src/js/coresetup.js
+++ b/addons/web/static/src/js/coresetup.js
@@ -579,6 +579,33 @@ $.async_when = function() {
return old_async_when.apply(this, arguments);
};
+/**
+ * Registry for all the client actions key: tag value: widget
+ */
+instance.web.client_actions = new instance.web.Registry();
+
+/**
+ * Client action to reload the whole interface.
+ * If params has an entry 'menu_id', it opens the given menu entry.
+ */
+instance.web.client_actions.add("reload", "instance.web.Reload");
+
+instance.web.Reload = instance.web.Widget.extend({
+ init: function(parent, params) {
+ this._super(parent);
+ this.menu_id = (params && params.menu_id) || false;
+ },
+ start: function() {
+ if (this.menu_id) {
+ // open the given menu id
+ var url_without_fragment = window.location.toString().split("#", 1)[0];
+ window.location = url_without_fragment + "#menu_id=" + this.menu_id;
+ } else {
+ window.location.reload();
+ }
+ }
+});
+
};
// vim:et fdc=0 fdl=0 foldnestmax=3 fdm=syntax:
diff --git a/addons/web/static/src/js/data.js b/addons/web/static/src/js/data.js
index 2dc66aaa135..fdb15d598af 100644
--- a/addons/web/static/src/js/data.js
+++ b/addons/web/static/src/js/data.js
@@ -1079,44 +1079,44 @@ instance.web.ProxyDataSet = instance.web.DataSetSearch.extend({
this.create_function = null;
this.write_function = null;
this.read_function = null;
+ this.default_get_function = null;
+ this.unlink_function = null;
},
- read_ids: function () {
+ read_ids: function (ids, fields, options) {
if (this.read_function) {
- return this.read_function.apply(null, arguments);
+ return this.read_function(ids, fields, options, this._super);
} else {
return this._super.apply(this, arguments);
}
},
default_get: function(fields, options) {
- return this._super(fields, options).then(this.on_default_get);
+ if (this.default_get_function) {
+ return this.default_get_function(fields, options, this._super);
+ } else {
+ return this._super.apply(this, arguments);
+ }
},
- on_default_get: function(result) {},
create: function(data, callback, error_callback) {
- this.on_create(data);
if (this.create_function) {
- return this.create_function(data, callback, error_callback);
+ return this.create_function(data, this._super).then(callback, error_callback);
} else {
- console.warn("trying to create a record using default proxy dataset behavior");
- return $.async_when({"result": undefined}).then(callback);
+ return this._super.apply(this, arguments);
}
},
- on_create: function(data) {},
- write: function (id, data, options, callback) {
- this.on_write(id, data);
+ write: function (id, data, options, callback, error_callback) {
if (this.write_function) {
- return this.write_function(id, data, options, callback);
+ return this.write_function(id, data, options, this._super).then(callback, error_callback);
} else {
- console.warn("trying to write a record using default proxy dataset behavior");
- return $.async_when({"result": true}).then(callback);
+ return this._super.apply(this, arguments);
}
},
- on_write: function(id, data) {},
unlink: function(ids, callback, error_callback) {
- this.on_unlink(ids);
- console.warn("trying to unlink a record using default proxy dataset behavior");
- return $.async_when({"result": true}).then(callback);
+ if (this.unlink_function) {
+ return this.unlink_function(ids, this._super).then(callback, error_callback);
+ } else {
+ return this._super.apply(this, arguments);
+ }
},
- on_unlink: function(ids) {}
});
instance.web.CompoundContext = instance.web.Class.extend({
diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js
index 3b9cc7570d0..23e1c9a3ab8 100644
--- a/addons/web/static/src/js/view_form.js
+++ b/addons/web/static/src/js/view_form.js
@@ -984,9 +984,6 @@ instance.web.form.FormRenderingEngine = instance.web.form.FormRenderingEngineInt
},
process: function($tag, layout) {
var self = this;
- if ($tag.attr('layout') === 'auto') {
- $tag.addClass('oe_form_autolayout');
- }
layout = $tag.attr('layout') || layout || 'auto';
$tag.removeAttr('layout');
var tagname = $tag[0].nodeName.toLowerCase();
@@ -2310,16 +2307,6 @@ instance.web.form.FieldSelection = instance.web.form.AbstractField.extend(_.exte
});
})();
-instance.web.form.dialog = function(content, options) {
- options = _.extend({
- width: '90%',
- height: 'auto',
- min_width: '800px'
- }, options || {});
- var dialog = new instance.web.Dialog(null, options, content).open();
- return dialog.$element;
-};
-
/**
* A mixin containing some useful methods to handle completion inputs.
*/
@@ -2756,20 +2743,18 @@ instance.web.form.FieldOne2Many = instance.web.form.AbstractField.extend({
view.view_type = 'form';
}
view.options.not_interactible_on_create = true;
+ } else if (view.view_type === "kanban") {
+ if (self.get("effective_readonly")) {
+ view.options.action_buttons = false;
+ view.options.quick_creatable = false;
+ }
}
views.push(view);
});
this.views = views;
- this.viewmanager = new instance.web.ViewManager(this, this.dataset, views, {
- $sidebar: false,
- });
- this.viewmanager.template = 'One2Many.viewmanager';
- this.viewmanager.registry = instance.web.views.extend({
- list: 'instance.web.form.One2ManyListView',
- form: 'instance.web.form.One2ManyFormView',
- kanban: 'instance.web.form.One2ManyKanbanView',
- });
+ this.viewmanager = new instance.web.form.One2ManyViewManager(this, this.dataset, views, {});
+ this.viewmanager.o2m = self;
var once = $.Deferred().then(function() {
self.init_form_last_update.resolve();
});
@@ -2953,6 +2938,42 @@ instance.web.form.FieldOne2Many = instance.web.form.AbstractField.extend({
},
});
+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({
+ list: 'instance.web.form.One2ManyListView',
+ form: 'instance.web.form.One2ManyFormView',
+ kanban: 'instance.web.form.One2ManyKanbanView',
+ });
+ },
+ switch_view: function(mode, unused) {
+ if (mode !== 'form') {
+ return this._super(mode, unused);
+ }
+ var self = this;
+ var id = self.o2m.dataset.index !== null ? self.o2m.dataset.ids[self.o2m.dataset.index] : null;
+ var pop = new instance.web.form.FormOpenPopup(self.o2m.view);
+ pop.show_element(self.o2m.field.relation, id, self.o2m.build_context(), {
+ title: _t("Open: ") + self.name,
+ write_function: function(id, data, options) {
+ return self.o2m.dataset.write(id, data, {}).then(function() {
+ self.o2m.reload_current_view();
+ });
+ },
+ alternative_form_view: self.o2m.field.views ? self.o2m.field.views["form"] : undefined,
+ parent_view: self.o2m.view,
+ child_name: self.o2m.name,
+ read_function: function() {
+ return self.o2m.dataset.read_ids.apply(self.o2m.dataset, arguments);
+ },
+ form_view_options: {'not_interactible_on_create':true},
+ readonly: self.o2m.get("effective_readonly")
+ });
+ },
+});
+
instance.web.form.One2ManyDataSet = instance.web.BufferedDataSet.extend({
get_context: function() {
this.context = this.o2m.build_context([this.o2m.name]);
@@ -2968,7 +2989,6 @@ instance.web.form.One2ManyListView = instance.web.ListView.extend({
} else {
var self = this;
var pop = new instance.web.form.SelectCreatePopup(this);
- pop.on_default_get.add(self.dataset.on_default_get);
pop.select_element(
self.o2m.field.relation,
{
@@ -3001,7 +3021,11 @@ instance.web.form.One2ManyListView = instance.web.ListView.extend({
var pop = new instance.web.form.FormOpenPopup(self.o2m.view);
pop.show_element(self.o2m.field.relation, id, self.o2m.build_context(), {
title: _t("Open: ") + self.name,
- auto_write: false,
+ write_function: function(id, data) {
+ return self.o2m.dataset.write(id, data, {}, function(r) {
+ self.o2m.reload_current_view();
+ });
+ },
alternative_form_view: self.o2m.field.views ? self.o2m.field.views["form"] : undefined,
parent_view: self.o2m.view,
child_name: self.o2m.name,
@@ -3011,11 +3035,6 @@ instance.web.form.One2ManyListView = instance.web.ListView.extend({
form_view_options: {'not_interactible_on_create':true},
readonly: self.o2m.get("effective_readonly")
});
- pop.on_write.add(function(id, data) {
- self.o2m.dataset.write(id, data, {}, function(r) {
- self.o2m.reload_current_view();
- });
- });
},
do_button_action: function (name, id, callback) {
var self = this;
@@ -3046,28 +3065,6 @@ 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({
- open_record: function(id) {
- var self = this;
- var pop = new instance.web.form.FormOpenPopup(self.o2m.view);
- pop.show_element(self.o2m.field.relation, id, self.o2m.build_context(), {
- title: _t("Open: ") + self.name,
- auto_write: false,
- alternative_form_view: self.o2m.field.views ? self.o2m.field.views["form"] : undefined,
- parent_view: self.o2m.view,
- child_name: self.o2m.name,
- read_function: function() {
- return self.o2m.dataset.read_ids.apply(self.o2m.dataset, arguments);
- },
- form_view_options: {'not_interactible_on_create':true},
- readonly: self.o2m.get("effective_readonly"),
- });
- pop.on_write.add(function(id, data) {
- self.o2m.dataset.write(id, data, {}, function(r) {
- self.o2m.reload_current_view();
- });
- });
-
- },
});
}
@@ -3347,60 +3344,166 @@ instance.web.form.Many2ManyListView = instance.web.ListView.extend(/** @lends in
});
/**
- * @class
- * @extends instance.web.OldWidget
+ * Class with everything which is common between FormOpenPopup and SelectCreatePopup.
*/
-instance.web.form.SelectCreatePopup = instance.web.OldWidget.extend(/** @lends instance.web.form.SelectCreatePopup# */{
- template: "SelectCreatePopup",
+instance.web.form.AbstractFormPopup = instance.web.OldWidget.extend({
+ template: "AbstractFormPopup.render",
/**
- * options:
- * - initial_ids
- * - initial_view: form or search (default search)
- * - disable_multiple_selection
+ * options:
+ * -readonly: only applicable when not in creation mode, default to false
* - alternative_form_view
- * - create_function (defaults to a naive saving behavior)
+ * - write_function
+ * - read_function
+ * - create_function
* - parent_view
* - child_name
* - form_view_options
- * - list_view_options
- * - read_function
*/
- select_element: function(model, options, domain, context) {
- var self = this;
+ init_popup: function(model, row_id, domain, context, options) {
+ this.row_id = row_id;
this.model = model;
this.domain = domain || [];
this.context = context || {};
- this.options = _.defaults(options || {}, {"initial_view": "search", "create_function": function() {
- return self.create_row.apply(self, arguments);
- }, read_function: null});
- this.initial_ids = this.options.initial_ids;
+ this.options = options;
+ _.defaults(this.options, {
+ });
+ },
+ init_dataset: function() {
+ var self = this;
this.created_elements = [];
+ this.dataset = new instance.web.ProxyDataSet(this, this.model, this.context);
+ this.dataset.read_function = this.options.read_function;
+ this.dataset.create_function = function(data, sup) {
+ var fct = self.options.create_function || sup;
+ return fct.call(this, data).then(function(r) {
+ self.created_elements.push(r.result);
+ });
+ };
+ this.dataset.write_function = function(id, data, options, sup) {
+ var fct = self.options.write_function || sup;
+ return fct.call(this, id, data, options).then(self.on_write_completed);
+ };
+ this.dataset.parent_view = this.options.parent_view;
+ this.dataset.child_name = this.options.child_name;
+ },
+ display_popup: function() {
+ var self = this;
this.renderElement();
- instance.web.form.dialog(this.$element, {
+ new instance.web.Dialog(this, {
+ width: '90%',
+ min_width: '800px',
close: function() {
self.check_exit();
},
- title: options.title || ""
- });
+ title: this.options.title || "",
+ }, this.$element).open();
this.start();
},
+ on_write_completed: function() {},
+ setup_form_view: function() {
+ var self = this;
+ if (this.row_id) {
+ this.dataset.ids = [this.row_id];
+ this.dataset.index = 0;
+ } else {
+ this.dataset.index = null;
+ }
+ var options = _.clone(self.options.form_view_options) || {};
+ if (this.row_id !== null) {
+ options.initial_mode = this.options.readonly ? "view" : "edit";
+ }
+ this.view_form = new instance.web.FormView(this, this.dataset, false, options);
+ if (this.options.alternative_form_view) {
+ this.view_form.set_embedded_view(this.options.alternative_form_view);
+ }
+ this.view_form.appendTo(this.$element.find(".oe-form-view-popup-form-placeholder"));
+ this.view_form.on_loaded.add_last(function() {
+ var $buttons = self.view_form.$element.find(".oe_form_buttons");
+ var multi_select = self.row_id === null && ! self.options.disable_multiple_selection;
+ $buttons.html(QWeb.render("AbstractFormPopup.buttons", {multi_select: multi_select}));
+ var $snbutton = $buttons.find(".oe_abstractformpopup-form-save-new");
+ $snbutton.click(function() {
+ $.when(self.view_form.do_save()).then(function() {
+ self.view_form.reload_mutex.exec(function() {
+ self.view_form.on_button_new();
+ });
+ });
+ });
+ var $sbutton = $buttons.find(".oe_abstractformpopup-form-save");
+ $sbutton.click(function() {
+ $.when(self.view_form.do_save()).then(function() {
+ self.view_form.reload_mutex.exec(function() {
+ self.check_exit();
+ });
+ });
+ });
+ var $cbutton = $buttons.find(".oe_abstractformpopup-form-close");
+ $cbutton.click(function() {
+ self.check_exit();
+ });
+ if (self.row_id !== null && self.options.readonly) {
+ $snbutton.hide();
+ $sbutton.hide();
+ $cbutton.text(_t("Close"));
+ }
+ self.view_form.do_show();
+ });
+ },
+ on_select_elements: function(element_ids) {
+ },
+ check_exit: function() {
+ if (this.created_elements.length > 0) {
+ this.on_select_elements(this.created_elements);
+ }
+ this.destroy();
+ },
+ destroy: function () {
+ this.$element.dialog('close');
+ this._super();
+ },
+});
+
+/**
+ * Class to display a popup containing a form view.
+ */
+instance.web.form.FormOpenPopup = instance.web.form.AbstractFormPopup.extend({
+ show_element: function(model, row_id, context, options) {
+ this.init_popup(model, row_id, [], context, options);
+ _.defaults(this.options, {
+ });
+ this.display_popup();
+ },
start: function() {
this._super();
+ this.init_dataset();
+ this.setup_form_view();
+ },
+});
+
+/**
+ * Class to display a popup to display a list to search a row. It also allows
+ * to switch to a form view to create a new row.
+ */
+instance.web.form.SelectCreatePopup = instance.web.form.AbstractFormPopup.extend({
+ /**
+ * options:
+ * - initial_ids
+ * - initial_view: form or search (default search)
+ * - disable_multiple_selection
+ * - list_view_options
+ */
+ select_element: function(model, options, domain, context) {
+ this.init_popup(model, null, domain, context, options);
var self = this;
- this.dataset = new instance.web.ProxyDataSet(this, this.model,
- this.context);
- this.dataset.create_function = function() {
- return self.options.create_function.apply(null, arguments).then(function(r) {
- self.created_elements.push(r.result);
- });
- };
- this.dataset.write_function = function() {
- return self.write_row.apply(self, arguments);
- };
- this.dataset.read_function = this.options.read_function;
- this.dataset.parent_view = this.options.parent_view;
- this.dataset.child_name = this.options.child_name;
- this.dataset.on_default_get.add(this.on_default_get);
+ _.defaults(this.options, {
+ initial_view: "search",
+ });
+ this.initial_ids = this.options.initial_ids;
+ this.display_popup();
+ },
+ start: function() {
+ var self = this;
+ this.init_dataset();
if (this.options.initial_view == "search") {
self.rpc('/web/session/eval_domain_and_context', {
domains: [],
@@ -3419,10 +3522,6 @@ instance.web.form.SelectCreatePopup = instance.web.OldWidget.extend(/** @lends i
this.new_object();
}
},
- stop: function () {
- this.$element.dialog('close');
- this._super();
- },
setup_search_view: function(search_defaults) {
var self = this;
if (this.searchview) {
@@ -3480,22 +3579,6 @@ instance.web.form.SelectCreatePopup = instance.web.OldWidget.extend(/** @lends i
self.view_list.do_search(results.domain, results.context, results.group_by);
});
},
- create_row: function() {
- var self = this;
- var wdataset = new instance.web.DataSetSearch(this, this.model, this.context, this.domain);
- wdataset.parent_view = this.options.parent_view;
- wdataset.child_name = this.options.child_name;
- return wdataset.create.apply(wdataset, arguments);
- },
- write_row: function() {
- var self = this;
- var wdataset = new instance.web.DataSetSearch(this, this.model, this.context, this.domain);
- wdataset.parent_view = this.options.parent_view;
- wdataset.child_name = this.options.child_name;
- return wdataset.write.apply(wdataset, arguments);
- },
- on_select_elements: function(element_ids) {
- },
on_click_element: function(ids) {
this.selected_ids = ids || [];
if(this.selected_ids.length > 0) {
@@ -3505,52 +3588,14 @@ instance.web.form.SelectCreatePopup = instance.web.OldWidget.extend(/** @lends i
}
},
new_object: function() {
- var self = this;
if (this.searchview) {
this.searchview.hide();
}
if (this.view_list) {
this.view_list.$element.hide();
}
- this.dataset.index = null;
- this.view_form = new instance.web.FormView(this, this.dataset, false, self.options.form_view_options);
- if (this.options.alternative_form_view) {
- this.view_form.set_embedded_view(this.options.alternative_form_view);
- }
- this.view_form.appendTo(this.$element.find(".oe-select-create-popup-view-form"));
- this.view_form.on_loaded.add_last(function() {
- var $buttons = self.view_form.$element.find(".oe_form_buttons");
- $buttons.html(QWeb.render("SelectCreatePopup.form.buttons", {widget:self}));
- var $nbutton = $buttons.find(".oe_selectcreatepopup-form-save-new");
- $nbutton.click(function() {
- $.when(self.view_form.do_save()).then(function() {
- self.view_form.reload_mutex.exec(function() {
- self.view_form.on_button_new();
- });
- });
- });
- var $nbutton = $buttons.find(".oe_selectcreatepopup-form-save");
- $nbutton.click(function() {
- $.when(self.view_form.do_save()).then(function() {
- self.view_form.reload_mutex.exec(function() {
- self.check_exit();
- });
- });
- });
- var $cbutton = $buttons.find(".oe_selectcreatepopup-form-close");
- $cbutton.click(function() {
- self.check_exit();
- });
- });
- this.view_form.do_show();
- },
- check_exit: function() {
- if (this.created_elements.length > 0) {
- this.on_select_elements(this.created_elements);
- }
- this.destroy();
+ this.setup_form_view();
},
- on_default_get: function(res) {}
});
instance.web.form.SelectCreateListView = instance.web.ListView.extend({
@@ -3567,101 +3612,6 @@ instance.web.form.SelectCreateListView = instance.web.ListView.extend({
}
});
-/**
- * @class
- * @extends instance.web.OldWidget
- */
-instance.web.form.FormOpenPopup = instance.web.OldWidget.extend(/** @lends instance.web.form.FormOpenPopup# */{
- template: "FormOpenPopup",
- /**
- * options:
- * - alternative_form_view
- * - auto_write (default true)
- * - read_function
- * - parent_view
- * - child_name
- * - form_view_options
- * - readonly
- */
- show_element: function(model, row_id, context, options) {
- this.model = model;
- this.row_id = row_id;
- this.context = context || {};
- this.options = _.defaults(options || {}, {"auto_write": true});
- this.renderElement();
- instance.web.dialog(this.$element, {
- title: options.title || '',
- modal: true,
- width: 960,
- height: 600
- });
- this.start();
- },
- start: function() {
- this._super();
- this.dataset = new instance.web.form.FormOpenDataset(this, this.model, this.context);
- this.dataset.fop = this;
- this.dataset.ids = [this.row_id];
- this.dataset.index = 0;
- this.dataset.parent_view = this.options.parent_view;
- this.dataset.child_name = this.options.child_name;
- this.setup_form_view();
- },
- on_write: function(id, data) {
- if (!this.options.auto_write)
- return;
- var self = this;
- var wdataset = new instance.web.DataSetSearch(this, this.model, this.context, this.domain);
- wdataset.parent_view = this.options.parent_view;
- wdataset.child_name = this.options.child_name;
- wdataset.write(id, data, {}, function(r) {
- self.on_write_completed();
- });
- },
- on_write_completed: function() {},
- setup_form_view: function() {
- var self = this;
- var FormClass = instance.web.views.get_object('form');
- var options = _.clone(self.options.form_view_options) || {};
- options.initial_mode = this.options.readonly ? "view" : "edit";
- this.view_form = new FormClass(this, this.dataset, false, options);
- if (this.options.alternative_form_view) {
- this.view_form.set_embedded_view(this.options.alternative_form_view);
- }
- this.view_form.appendTo(this.$element.find(".oe-form-open-popup-form-view"));
- this.view_form.on_loaded.add_last(function() {
- var $buttons = self.view_form.$element.find(".oe_form_buttons");
- $buttons.html(QWeb.render("FormOpenPopup.form.buttons"));
- var $nbutton = $buttons.find(".oe_formopenpopup-form-save");
- $nbutton.click(function() {
- self.view_form.do_save().then(function() {
- self.destroy();
- });
- });
- var $cbutton = $buttons.find(".oe_formopenpopup-form-close");
- $cbutton.click(function() {
- self.destroy();
- });
- if (self.options.readonly) {
- $nbutton.hide();
- $cbutton.text(_t("Close"));
- }
- self.view_form.do_show();
- });
- this.dataset.on_write.add(this.on_write);
- }
-});
-
-instance.web.form.FormOpenDataset = instance.web.ProxyDataSet.extend({
- read_ids: function() {
- if (this.fop.options.read_function) {
- return this.fop.options.read_function.apply(null, arguments);
- } else {
- return this._super.apply(this, arguments);
- }
- }
-});
-
instance.web.form.FieldReference = instance.web.form.AbstractField.extend(_.extend({}, instance.web.form.ReinitializeFieldMixin, {
template: 'FieldReference',
init: function(field_manager, node) {
diff --git a/addons/web/static/src/js/view_list.js b/addons/web/static/src/js/view_list.js
index 5c9f41806c2..e1d2e4326cc 100644
--- a/addons/web/static/src/js/view_list.js
+++ b/addons/web/static/src/js/view_list.js
@@ -20,6 +20,7 @@ instance.web.ListView = instance.web.View.extend( /** @lends instance.web.ListVi
'sortable': true,
// whether the view rows can be reordered (via vertical drag & drop)
'reorderable': true,
+ 'action_buttons': true,
},
/**
* Core class for list-type displays.
diff --git a/addons/web/static/src/js/views.js b/addons/web/static/src/js/views.js
index abc62f8fcd7..6bf7e273eab 100644
--- a/addons/web/static/src/js/views.js
+++ b/addons/web/static/src/js/views.js
@@ -295,7 +295,7 @@ instance.web.ViewManager = instance.web.Widget.extend({
if (view.embedded_view) {
controller.set_embedded_view(view.embedded_view);
}
- controller.do_switch_view.add_last(this.on_mode_switch);
+ controller.do_switch_view.add_last(_.bind(this.switch_view, this));
controller.do_prev_view.add_last(this.on_prev_view);
var container = this.$element.find(".oe_view_manager_view_" + view_type);
view_promise = controller.appendTo(container);
@@ -343,6 +343,14 @@ instance.web.ViewManager = instance.web.Widget.extend({
return view_promise;
},
/**
+ * Method used internally when a view asks to switch view. This method is meant
+ * to be extended by child classes to change the default behavior, which simply
+ * consist to switch to the asked view.
+ */
+ switch_view: function(view_type, no_store) {
+ return this.on_mode_switch(view_type, no_store);
+ },
+ /**
* Returns to the view preceding the caller view in this manager's
* navigation history (the navigation history is appended to via
* on_mode_switch)
@@ -1273,11 +1281,6 @@ instance.web.str_to_xml = function(s) {
}
/**
- * Registry for all the client actions key: tag value: widget
- */
-instance.web.client_actions = new instance.web.Registry();
-
-/**
* Registry for all the main views
*/
instance.web.views = new instance.web.Registry();
diff --git a/addons/web/static/src/xml/base.xml b/addons/web/static/src/xml/base.xml
index 28cba6062d7..47939a76b4b 100644
--- a/addons/web/static/src/xml/base.xml
+++ b/addons/web/static/src/xml/base.xml
@@ -136,7 +136,7 @@
</tr>
<tr>
<td><label for="db_name">New database name:</label></td>
- <td><input type="text" name="db_name" class="required" matches="^[a-zA-Z][a-zA-Z0-9_]+$"/></td>
+ <td><input type="text" name="db_name" class="required" matches="^[a-zA-Z][a-zA-Z0-9_]+$" autofocus="true"/></td>
</tr>
<tr>
<td><label for="demo_data">Load Demonstration data:</label></td>
@@ -1534,7 +1534,7 @@
</t>
</select>
</t>
-<t t-name="SelectCreatePopup">
+<t t-name="AbstractFormPopup.render">
<div>
<table style="width:100%">
<tr style="width:100%">
@@ -1548,31 +1548,22 @@
</td>
</tr>
</table>
- <div class="oe-select-create-popup-view-form" style="width:100%"></div>
+ <div class="oe-form-view-popup-form-placeholder oe-select-create-popup-view-form" style="width:100%"></div>
</div>
</t>
<t t-name="SelectCreatePopup.search.buttons">
<button type="button" class="oe_button oe_selectcreatepopup-search-select" disabled="disabled">Select</button>
<button type="button" class="oe_button oe_selectcreatepopup-search-close">Cancel</button>
</t>
-<t t-name="SelectCreatePopup.form.buttons">
- <t t-if="widget.options.disable_multiple_selection">
- <button type="button" class="oe_button oe_selectcreatepopup-form-save">Save</button>
+<t t-name="AbstractFormPopup.buttons">
+ <t t-if="! multi_select">
+ <button type="button" class="oe_button oe_abstractformpopup-form-save">Save</button>
</t>
- <t t-if="! widget.options.disable_multiple_selection">
- <button type="button" class="oe_button oe_selectcreatepopup-form-save-new">Save &amp; New</button>
- <button type="button" class="oe_button oe_selectcreatepopup-form-save">Save &amp; Close</button>
+ <t t-if="multi_select">
+ <button type="button" class="oe_button oe_abstractformpopup-form-save-new">Save &amp; New</button>
+ <button type="button" class="oe_button oe_abstractformpopup-form-save">Save &amp; Close</button>
</t>
- <button type="button" class="oe_button oe_selectcreatepopup-form-close">Cancel</button>
-</t>
-<t t-name="FormOpenPopup">
- <div>
- <div class="oe-form-open-popup-form-view" style="width:100%"></div>
- </div>
-</t>
-<t t-name="FormOpenPopup.form.buttons">
- <button type="button" class="oe_button oe_formopenpopup-form-save">Save</button>
- <button type="button" class="oe_button oe_formopenpopup-form-close">Cancel</button>
+ <button type="button" class="oe_button oe_abstractformpopup-form-close">Cancel</button>
</t>
<t t-extend="ListView.row">
<!-- adds back padding to row being rendered after edition, if necessary