diff options
| author | Christophe Simonis <chs@odoo.com> | 2017-02-10 18:41:06 +0100 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2017-02-10 18:41:06 +0100 |
| commit | a282d4ae7f27869a0b828e8562f8efd901e02799 (patch) | |
| tree | 1fa369ee7526a0a7ccee075f0d8232d2f4fac870 /addons/web/static/src | |
| parent | b229e9cb8c1fdc83a1aa5abd51141e32aea59bcd (diff) | |
| parent | be9dfb331f90bd0352728c78e115bc3647f472e9 (diff) | |
[MERGE] forward port branch saas-14 up to be9dfb331f9
Diffstat (limited to 'addons/web/static/src')
| -rw-r--r-- | addons/web/static/src/js/framework/session.js | 5 | ||||
| -rw-r--r-- | addons/web/static/src/js/views/form_relational_widgets.js | 8 | ||||
| -rw-r--r-- | addons/web/static/src/js/views/form_widgets.js | 6 | ||||
| -rw-r--r-- | addons/web/static/src/js/views/list_view.js | 2 | ||||
| -rw-r--r-- | addons/web/static/src/js/views/pivot_view.js | 7 | ||||
| -rw-r--r-- | addons/web/static/src/js/widgets/model_field_selector.js | 39 | ||||
| -rw-r--r-- | addons/web/static/src/less/list_view.less | 6 | ||||
| -rw-r--r-- | addons/web/static/src/less/model_field_selector.less | 2 | ||||
| -rw-r--r-- | addons/web/static/src/xml/base.xml | 9 |
9 files changed, 46 insertions, 38 deletions
diff --git a/addons/web/static/src/js/framework/session.js b/addons/web/static/src/js/framework/session.js index 6af97721926..516436af93c 100644 --- a/addons/web/static/src/js/framework/session.js +++ b/addons/web/static/src/js/framework/session.js @@ -86,8 +86,11 @@ var Session = core.Class.extend(mixins.EventDispatcherMixin, { * Init a session, reloads from cookie, if it exists */ session_init: function () { + var def = this.session_reload(); + if (this.is_frontend) return def; + var self = this; - return this.session_reload().then(function() { + return def.then(function() { var modules = self.module_list.join(','); var deferred = self.load_qweb(modules); if(self.session_is_valid()) { diff --git a/addons/web/static/src/js/views/form_relational_widgets.js b/addons/web/static/src/js/views/form_relational_widgets.js index fc3db6fd1ce..8261329b90d 100644 --- a/addons/web/static/src/js/views/form_relational_widgets.js +++ b/addons/web/static/src/js/views/form_relational_widgets.js @@ -26,7 +26,7 @@ var M2ODialog = Dialog.extend({ title: _.str.sprintf(_t("Create a %s"), parent.string), size: 'medium', buttons: [ - {text: _t('Create'), classes: 'btn-primary', click: function() { + {text: _t('Create'), classes: 'btn-primary', click: function(e) { if (this.$("input").val() !== ''){ this.getParent()._quick_create(this.$("input").val()); this.close(); @@ -997,7 +997,9 @@ var X2ManyListView = ListView.extend({ */ var X2ManyList = ListView.List.extend({ pad_table_to: function (count) { - if (!this.view.is_action_enabled('create') || this.view.x2m.get('effective_readonly')) { + var ftype = this.view.x2m.field.type; + var is_readonly = this.view.x2m.get('effective_readonly'); + if (is_readonly || (ftype === 'one2many' && !this.view.is_action_enabled('create'))) { this._super(count); return; } @@ -1304,7 +1306,7 @@ var Many2ManyListView = X2ManyListView.extend({ context: this.x2m.build_context(), title: _t("Add: ") + this.x2m.string, alternative_form_view: this.x2m.field.views ? this.x2m.field.views.form : undefined, - no_create: this.x2m.options.no_create, + no_create: this.x2m.options.no_create || !this.is_action_enabled('create'), on_selected: function(element_ids) { return self.x2m.data_link_multi(element_ids).then(function() { self.x2m.reload_current_view(); diff --git a/addons/web/static/src/js/views/form_widgets.js b/addons/web/static/src/js/views/form_widgets.js index 31e83d24777..c715d7c3812 100644 --- a/addons/web/static/src/js/views/form_widgets.js +++ b/addons/web/static/src/js/views/form_widgets.js @@ -697,6 +697,12 @@ var FieldBooleanButton = common.AbstractField.extend({ this.string_false = _t("Archived"); this.hover_false = _t("Restore"); break; + case "close": + this.string_true = _t("Active"); + this.string_false = _t("Closed"); + this.hover_true = _t("Close"); + this.hover_false = _t("Open"); + break; default: var terms = typeof this.options["terminology"] === 'string' ? {} : this.options["terminology"]; this.string_true = _t(terms.string_true || "On"); diff --git a/addons/web/static/src/js/views/list_view.js b/addons/web/static/src/js/views/list_view.js index 572fcbff95f..b02c91ed147 100644 --- a/addons/web/static/src/js/views/list_view.js +++ b/addons/web/static/src/js/views/list_view.js @@ -1508,7 +1508,7 @@ ListView.Groups = Class.extend({ // drag and drop enabled if list is not sorted (unless it is sorted by // its sequence field (ASC)), and there is a visible column with // @widget=handle or "sequence" column in the view. - if ((dataset.sort && [seqname, seqname + 'ASC', ''].indexOf(dataset.sort()) === -1) + if ((dataset.sort && [seqname, seqname + ' ASC', ''].indexOf(dataset.sort()) === -1) || !_(this.columns).findWhere({'name': seqname})) { return; } diff --git a/addons/web/static/src/js/views/pivot_view.js b/addons/web/static/src/js/views/pivot_view.js index fc0380c61b9..95e8d13e5ff 100644 --- a/addons/web/static/src/js/views/pivot_view.js +++ b/addons/web/static/src/js/views/pivot_view.js @@ -57,6 +57,7 @@ var PivotView = View.extend({ this.headers = {}; this.cells = {}; this.has_data = false; + this.$buttons = $(); this.last_header_selected = null; this.sorted_column = {}; @@ -199,7 +200,7 @@ var PivotView = View.extend({ this.initial_row_groupby = context.pivot_row_groupby || this.initial_row_groupby; this.initial_col_groupby = context.pivot_col_groupby || this.initial_col_groupby; } - this.main_row.groupbys = group_by.length ? group_by : this.initial_row_groupby.slice(0); + this.main_row.groupbys = group_by.length ? group_by : (context.pivot_row_groupby || this.initial_row_groupby.slice(0)); this.main_col.groupbys = context.pivot_column_groupby || this.initial_col_groupby.slice(0); this.active_measures = context.pivot_measures || this.active_measures; @@ -219,6 +220,10 @@ var PivotView = View.extend({ this.do_push_state({}); return this.data_loaded.done(function () { self.display_table(); + self.$buttons.find('.o_pivot_measures_list li').removeClass('selected'); + self.active_measures.forEach(function (measure) { + self.$buttons.find('li[data-field="' + measure + '"]').addClass('selected'); + }); _super(); }); }, diff --git a/addons/web/static/src/js/widgets/model_field_selector.js b/addons/web/static/src/js/widgets/model_field_selector.js index 6d65108b7dc..99528e3e74e 100644 --- a/addons/web/static/src/js/widgets/model_field_selector.js +++ b/addons/web/static/src/js/widgets/model_field_selector.js @@ -12,32 +12,14 @@ var ModelFieldSelector = Widget.extend({ template: "FieldSelector", events: { // Handle popover opening and closing - "focusin input, .o_field_selector_popover": function (e) { - if (this._hidePopoverTimeout !== undefined) { - clearTimeout(this._hidePopoverTimeout); - this._hidePopoverTimeout = undefined; - return; - } - if (this.$input.is(e.currentTarget)) { - this.showPopover(); - } - }, - "focusout input, .o_field_selector_popover": function () { - if (this._hidePopoverTimeout !== undefined) { - return; - } - this._hidePopoverTimeout = setTimeout((function () { - this.hidePopover(); - this._hidePopoverTimeout = undefined; - }).bind(this), 100); + "focusin": function () { + clearTimeout(this._hidePopoverTimeout); + this.showPopover(); }, - "click .o_field_selector_close": function () { - if (this._hidePopoverTimeout !== undefined) { - clearTimeout(this._hidePopoverTimeout); - this._hidePopoverTimeout = undefined; - } - this.hidePopover(); + "focusout": function () { + this._hidePopoverTimeout = _.defer(this.hidePopover.bind(this)); }, + "click .o_field_selector_close": "hidePopover", // Handle popover field navigation "click .o_field_selector_prev_page": "goToPrevPage", @@ -190,6 +172,7 @@ var ModelFieldSelector = Widget.extend({ }, /// The removeChainNode method removes the last field name at the end of the current field chain. removeChainNode: function () { + this.dirty = true; this.setChain(this.chain.substring(0, this.chain.lastIndexOf("."))); }, /// The validate method toggles the valid status of the widget and display the error message if it @@ -200,16 +183,20 @@ var ModelFieldSelector = Widget.extend({ this.valid = valid; }, /// The showPopover method shows the popover to select the field chain. It prepares the popover pages - /// before actually showing it. + /// before actually showing it. (if already open, does nothing) showPopover: function () { + if (this._isOpen) return; + this._isOpen = true; this._prefill().then((function () { this.displayPage(); this.$popover.removeClass("hidden"); }).bind(this)); }, /// The hidePopover method closes the popover and mark the field as selected. If the field chain changed, - /// it notifies its parents. + /// it notifies its parents. (if not open, does nothing) hidePopover: function () { + if (!this._isOpen) return; + this._isOpen = false; this.$popover.addClass("hidden"); this.isSelected = true; if (this.dirty) { diff --git a/addons/web/static/src/less/list_view.less b/addons/web/static/src/less/list_view.less index 545f6fcafc7..267ee7aa78a 100644 --- a/addons/web/static/src/less/list_view.less +++ b/addons/web/static/src/less/list_view.less @@ -138,6 +138,10 @@ &.o_readonly { visibility: visible; color: transparent; + + > .o_checkbox { + visibility: hidden; + } } } } @@ -158,7 +162,7 @@ max-width: 100%; // Fix a chrome bug where badge would not break on multiple lines } - &.o_readonly { + &.o_readonly:not(.o_checkbox) { background-color: transparent; padding: 5px; } diff --git a/addons/web/static/src/less/model_field_selector.less b/addons/web/static/src/less/model_field_selector.less index 1dc953bf970..539f6fb4507 100644 --- a/addons/web/static/src/less/model_field_selector.less +++ b/addons/web/static/src/less/model_field_selector.less @@ -6,10 +6,10 @@ .o-position-absolute(0, 0, 1px); .o-flex-display(); .o-align-items(center); + cursor: pointer; &::after { .o-caret-down(); - cursor: pointer; } } .o_field_selector_popover { diff --git a/addons/web/static/src/xml/base.xml b/addons/web/static/src/xml/base.xml index 05548db32ad..34d24f925ff 100644 --- a/addons/web/static/src/xml/base.xml +++ b/addons/web/static/src/xml/base.xml @@ -49,15 +49,15 @@ <table class="o_group o_inner_group o_label_nowrap"> <tr> <td class="o_td_label"><label for="old_pwd" class="o_form_label">Old Password</label></td> - <td width="100%"><input type="password" class="o_form_field o_form_input" name="old_pwd" minlength="1" autofocus="autofocus"/></td> + <td width="100%"><input type="password" class="o_form_field o_form_input" name="old_pwd" minlength="1" autofocus="autofocus" autocomplete="current-password"/></td> </tr> <tr> <td class="o_td_label"><label for="new_password" class="o_form_label">New Password</label></td> - <td width="100%"><input type="password" class="o_form_field o_form_input" name="new_password" minlength="1"/></td> + <td width="100%"><input type="password" class="o_form_field o_form_input" name="new_password" minlength="1" autocomplete="new-password"/></td> </tr> <tr> <td class="o_td_label"><label for="confirm_pwd" class="o_form_label">Confirm New Password</label></td> - <td width="100%"><input type="password" class="o_form_field o_form_input" name="confirm_pwd" minlength="1"/></td> + <td width="100%"><input type="password" class="o_form_field o_form_input" name="confirm_pwd" minlength="1" autocomplete="new-password"/></td> </tr> </table> @@ -628,6 +628,7 @@ t-att-tabindex="widget.node.attrs.tabindex" t-att-autofocus="widget.node.attrs.autofocus" t-att-placeholder="widget.node.attrs.placeholder" + t-att-autocomplete="widget.password ? 'new-password' : widget.node.attrs.autocomplete" t-att-maxlength="widget.field.size"/> </t> <t t-name="FormSelection"> @@ -803,7 +804,7 @@ <div t-name="FieldSelector" class="o_field_selector"> <input type="text" t-att-value="widget.chain" t-att-readonly="!(widget.options.debugMode) and 1 or None"/> - <div class="o_field_selector_controls"> + <div class="o_field_selector_controls" tabindex="0"> <i class="fa fa-exclamation-triangle o_field_selector_warning hidden" title="Invalid field chain"/> </div> <div class="o_field_selector_popover hidden" tabindex="0"> |
