diff options
| author | niv-openerp <nicolas.vanhoren@openerp.com> | 2012-10-16 10:40:01 +0200 |
|---|---|---|
| committer | niv-openerp <nicolas.vanhoren@openerp.com> | 2012-10-16 10:40:01 +0200 |
| commit | ebe002fb42b2e1da096d9ab18764099de6ddc8b9 (patch) | |
| tree | c6b888d8dcede6548798e086ed27b516a43d9c3f /addons/web/static/src | |
| parent | 0c1b8b5a4cf0987af967dd206d451d9a95639430 (diff) | |
| parent | 015c07bc6fa145777257a690c2800ba4ee421254 (diff) | |
Merge trunk
bzr revid: nicolas.vanhoren@openerp.com-20121015091656-5x8nxy3116y3q7jd
bzr revid: nicolas.vanhoren@openerp.com-20121016084001-mqzq3blhb78t9e7o
Diffstat (limited to 'addons/web/static/src')
| -rw-r--r-- | addons/web/static/src/css/base.css | 31 | ||||
| -rw-r--r-- | addons/web/static/src/css/base.sass | 12 | ||||
| -rw-r--r-- | addons/web/static/src/js/chrome.js | 15 | ||||
| -rw-r--r-- | addons/web/static/src/js/data.js | 14 | ||||
| -rw-r--r-- | addons/web/static/src/js/formats.js | 2 | ||||
| -rw-r--r-- | addons/web/static/src/js/view_form.js | 31 | ||||
| -rw-r--r-- | addons/web/static/src/js/view_list.js | 2 | ||||
| -rw-r--r-- | addons/web/static/src/js/view_list_editable.js | 20 | ||||
| -rw-r--r-- | addons/web/static/src/js/views.js | 10 |
9 files changed, 76 insertions, 61 deletions
diff --git a/addons/web/static/src/css/base.css b/addons/web/static/src/css/base.css index c8f1567bee9..8925c3a0964 100644 --- a/addons/web/static/src/css/base.css +++ b/addons/web/static/src/css/base.css @@ -25,6 +25,7 @@ display: none !important; } } + .openerp.openerp_webclient_container { height: 100%; position: relative; @@ -1184,7 +1185,7 @@ color: white; padding: 2px 4px; margin: 1px 6px 0 0; - border: 1px solid lightgrey; + border: 1px solid lightGray; text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2); -moz-border-radius: 4px; -webkit-border-radius: 4px; @@ -1209,7 +1210,7 @@ transform: scale(1.1); } .openerp .oe_secondary_submenu .oe_active { - border-top: 1px solid lightgrey; + border-top: 1px solid lightGray; border-bottom: 1px solid #dedede; text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2); -moz-box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2), inset 0 -1px 3px rgba(40, 40, 40, 0.2); @@ -2054,36 +2055,36 @@ width: 400px; padding-bottom: 0; } -.openerp .oe_form header .oe_tags div.oe_chatter { +.openerp .oe_form div.oe_chatter { min-width: 650px; max-width: 860px; margin: 0 auto; padding: 16px 0 48px; } -.openerp .oe_form header .oe_tags div.oe_form_configuration p, .openerp .oe_form header .oe_tags div.oe_form_configuration ul, .openerp .oe_form header .oe_tags div.oe_form_configuration ol { +.openerp .oe_form div.oe_form_configuration p, .openerp .oe_form div.oe_form_configuration ul, .openerp .oe_form div.oe_form_configuration ol { color: #aaaaaa; max-width: 650px; } -.openerp .oe_form header .oe_tags div.oe_form_configuration label { +.openerp .oe_form div.oe_form_configuration label { min-width: 150px; } -.openerp .oe_form header .oe_tags div.oe_form_configuration .oe_form_group_cell_label { +.openerp .oe_form div.oe_form_configuration .oe_form_group_cell_label { padding: 1px 0; } -.openerp .oe_form header .oe_tags div.oe_form_configuration .oe_form_group_cell div div { +.openerp .oe_form div.oe_form_configuration .oe_form_group_cell div div { padding: 1px 0; } -.openerp .oe_form header .oe_tags .oe_subtotal_footer { +.openerp .oe_form .oe_subtotal_footer { width: 1% !important; } -.openerp .oe_form header .oe_tags .oe_subtotal_footer td.oe_form_group_cell { +.openerp .oe_form .oe_subtotal_footer td.oe_form_group_cell { text-align: right; padding: 0 !important; } -.openerp .oe_form header .oe_tags .oe_subtotal_footer td.oe_form_group_cell_label { +.openerp .oe_form .oe_subtotal_footer td.oe_form_group_cell_label { border-right: none; } -.openerp .oe_form header .oe_tags .oe_subtotal_footer .oe_subtotal_footer_separator { +.openerp .oe_form .oe_subtotal_footer .oe_subtotal_footer_separator { width: 108px; border-top: 1px solid #cacaca; margin-top: 4px; @@ -2091,14 +2092,14 @@ font-weight: bold; font-size: 18px; } -.openerp .oe_form header .oe_tags .oe_subtotal_footer label:after { +.openerp .oe_form .oe_subtotal_footer label:after { content: ":"; } -.openerp .oe_form header .oe_tags .oe_subtotal_footer label.oe_subtotal_footer_separator { +.openerp .oe_form .oe_subtotal_footer label.oe_subtotal_footer_separator { font-weight: bold !important; padding: 2px 11px 2px 0px !important; } -.openerp .oe_form header .oe_tags .oe_subtotal_footer label.oe_form_label_help { +.openerp .oe_form .oe_subtotal_footer label.oe_form_label_help { font-weight: normal; } .openerp .oe_form .oe_form_button { @@ -2130,7 +2131,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; diff --git a/addons/web/static/src/css/base.sass b/addons/web/static/src/css/base.sass index 823ced4e24f..a1adfe67e75 100644 --- a/addons/web/static/src/css/base.sass +++ b/addons/web/static/src/css/base.sass @@ -1616,16 +1616,18 @@ $sheet-max-width: 860px ul display: inline-block float: right - .oe_button, + .oe_button margin: 3px 2px 1px &:first-child margin-left: 6px // }}} // FormView.custom tags and classes {{{ - .oe_form header .oe_tags - margin: 5px 0 0 5px - width: 400px - padding-bottom: 0 + .oe_form + header + .oe_tags + margin: 5px 0 0 5px + width: 400px + padding-bottom: 0 div.oe_chatter min-width: 650px max-width: $sheet-max-width diff --git a/addons/web/static/src/js/chrome.js b/addons/web/static/src/js/chrome.js index 2cf7ab4e5f8..a281745faa0 100644 --- a/addons/web/static/src/js/chrome.js +++ b/addons/web/static/src/js/chrome.js @@ -70,7 +70,7 @@ instance.web.Dialog = instance.web.Widget.extend({ autoOpen: false, position: [false, 40], buttons: {}, - beforeClose: function () { self.on_close(); }, + beforeClose: function () { self.trigger("closing") }, resizeStop: this.on_resized }; for (var f in this) { @@ -84,6 +84,7 @@ instance.web.Dialog = instance.web.Widget.extend({ } _.extend(this.dialog_options, options); } + this.on("closing", this, this._closing); }, get_options: function(options) { var self = this, @@ -153,7 +154,7 @@ instance.web.Dialog = instance.web.Widget.extend({ close: function() { this.$el.dialog('close'); }, - on_close: function() { + _closing: function() { if (this.__tmp_dialog_destroying) return; if (this.dialog_options.destroy_on_close) { @@ -879,8 +880,6 @@ instance.web.UserMenu = instance.web.Widget.extend({ }; this.update_promise = this.update_promise.pipe(fct, fct); }, - on_action: function() { - }, on_menu_logout: function() { this.trigger('user_logout'); }, @@ -899,8 +898,7 @@ instance.web.UserMenu = instance.web.Widget.extend({ var $help = $(QWeb.render("UserMenu.about", {version_info: res})); $help.find('a.oe_activate_debug_mode').click(function (e) { e.preventDefault(); - window.location = $.param.querystring( - window.location.href, 'debug'); + window.location = $.param.querystring( window.location.href, 'debug'); }); instance.web.dialog($help, {autoOpen: true, modal: true, width: 507, height: 290, resizable: false, title: _t("About")}); @@ -1039,8 +1037,7 @@ instance.web.WebClient = instance.web.Client.extend({ self.menu.on('menu_click', this, this.on_menu_action); self.user_menu = new instance.web.UserMenu(self); self.user_menu.replace(this.$el.find('.oe_user_menu_placeholder')); - self.user_menu.on('user_logout', self, this.proxy('on_logout')); - self.user_menu.on_action.add(this.proxy('on_menu_action')); + self.user_menu.on('user_logout', self, self.on_logout); self.user_menu.do_update(); self.bind_hashchange(); self.set_title(); @@ -1122,7 +1119,7 @@ instance.web.WebClient = instance.web.Client.extend({ .pipe(function (result) { var action = result; if (options.needaction) { - action.context.search_default_needaction_pending = true; + action.context.search_default_message_unread = true; } return $.when(self.action_manager.do_action(action, null, true)).fail(function() { self.menu.open_menu(options.previous_menu_id); diff --git a/addons/web/static/src/js/data.js b/addons/web/static/src/js/data.js index 8338ce8c7c0..fe7632d0612 100644 --- a/addons/web/static/src/js/data.js +++ b/addons/web/static/src/js/data.js @@ -568,7 +568,7 @@ instance.web.DataSet = instance.web.CallbackEnabled.extend({ */ write: function (id, data, options) { options = options || {}; - return this._model.call('write', [[id], data], {context: this._model.context(options.context)}); + return this._model.call('write', [[id], data], {context: this._model.context(options.context)}).then(this.trigger('dataset_changed', id, data, options)); }, /** * Deletes an existing record from the database @@ -576,8 +576,7 @@ instance.web.DataSet = instance.web.CallbackEnabled.extend({ * @param {Number|String} ids identifier of the record to delete */ unlink: function(ids) { - this.trigger('unlink', ids); - return this._model.call('unlink', [ids], {context: this._model.context()}); + return this._model.call('unlink', [ids], {context: this._model.context()}).then(this.trigger('dataset_changed', ids)); }, /** * Calls an arbitrary RPC method @@ -779,6 +778,7 @@ instance.web.DataSetSearch = instance.web.DataSet.extend({ self.index = self.index <= self.ids.length - 1 ? self.index : (self.ids.length > 0 ? self.ids.length -1 : 0); } + this.trigger("dataset_changed", ids, callback, error_callback); }); }, size: function () { @@ -835,7 +835,7 @@ instance.web.BufferedDataSet = instance.web.DataSetStatic.extend({ } $.extend(cached.values, record.values); if (dirty) - this.on_change(); + this.trigger("dataset_changed", id, data, options); return $.Deferred().resolve(true).promise(); }, unlink: function(ids, callback, error_callback) { @@ -849,7 +849,7 @@ instance.web.BufferedDataSet = instance.web.DataSetStatic.extend({ this.to_write = _.reject(this.to_write, function(x) { return _.include(ids, x.id);}); this.cache = _.reject(this.cache, function(x) { return _.include(ids, x.id);}); this.set_ids(_.without.apply(_, [this.ids].concat(ids))); - this.on_change(); + this.trigger("dataset_changed", ids, callback, error_callback); return $.async_when({result: true}).then(callback); }, reset_ids: function(ids) { @@ -860,8 +860,6 @@ instance.web.BufferedDataSet = instance.web.DataSetStatic.extend({ this.cache = []; this.delete_all = false; }, - on_change: function() { - }, read_ids: function (ids, fields, options) { var self = this; var to_get = []; @@ -948,7 +946,7 @@ instance.web.BufferedDataSet = instance.web.DataSetStatic.extend({ }, alter_ids: function(n_ids) { this._super(n_ids); - this.on_change(); + this.trigger("dataset_changed", n_ids); }, }); instance.web.BufferedDataSet.virtual_id_regex = /^one2many_v_id_.*$/; diff --git a/addons/web/static/src/js/formats.js b/addons/web/static/src/js/formats.js index 3e5e6fecd5e..03b2c5b775d 100644 --- a/addons/web/static/src/js/formats.js +++ b/addons/web/static/src/js/formats.js @@ -135,7 +135,7 @@ instance.web.format_value = function (value, descriptor, value_if_empty) { Math.round((value % 1) * 60)); case 'many2one': // name_get value format - return value[1]; + return value[1] ? value[1].split("\n")[0] : value[1]; case 'one2many': case 'many2many': if (typeof value === 'string') { diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index f16773829ab..82e448d1005 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -689,7 +689,7 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM on_button_save: function() { var self = this; return this.save().then(function(result) { - self.trigger("save"); + self.trigger("save", result); self.to_view_mode(); }); }, @@ -2812,7 +2812,7 @@ instance.web.form.CompletionFieldMixin = { self.build_domain(), new instance.web.CompoundContext(self.build_context(), context || {}) ); - pop.on("select_elements",self,function(element_ids) { + pop.on("elements_selected", self, function(element_ids) { self.add_id(element_ids[0]); self.focus(); }); @@ -3211,7 +3211,7 @@ instance.web.form.FieldOne2Many = instance.web.form.AbstractField.extend({ this.dataset.parent_view = this.view; this.dataset.child_name = this.name; var self = this; - this.dataset.on_change.add_last(function() { + this.dataset.on('dataset_changed', this, function() { self.trigger_on_change(); }); this.set_value([]); @@ -3514,7 +3514,7 @@ instance.web.form.One2ManyViewManager = instance.web.ViewManager.extend({ create_function: function(data) { return self.o2m.dataset.create(data).then(function(r) { self.o2m.dataset.set_ids(self.o2m.dataset.ids.concat([r])); - self.o2m.dataset.on_change(); + self.o2m.dataset.trigger("dataset_changed", r); }); }, write_function: function(id, data, options) { @@ -3531,7 +3531,7 @@ instance.web.form.One2ManyViewManager = instance.web.ViewManager.extend({ form_view_options: {'not_interactible_on_create':true}, readonly: self.o2m.get("effective_readonly") }); - pop.on("select_elements", self, function() { + pop.on("elements_selected", self, function() { self.o2m.reload_current_view(); }); }, @@ -3604,7 +3604,7 @@ instance.web.form.One2ManyListView = instance.web.ListView.extend({ create_function: function(data, callback, error_callback) { return self.o2m.dataset.create(data).then(function(r) { self.o2m.dataset.set_ids(self.o2m.dataset.ids.concat([r])); - self.o2m.dataset.on_change(); + self.o2m.dataset.trigger("dataset_changed", r); }).then(callback, error_callback); }, read_function: function() { @@ -3617,7 +3617,7 @@ instance.web.form.One2ManyListView = instance.web.ListView.extend({ self.o2m.build_domain(), self.o2m.build_context() ); - pop.on("select_elements", self, function() { + pop.on("elements_selected", self, function() { self.o2m.reload_current_view(); }); } @@ -4042,7 +4042,7 @@ instance.web.form.Many2ManyListView = instance.web.ListView.extend(/** @lends in this.m2m_field.build_context() ); var self = this; - pop.on("select_elements", self, function(element_ids) { + pop.on("elements_selected", self, function(element_ids) { _.each(element_ids, function(one_id) { if(! _.detect(self.dataset.ids, function(x) {return x == one_id;})) { self.dataset.set_ids([].concat(self.dataset.ids, [one_id])); @@ -4152,7 +4152,7 @@ instance.web.form.FieldMany2ManyKanban = instance.web.form.AbstractField.extend( new instance.web.CompoundDomain(this.build_domain(), ["!", ["id", "in", this.dataset.ids]]), this.build_context() ); - pop.on("select_elements", self, function(element_ids) { + pop.on("elements_selected", self, function(element_ids) { _.each(element_ids, function(one_id) { if(! _.detect(self.dataset.ids, function(x) {return x == one_id;})) { self.dataset.set_ids([].concat(self.dataset.ids, [one_id])); @@ -4318,9 +4318,8 @@ instance.web.form.AbstractFormPopup = instance.web.Widget.extend({ self.check_exit(true); }, title: this.options.title || "", - buttons: [{text:"tmp"}], }, this.$el).open(); - this.$buttonpane = dialog.$el.dialog("widget").find(".ui-dialog-buttonpane").html(""); + this.$buttonpane = dialog.$buttons; this.start(); }, setup_form_view: function() { @@ -4372,12 +4371,12 @@ instance.web.form.AbstractFormPopup = instance.web.Widget.extend({ self.view_form.do_show(); }); }, - elements_selected: function(element_ids) { - this.trigger("select_elements",element_ids); + select_elements: function(element_ids) { + this.trigger("elements_selected", element_ids); }, check_exit: function(no_destroy) { if (this.created_elements.length > 0) { - this.elements_selected(this.created_elements); + this.select_elements(this.created_elements); this.created_elements = []; } this.destroy(); @@ -4488,7 +4487,7 @@ instance.web.form.SelectCreatePopup = instance.web.form.AbstractFormPopup.extend }); var $sbutton = self.$buttonpane.find(".oe_selectcreatepopup-search-select"); $sbutton.click(function() { - self.elements_selected(self.selected_ids); + self.select_elements(self.selected_ids); self.destroy(); }); }); @@ -4530,7 +4529,7 @@ instance.web.form.SelectCreateListView = instance.web.ListView.extend({ this.popup.new_object(); }, select_record: function(index) { - this.popup.elements_selected([this.dataset.ids[index]]); + this.popup.select_elements([this.dataset.ids[index]]); this.popup.destroy(); }, do_select: function(ids, records) { diff --git a/addons/web/static/src/js/view_list.js b/addons/web/static/src/js/view_list.js index 7457ca5ef67..88ee428fba4 100644 --- a/addons/web/static/src/js/view_list.js +++ b/addons/web/static/src/js/view_list.js @@ -1321,7 +1321,7 @@ instance.web.ListView.Groups = instance.web.Class.extend( /** @lends instance.we } catch (e) { group_label = row_data[group_column.id].value; } - $group_column.text(_.str.sprintf("%s (%d)", + $group_column.html(_.str.sprintf("%s (%d)", group_label, group.length)); if (group.length && group.openable) { diff --git a/addons/web/static/src/js/view_list_editable.js b/addons/web/static/src/js/view_list_editable.js index 4bf61895a09..cd6b018ea0d 100644 --- a/addons/web/static/src/js/view_list_editable.js +++ b/addons/web/static/src/js/view_list_editable.js @@ -201,10 +201,7 @@ openerp.web.list_editable = function (instance) { }, function () { return self.editor.edit(item, function (field_name, field) { var cell = cells[field_name]; - if (!cell || field.get('effective_readonly')) { - // Readonly fields can just remain the list's, - // form's usually don't have backgrounds &al - field.set({invisible: true}); + if (!cell) { return; } @@ -400,6 +397,21 @@ openerp.web.list_editable = function (instance) { }, setup_events: function () { var self = this; + _.each(this.editor.form.fields, function(field, field_name) { + var field; + var setting = false; + var set_invisible = function() { + if (!setting && field.get("effective_readonly")) { + setting = true; + field.set({invisible: true}); + setting = false; + } + }; + field.on("change:effective_readonly", self, set_invisible); + field.on("change:invisible", self, set_invisible); + set_invisible(); + }); + this.editor.$el.on('keyup keydown', function (e) { if (!self.editor.is_editing()) { return; } var key = _($.ui.keyCode).chain() diff --git a/addons/web/static/src/js/views.js b/addons/web/static/src/js/views.js index cb4f440110d..1554d347552 100644 --- a/addons/web/static/src/js/views.js +++ b/addons/web/static/src/js/views.js @@ -176,7 +176,13 @@ instance.web.ActionManager = instance.web.Widget.extend({ state['action'] = this.inner_action.id; } else if (this.inner_action.type == 'ir.actions.client') { state['action'] = this.inner_action.tag; - state = _.extend(this.inner_action.params || {}, state); + var params = {}; + _.each(this.inner_action.params, function(v, k) { + if(_.isString(v) || _.isNumber(v)) { + params[k] = v; + } + }); + state = _.extend(params || {}, state); } } if(!this.dialog) { @@ -291,7 +297,7 @@ instance.web.ActionManager = instance.web.Widget.extend({ dialogClass: executor.klass }); if(on_close) - this.dialog.on_close.add(on_close); + this.dialog.on("closing", null, on_close); } else { this.dialog_widget.destroy(); } |
