diff options
| author | Christophe Matthieu <chm@openerp.com> | 2012-10-26 16:04:12 +0200 |
|---|---|---|
| committer | Christophe Matthieu <chm@openerp.com> | 2012-10-26 16:04:12 +0200 |
| commit | 415f519cd86ad5ad7085c5ba6f2cb4bd7c353e01 (patch) | |
| tree | 986f0f842c51b52a4dcb16533b8dd52af5a454d3 /addons/web/static/src | |
| parent | 00bfec86ab5222ee8d46f50e57c3003b9a5d1c72 (diff) | |
| parent | 08db8bbf0f015fd710e1ce79a55fb8faf143f6d5 (diff) | |
[MERGE] from trunk
bzr revid: chm@openerp.com-20121026140412-wfwl9ze4s8pzs9sg
Diffstat (limited to 'addons/web/static/src')
| -rw-r--r-- | addons/web/static/src/css/base.css | 47 | ||||
| -rw-r--r-- | addons/web/static/src/css/base.sass | 31 | ||||
| -rw-r--r-- | addons/web/static/src/js/chrome.js | 1 | ||||
| -rw-r--r-- | addons/web/static/src/js/coresetup.js | 3 | ||||
| -rw-r--r-- | addons/web/static/src/js/view_form.js | 119 | ||||
| -rw-r--r-- | addons/web/static/src/js/view_list.js | 5 | ||||
| -rw-r--r-- | addons/web/static/src/js/views.js | 11 | ||||
| -rw-r--r-- | addons/web/static/src/xml/base.xml | 4 |
8 files changed, 139 insertions, 82 deletions
diff --git a/addons/web/static/src/css/base.css b/addons/web/static/src/css/base.css index 3c1022c6e46..ba6211ccceb 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%; } @@ -44,7 +45,7 @@ text-shadow: 0 1px 1px rgba(255, 255, 255, 0.5); /* http://www.quirksmode.org/dom/inputfile.html * http://stackoverflow.com/questions/2855589/replace-input-type-file-by-an-image - */ + */ */ } .openerp :-moz-placeholder { color: #afafb6 !important; @@ -1325,6 +1326,9 @@ .openerp .oe_view_manager .oe_view_manager_body { height: inherit; } +.openerp .oe_view_manager .oe_view_manager_body .oe_view_manager_view_list { + min-height: 132px; +} .openerp .oe_view_manager .oe_view_manager_view_kanban { height: inherit; } @@ -2928,8 +2932,6 @@ div.ui-widget-overlay { border-radius: 3px; } - - .openerp .oe_fileuploader { display: inline-block; clear: both; @@ -2970,6 +2972,41 @@ div.ui-widget-overlay { font-size: 30px; } -.openerp .oe_fileuploader { - clear: both; + +@media print { + .openerp { + text-shadow: none; + } + .openerp .oe_header_row, .openerp ul.oe_header, .openerp div.oe_mail_thread_action, .openerp .oe_mail_recthread_actions, .openerp .oe_button_box, .openerp .oe_form button, .openerp button.oe_invite, .openerp .oe_form header, .openerp .openerp .oe_notebook > li.ui-state-default { + display: none; + } + .openerp .oe_list_content button, .openerp .oe_list_content input[type=checkbox] { + visibility: hidden; + } + .openerp .tree_header button, .openerp .oe_mail .oe_mail_thread_msg .oe_mail_unread, .openerp .oe_mail_fetch_more, .openerp .oe_m2o_drop_down_button img, .openerp .oe_form_field_one2many_list_row_add { + visibility: hidden; + } + .openerp a.oe_m2o_cm_button, .openerp a.oe_e { + visibility: hidden; + } + .openerp .oe_form .oe_form_field_date img, .openerp .oe_form .oe_form_field_datetime img { + visibility: hidden; + } + .openerp .oe_notebook > li.ui-tabs-selected { + display: block; + } + .openerp .oe_application .oe_form_sheet, .openerp .oe_application .oe_form_sheetbg { + border: 0px !important; + box-shadow: 0px 0px 0px; + } + .openerp .oe_view_manager_current > .oe_view_manager_header { + border: 0px !important; + box-shadow: 0px 0px 0px; + } + .openerp .text-core .text-wrap .text-arrow { + background: none; + } + .openerp .openerp div.oe_mail_wall { + overflow: hidden !important; + } } diff --git a/addons/web/static/src/css/base.sass b/addons/web/static/src/css/base.sass index 1096dd7564d..1f1993ff74d 100644 --- a/addons/web/static/src/css/base.sass +++ b/addons/web/static/src/css/base.sass @@ -1070,6 +1070,8 @@ $sheet-max-width: 860px .oe_view_manager .oe_view_manager_body height: inherit + .oe_view_manager_view_list + min-height: 132px .oe_view_manager_view_kanban height: inherit @@ -2373,5 +2375,34 @@ div.ui-widget-overlay .ui-corner-all @include radius(3px) +@media print + .openerp + .oe_header_row, ul.oe_header, div.oe_mail_thread_action, .oe_mail_recthread_actions, .oe_button_box, .oe_form button, button.oe_invite, .oe_form header, .openerp .oe_notebook > li.ui-state-default + display: none + .oe_list_content + button, input[type=checkbox] + visibility: hidden + .tree_header button, .oe_mail .oe_mail_thread_msg .oe_mail_unread, .oe_mail_fetch_more, .oe_m2o_drop_down_button img, .oe_form_field_one2many_list_row_add + visibility: hidden + a + &.oe_m2o_cm_button, &.oe_e + visibility: hidden + .oe_form + .oe_form_field_date img, .oe_form_field_datetime img + visibility: hidden + .oe_notebook > li.ui-tabs-selected + display: block + .oe_application + .oe_form_sheet, .oe_form_sheetbg + border: 0px !important + box-shadow: 0px 0px 0px + .oe_view_manager_current > .oe_view_manager_header + border: 0px !important + box-shadow: 0px 0px 0px + text-shadow: none + .text-core .text-wrap .text-arrow + background: none + .openerp div.oe_mail_wall + overflow: hidden !important // au BufWritePost,FileWritePost *.sass :!sass --style expanded --line-numbers <afile> > "%:p:r.css" // vim:tabstop=4:shiftwidth=4:softtabstop=4:fdm=marker: diff --git a/addons/web/static/src/js/chrome.js b/addons/web/static/src/js/chrome.js index 3cb4437d1c3..6cf35a14e92 100644 --- a/addons/web/static/src/js/chrome.js +++ b/addons/web/static/src/js/chrome.js @@ -1128,6 +1128,7 @@ instance.web.WebClient = instance.web.Client.extend({ } return $.when(self.action_manager.do_action(action, { clear_breadcrumbs: true, + action_menu_id: self.menu.current_menu, })).fail(function() { self.menu.open_menu(options.previous_menu_id); }); diff --git a/addons/web/static/src/js/coresetup.js b/addons/web/static/src/js/coresetup.js index 1f1112df2f2..220b9b63d5c 100644 --- a/addons/web/static/src/js/coresetup.js +++ b/addons/web/static/src/js/coresetup.js @@ -530,7 +530,8 @@ instance.web.qweb.default_dict['__debug__'] = instance.session.debug; // Which o instance.web.qweb.debug = instance.session.debug; instance.web.qweb.default_dict = { '_' : _, - '_t' : instance.web._t + '_t' : instance.web._t, + 'JSON': JSON, }; instance.web.qweb.preprocess_node = function() { // Note that 'this' is the Qweb Node diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index 79b7a2cba52..2819be453fb 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -1590,37 +1590,6 @@ instance.web.form.DefaultFieldManager = instance.web.Widget.extend({ }, }); -instance.web.form.FormDialog = instance.web.Dialog.extend({ - init: function(parent, options, view_id, dataset) { - this._super(parent, options); - this.dataset = dataset; - this.view_id = view_id; - return this; - }, - start: function() { - var self = this; - this._super(); - this.form = new instance.web.FormView(this, this.dataset, this.view_id, { - pager: false - }); - this.form.appendTo(this.$el); - this.form.on('record_created', self, this.on_form_dialog_saved); - this.form.on('record_saved', this, this.on_form_dialog_saved); - return this; - }, - select_id: function(id) { - if (this.form.dataset.select_id(id)) { - return this.form.do_show(); - } else { - this.do_warn("Could not find id in dataset"); - return $.Deferred().reject(); - } - }, - on_form_dialog_saved: function(r) { - this.close(); - } -}); - instance.web.form.compute_domain = function(expr, fields) { if (! (expr instanceof Array)) return !! expr; @@ -3141,7 +3110,6 @@ instance.web.form.FieldMany2One = instance.web.form.AbstractField.extend(instanc type: 'ir.actions.act_window', res_model: self.field.relation, res_id: self.get("value"), - context: self.build_context(), views: [[false, 'form']], target: 'current' }); @@ -3987,9 +3955,12 @@ instance.web.form.FieldMany2ManyTags = instance.web.form.AbstractField.extend(in }, }); -/* - * TODO niv: clean those deferred stuff, it could be better - */ +/** + widget options: + - reload_on_button: Reload the whole form view if click on a button in a list view. + If you see this options, do not use it, it's basically a dirty hack to make one + precise o2m to behave the way we want. +*/ instance.web.form.FieldMany2Many = instance.web.form.AbstractField.extend({ multi_selection: false, disable_utility_classes: true, @@ -4118,7 +4089,20 @@ instance.web.form.Many2ManyListView = instance.web.ListView.extend(/** @lends in readonly: this.getParent().get("effective_readonly") }); pop.on('write_completed', self, self.reload_content); - } + }, + do_button_action: function(name, id, callback) { + var self = this; + var _sup = _.bind(this._super, this); + if (! this.m2m_field.options.reload_on_button) { + return _sup(name, id, callback); + } else { + return this.m2m_field.view.save().pipe(function() { + return _sup(name, id, function() { + self.m2m_field.view.reload(); + }); + }); + } + }, }); instance.web.form.FieldMany2ManyKanban = instance.web.form.AbstractField.extend(instance.web.form.CompletionFieldMixin, { @@ -4551,6 +4535,10 @@ instance.web.form.SelectCreatePopup = instance.web.form.AbstractFormPopup.extend self.select_elements(self.selected_ids); self.destroy(); }); + var $cbutton = self.$buttonpane.find(".oe_selectcreatepopup-search-create"); + $cbutton.click(function() { + self.new_object(); + }); }); }); this.searchview.appendTo($(".oe_popup_search", self.$el)); @@ -4605,16 +4593,6 @@ instance.web.form.FieldReference = instance.web.form.AbstractField.extend(instan this._super(field_manager, node); this.reference_ready = true; }, - on_nop: function() { - }, - on_selection_changed: function() { - if (this.reference_ready) { - var sel = this.selection.get_value(); - this.m2o.field.relation = sel; - this.m2o.set_value(false); - this.m2o.$el.toggle(sel !== false); - } - }, destroy_content: function() { if (this.fm) { this.fm.destroy(); @@ -4655,33 +4633,38 @@ instance.web.form.FieldReference = instance.web.form.AbstractField.extend(instan .on('focused', null, function () {self.trigger('focused')}) .on('blurred', null, function () {self.trigger('blurred')}); }, - is_false: function() { - return typeof(this.get_value()) !== 'string'; + on_selection_changed: function() { + if (this.reference_ready) { + this.internal_set_value([this.selection.get_value(), false]); + this.render_value(); + } + }, + data_changed: function() { + if (this.reference_ready) { + this.internal_set_value([this.selection.get_value(), this.m2o.get_value()]); + } + }, + set_value: function(val) { + if (val) { + val = val.split(','); + val[0] = val[0] || false; + val[1] = val[0] ? (val[1] ? parseInt(val[1], 10) : val[1]) : false; + } + this._super(val || [false, false]); + }, + get_value: function() { + return this.get('value')[0] && this.get('value')[1] ? (this.get('value')[0] + ',' + this.get('value')[1]) : false; }, render_value: function() { this.reference_ready = false; - var vals = [], sel_val, m2o_val; - if (typeof(this.get('value')) === 'string') { - vals = this.get('value').split(','); - } - sel_val = vals[0] || false; - m2o_val = vals[1] ? parseInt(vals[1], 10) : vals[1]; if (!this.get("effective_readonly")) { - this.selection.set_value(sel_val); + this.selection.set_value(this.get('value')[0]); } - this.m2o.field.relation = sel_val; - this.m2o.set_value(m2o_val); + this.m2o.field.relation = this.get('value')[0]; + this.m2o.set_value(this.get('value')[1]); + this.m2o.$el.toggle(!!this.get('value')[0]); this.reference_ready = true; }, - data_changed: function() { - var model = this.selection.get_value(), - id = this.m2o.get_value(); - if (typeof(model) === 'string' && typeof(id) === 'number') { - this.internal_set_value(model + ',' + id); - } else { - this.internal_set_value(false); - } - }, }); instance.web.form.FieldBinary = instance.web.form.AbstractField.extend(instance.web.form.ReinitializeFieldMixin, { @@ -4750,8 +4733,6 @@ instance.web.form.FieldBinary = instance.web.form.AbstractField.extend(instance. } this.$el.find('.oe_form_binary_progress').hide(); this.$el.find('.oe_form_binary').show(); - - console.log("upload ok"); }, on_file_uploaded_and_valid: function(size, name, content_type, file_base64) { }, @@ -4906,7 +4887,7 @@ instance.web.form.FieldOne2ManyBinaryMultiFiles = instance.web.form.AbstractFiel this.field_manager = field_manager; this.node = node; if(this.field.type != "one2many" || this.field.relation != 'ir.attachment') { - console.log("The type of the field '"+this.field.string+"' must be a one2many field with a relation to 'ir.attachment' model."); + throw "The type of the field '"+this.field.string+"' must be a one2many field with a relation to 'ir.attachment' model."; } this.ds_file = new instance.web.DataSetSearch(this, 'ir.attachment'); this.fileupload_id = _.uniqueId('oe_fileupload_temp'); diff --git a/addons/web/static/src/js/view_list.js b/addons/web/static/src/js/view_list.js index 75bf6c2f586..5546105e901 100644 --- a/addons/web/static/src/js/view_list.js +++ b/addons/web/static/src/js/view_list.js @@ -374,7 +374,10 @@ instance.web.ListView = instance.web.View.extend( /** @lends instance.web.ListVi var total = dataset.size(); var limit = this.limit() || total; - this.$pager.toggle(total !== 0); + if (total == 0) + this.$pager.hide(); + else + this.$pager.css("display", ""); this.$pager.toggleClass('oe_list_pager_single_page', (total <= limit)); var spager = '-'; if (total) { diff --git a/addons/web/static/src/js/views.js b/addons/web/static/src/js/views.js index d373adf514e..ebc7c326724 100644 --- a/addons/web/static/src/js/views.js +++ b/addons/web/static/src/js/views.js @@ -174,6 +174,9 @@ instance.web.ActionManager = instance.web.Widget.extend({ 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') { @@ -241,6 +244,7 @@ instance.web.ActionManager = instance.web.Widget.extend({ clear_breadcrumbs: false, on_reverse_breadcrumb: function() {}, on_close: function() {}, + action_menu_id: null, }); if (_.isString(action) && instance.web.client_actions.contains(action)) { var action_client = { type: "ir.actions.client", tag: action }; @@ -266,6 +270,7 @@ instance.web.ActionManager = instance.web.Widget.extend({ pager : !popup && !inline, display_title : !popup }, action.flags || {}); + action.menu_id = options.action_menu_id; if (!(type in this)) { console.error("Action manager can't handle action of type " + action.type, action); return $.Deferred().reject(); @@ -1276,11 +1281,9 @@ instance.web.View = instance.web.Widget.extend({ }, /** * Switches to a specific view type - * - * @param {String} view view type to switch to */ - do_switch_view: function(view) { - this.trigger('switch_mode',view); + do_switch_view: function() { + this.trigger.apply(this, ['switch_mode'].concat(_.toArray(arguments))); }, /** * Cancels the switch to the current view, switches to the previous one diff --git a/addons/web/static/src/xml/base.xml b/addons/web/static/src/xml/base.xml index 7472b212021..31d7d2afd21 100644 --- a/addons/web/static/src/xml/base.xml +++ b/addons/web/static/src/xml/base.xml @@ -1277,9 +1277,9 @@ <t t-name="SelectCreatePopup.search.buttons"> <t t-if="! widget.options.disable_multiple_selection"> <button type="button" class="oe_button oe_selectcreatepopup-search-select" disabled="disabled">Select</button> - or </t> - <a class="oe_button oe_selectcreatepopup-search-close oe_bold oe_form_button_cancel" href="javascript:void(0)">Cancel</a> + <button type="button" class="oe_button oe_selectcreatepopup-search-create">Create</button> + or <a class="oe_button oe_selectcreatepopup-search-close oe_bold oe_form_button_cancel" href="javascript:void(0)">Cancel</a> </t> <t t-name="AbstractFormPopup.buttons"> <t t-if="! readonly"> |
