diff --git a/addons/web/static/lib/jquery.ui.bootstrap/css/custom-theme/jquery-ui-1.9.0.custom.css b/addons/web/static/lib/jquery.ui.bootstrap/css/custom-theme/jquery-ui-1.9.0.custom.css index a06e9447afc..f19c56caed1 100644 --- a/addons/web/static/lib/jquery.ui.bootstrap/css/custom-theme/jquery-ui-1.9.0.custom.css +++ b/addons/web/static/lib/jquery.ui.bootstrap/css/custom-theme/jquery-ui-1.9.0.custom.css @@ -1115,7 +1115,7 @@ body .ui-tooltip { border-width:2px; } /*** Input field styling from Bootstrap **/ - input, textarea { +/* input, textarea { -webkit-transition: border linear 0.2s, box-shadow linear 0.2s; -moz-transition: border linear 0.2s, box-shadow linear 0.2s; -ms-transition: border linear 0.2s, box-shadow linear 0.2s; @@ -1137,12 +1137,12 @@ input[type=file]:focus, input[type=checkbox]:focus, select:focus { -moz-box-shadow: none; box-shadow: none; outline: 1px dotted #666; -} +}*/ -input[type="text"], -input[type="password"], +/*input[type="text"], +input[type="password"],*/ .ui-autocomplete-input, -textarea, +/*textarea,*/ .uneditable-input { display: inline-block; padding: 4px; diff --git a/addons/web/static/src/css/base.css b/addons/web/static/src/css/base.css index 94d02758ad0..3e287dedde6 100644 --- a/addons/web/static/src/css/base.css +++ b/addons/web/static/src/css/base.css @@ -2306,16 +2306,16 @@ text-align: justify; } .openerp .oe_form_editable .oe_form .oe_form_field_integer input { - width: 6em !important; + width: 6em; } .openerp .oe_form_editable .oe_form .oe_form_field_float input { - width: 7em !important; + width: 7em; } .openerp .oe_form_editable .oe_form .oe_form_field_date input { - width: 7.5em !important; + width: 7.5em; } .openerp .oe_form_editable .oe_form .oe_form_field_datetime input { - width: 11.5em !important; + width: 11.5em; } .openerp .oe_hidden_input_file { position: relative; @@ -2578,32 +2578,31 @@ top: 5px; } .openerp .oe_list.oe_list_editable.oe_editing .oe_m2o_cm_button { - display: none; + line-height: 19px; +} +.openerp .oe_list.oe_list_editable.oe_editing .oe_input_icon { + margin-top: 5px; +} +.openerp .oe_list.oe_list_editable.oe_editing .oe_form_field { + min-width: 0; + max-width: none; } .openerp .oe_list.oe_list_editable.oe_editing .oe_form_field input, .openerp .oe_list.oe_list_editable.oe_editing .oe_form_field textarea { height: 27px; -} -.openerp .oe_list.oe_list_editable.oe_editing .oe_form_field input, .openerp .oe_list.oe_list_editable.oe_editing .oe_form_field textarea { -moz-border-radius: 0; -webkit-border-radius: 0; border-radius: 0; border: 1px solid #aaaaff; margin: 0; + min-width: 0; } .openerp .oe_list.oe_list_editable.oe_editing .oe_form_field.oe_form_field_float input, .openerp .oe_list.oe_list_editable.oe_editing .oe_form_field.oe_form_view_integer input { text-align: right; width: 100% !important; } -.openerp .oe_list.oe_list_editable.oe_editing .oe_form_field.oe_form_field_datetime > span, .openerp .oe_list.oe_list_editable.oe_editing .oe_form_field.oe_form_field_date > span { - width: 100% !important; -} .openerp .oe_list.oe_list_editable.oe_editing .oe_form_field.oe_form_field_datetime input.oe_datepicker_master, .openerp .oe_list.oe_list_editable.oe_editing .oe_form_field.oe_form_field_date input.oe_datepicker_master { width: 100% !important; } -.openerp .oe_list.oe_list_editable.oe_editing .oe_form_field .oe_form_field_float, .openerp .oe_list.oe_list_editable.oe_editing .oe_form_field .oe_form_view_integer, .openerp .oe_list.oe_list_editable.oe_editing .oe_form_field.oe_form_field_datetime, .openerp .oe_list.oe_list_editable.oe_editing .oe_form_field.oe_form_field_date { - min-width: 0 !important; - max-width: none !important; -} .openerp .oe_list_group_name { white-space: nowrap; } @@ -2735,6 +2734,10 @@ .openerp .oe_list_content > tbody > tr > td.oe_list_checkbox:first-child:after, .openerp .oe_list_content > tbody > tr th.oe_list_checkbox:first-child:after { border-width: 0; } +.openerp .oe_list_content > tbody > tr > td.oe_list_field_boolean input { + filter: alpha(opacity=50); + opacity: 0.5; +} .openerp .oe_list_content > tbody > tr:nth-child(odd) { background-color: #f0f0fa; background-color: #f0f0fa; diff --git a/addons/web/static/src/css/base.sass b/addons/web/static/src/css/base.sass index f911929e159..5e11ab56e04 100644 --- a/addons/web/static/src/css/base.sass +++ b/addons/web/static/src/css/base.sass @@ -1837,13 +1837,13 @@ $sheet-padding: 16px .oe_form_editable .oe_form .oe_form_field_integer input - width: 6em !important + width: 6em .oe_form_field_float input - width: 7em !important + width: 7em .oe_form_field_date input - width: 7.5em !important + width: 7.5em .oe_form_field_datetime input - width: 11.5em !important + width: 11.5em // }}} // FormView.fields_binary {{{ /* http://www.quirksmode.org/dom/inputfile.html @@ -2041,26 +2041,25 @@ $sheet-padding: 16px .oe_m2o_drop_down_button top: 5px .oe_m2o_cm_button - display: none + line-height: 19px + .oe_input_icon + margin-top: 5px .oe_form_field + min-width: 0 + max-width: none input, textarea height: $row-height - input, textarea @include radius(0) border: 1px solid #aaf margin: 0 + min-width: 0 &.oe_form_field_float,&.oe_form_view_integer input text-align: right width: 100% !important &.oe_form_field_datetime,&.oe_form_field_date - > span - width: 100% !important input.oe_datepicker_master width: 100% !important - .oe_form_field_float,.oe_form_view_integer,&.oe_form_field_datetime,&.oe_form_field_date - min-width: 0 !important - max-width: none !important .oe_list_group_name white-space: nowrap // }}} @@ -2168,6 +2167,8 @@ $sheet-padding: 16px width: 17px &:after border-width: 0 + > td.oe_list_field_boolean input + @include opacity() > tr:nth-child(odd) background-color: #f0f0fa @include vertical-gradient(#f0f0fa, #eeeef6) diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index 62c534c0a48..02b4038f456 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -2152,17 +2152,10 @@ instance.web.form.AbstractField = instance.web.form.FormWidget.extend(instance.w }, set_dimensions: function (height, width) { - // remove width css property - this.$el.css('width', ''); - // extract style (without width) - var old_style = this.$el.attr('style'); - // jQuery doesn't understand/use !important - var style = 'width:' + width + 'px !important;'; - if (old_style) { - style += old_style - } - this.$el.attr('style', style); - this.$el.css('minHeight', height); + this.$el.css({ + width: width, + minHeight: height + }); }, commit_value: function() { return $.when(); diff --git a/addons/web/static/src/js/view_list.js b/addons/web/static/src/js/view_list.js index 3d777b381bb..700c126d68d 100644 --- a/addons/web/static/src/js/view_list.js +++ b/addons/web/static/src/js/view_list.js @@ -503,12 +503,17 @@ instance.web.ListView = instance.web.View.extend( /** @lends instance.web.ListVi return this.reload_content(); }, reload_record: function (record) { + var self = this; return this.dataset.read_ids( [record.get('id')], _.pluck(_(this.columns).filter(function (r) { return r.tag === 'field'; }), 'name') ).done(function (records) { + if (!records[0]) { + self.records.remove(record); + return; + } _(records[0]).each(function (value, key) { record.set(key, value, {silent: true}); }); @@ -2151,7 +2156,7 @@ instance.web.list.Boolean = instance.web.list.Column.extend({ * @private */ _format: function (row_data, options) { - return _.str.sprintf('', + return _.str.sprintf('', row_data[this.id].value ? 'checked="checked"' : ''); } }); diff --git a/addons/web/static/src/js/view_list_editable.js b/addons/web/static/src/js/view_list_editable.js index f144b5485c7..becadcadf39 100644 --- a/addons/web/static/src/js/view_list_editable.js +++ b/addons/web/static/src/js/view_list_editable.js @@ -117,13 +117,6 @@ openerp.web.list_editable = function (instance) { e.preventDefault(); self.cancel_edition(); }); - this.$el - .off('click', 'tbody td:not(.oe_list_field_cell)') - .on('click', 'tbody td:not(.oe_list_field_cell)', function () { - if (!self.editor.is_editing()) { - self.start_edition(); - } - }); this.editor.destroy(); // Editor is not restartable due to formview not being // restartable diff --git a/addons/web/static/src/js/views.js b/addons/web/static/src/js/views.js index 53132e454d1..55ddeeaf8c4 100644 --- a/addons/web/static/src/js/views.js +++ b/addons/web/static/src/js/views.js @@ -213,8 +213,12 @@ instance.web.ActionManager = instance.web.Widget.extend({ if (run_action) { this.null_action(); action_loaded = this.do_action(state.action); - instance.webclient.menu.has_been_loaded.done(function() { - instance.webclient.menu.open_action(state.action); + $.when(action_loaded || null).done(function() { + instance.webclient.menu.has_been_loaded.done(function() { + if (self.inner_action && self.inner_action.id) { + instance.webclient.menu.open_action(self.inner_action.id); + } + }); }); } } diff --git a/addons/web/static/test/list.js b/addons/web/static/test/list.js new file mode 100644 index 00000000000..63cc16a5022 --- /dev/null +++ b/addons/web/static/test/list.js @@ -0,0 +1,68 @@ +$(document).ready(function () { + var instance; + var $fix = $('#qunit-fixture'); + + module('list.buttons', { + setup: function () { + instance = openerp.testing.instanceFor('list'); + + openerp.testing.loadTemplate(instance); + + openerp.testing.mockifyRPC(instance); + } + }); + asyncTest('record-deletion', 2, function () { + instance.session.responses['/web/view/load'] = function () { + return {result: { + type: 'tree', + fields: { + a: {type: 'char', string: "A"} + }, + arch: { + tag: 'tree', + attrs: { }, + children: [ + {tag: 'field', attrs: {name: 'a'}}, + {tag: 'button', attrs: {type: 'object', name: 'foo'}} + ] + } + }}; + }; + instance.session.responses['/web/dataset/call_kw:read'] = function (req) { + var args = req.params.args[0]; + if (_.isEqual(args, [1, 2, 3])) { + return {result: [ + {id: 1, a: 'foo'}, {id: 2, a: 'bar'}, {id: 3, a: 'baz'} + ]}; + } else if (_.isEqual(args, [2])) { + // button action virtually removed record + return {result: []}; + } + throw new Error(JSON.stringify(req.params)); + }; + instance.session.responses['/web/dataset/call_button'] = function () { + return {result: false}; + }; + var ds = new instance.web.DataSetStatic(null, 'demo', null, [1, 2, 3]); + var l = new instance.web.ListView({}, ds, false, {editable: 'top'}); + l.appendTo($fix) + .then(l.proxy('reload_content')) + .then(function () { + var d = $.Deferred(); + l.records.bind('remove', function () { + d.resolve(); + }); + $fix.find('table tbody tr:eq(1) button').click(); + return d.promise(); + }) + .always(function () { start(); }) + .then(function () { + strictEqual(l.records.length, 2, + "should have 2 records left"); + strictEqual($fix.find('table tbody tr[data-id]').length, 2, + "should have 2 rows left"); + }, function (e) { + ok(false, e && e.message || e); + }); + }); +}); diff --git a/addons/web/static/test/test.html b/addons/web/static/test/test.html index 185125659cc..275db0f37a7 100644 --- a/addons/web/static/test/test.html +++ b/addons/web/static/test/test.html @@ -58,5 +58,6 @@ +