[FIX] various listview issues
bzr revid: xmo@openerp.com-20121018150108-althdcxk3jc2bkun
This commit is contained in:
commit
b5be361c55
|
@ -25,7 +25,6 @@
|
|||
display: none !important;
|
||||
}
|
||||
}
|
||||
|
||||
.openerp.openerp_webclient_container {
|
||||
height: 100%;
|
||||
position: relative;
|
||||
|
@ -2562,6 +2561,12 @@
|
|||
.openerp .oe_list.oe_list_editable td.oe_list_record_delete {
|
||||
position: absolute;
|
||||
}
|
||||
.openerp .oe_list.oe_list_editable.oe_editing .oe_edition .oe_list_field_cell:not(.oe_readonly) {
|
||||
color: transparent;
|
||||
}
|
||||
.openerp .oe_list.oe_list_editable.oe_editing .oe_edition .oe_list_field_cell:not(.oe_readonly) * {
|
||||
visibility: hidden;
|
||||
}
|
||||
.openerp .oe_list.oe_list_editable.oe_editing .oe_m2o_drop_down_button {
|
||||
top: 5px;
|
||||
}
|
||||
|
@ -2580,10 +2585,10 @@
|
|||
}
|
||||
.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%;
|
||||
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%;
|
||||
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;
|
||||
|
@ -2592,6 +2597,9 @@
|
|||
min-width: 0 !important;
|
||||
max-width: none !important;
|
||||
}
|
||||
.openerp .oe_list_group_name {
|
||||
white-space: nowrap;
|
||||
}
|
||||
.openerp .oe_form .oe_form_field_many2many > .oe_list .oe_list_pager_single_page {
|
||||
display: none;
|
||||
}
|
||||
|
@ -2651,14 +2659,17 @@
|
|||
background: #eeeeee;
|
||||
vertical-align: top;
|
||||
}
|
||||
.openerp .oe_list_content > thead th {
|
||||
position: relative;
|
||||
}
|
||||
.openerp .oe_list_content td, .openerp .oe_list_content th {
|
||||
padding: 3px 6px;
|
||||
line-height: 18px;
|
||||
}
|
||||
.openerp .oe_list_content th:after {
|
||||
.openerp .oe_list_content th.oe_sortable, .openerp .oe_list_content th.oe_sortable div {
|
||||
cursor: pointer;
|
||||
}
|
||||
.openerp .oe_list_content th.oe_sortable div {
|
||||
position: relative;
|
||||
}
|
||||
.openerp .oe_list_content th.oe_sortable div:after {
|
||||
position: absolute;
|
||||
right: 6px;
|
||||
content: "";
|
||||
|
@ -2668,12 +2679,12 @@
|
|||
border-color: black transparent;
|
||||
visibility: hidden;
|
||||
}
|
||||
.openerp .oe_list_content th.sortup:after {
|
||||
.openerp .oe_list_content th.sortup div:after {
|
||||
visibility: visible;
|
||||
filter: alpha(opacity=60);
|
||||
opacity: 0.6;
|
||||
}
|
||||
.openerp .oe_list_content th.sortdown:after {
|
||||
.openerp .oe_list_content th.sortdown div:after {
|
||||
border-bottom: none;
|
||||
border-left: 4px solid transparent;
|
||||
border-right: 4px solid transparent;
|
||||
|
|
|
@ -2026,6 +2026,10 @@ $sheet-max-width: 860px
|
|||
td.oe_list_record_delete
|
||||
position: absolute
|
||||
.oe_list.oe_list_editable.oe_editing
|
||||
.oe_edition .oe_list_field_cell:not(.oe_readonly)
|
||||
*
|
||||
visibility: hidden
|
||||
color: transparent
|
||||
.oe_m2o_drop_down_button
|
||||
top: 5px
|
||||
.oe_m2o_cm_button
|
||||
|
@ -2040,15 +2044,17 @@ $sheet-max-width: 860px
|
|||
&.oe_form_field_float,&.oe_form_view_integer
|
||||
input
|
||||
text-align: right
|
||||
width: 100%
|
||||
width: 100% !important
|
||||
&.oe_form_field_datetime,&.oe_form_field_date
|
||||
> span
|
||||
width: 100%
|
||||
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
|
||||
// }}}
|
||||
// FormView.many2many {{{
|
||||
.oe_form .oe_form_field_many2many > .oe_list
|
||||
|
@ -2098,12 +2104,14 @@ $sheet-max-width: 860px
|
|||
border-bottom: 2px solid #cacaca
|
||||
background: #eee
|
||||
vertical-align: top
|
||||
th
|
||||
position: relative
|
||||
td, th
|
||||
padding: 3px 6px
|
||||
line-height: 18px
|
||||
th:after
|
||||
th.oe_sortable, th.oe_sortable div
|
||||
cursor: pointer
|
||||
th.oe_sortable div
|
||||
position: relative
|
||||
th.oe_sortable div:after
|
||||
position: absolute
|
||||
right: 6px
|
||||
content: ""
|
||||
|
@ -2112,10 +2120,10 @@ $sheet-max-width: 860px
|
|||
border-style: solid
|
||||
border-color: #000 transparent
|
||||
visibility: hidden
|
||||
th.sortup:after
|
||||
th.sortup div:after
|
||||
visibility: visible
|
||||
@include opacity(0.6)
|
||||
th.sortdown:after
|
||||
th.sortdown div:after
|
||||
border-bottom: none
|
||||
border-left: 4px solid transparent
|
||||
border-right: 4px solid transparent
|
||||
|
|
|
@ -120,6 +120,10 @@ instance.web.Query = instance.web.Class.extend({
|
|||
if (_.isEmpty(grouping)) { return null; }
|
||||
|
||||
var self = this;
|
||||
|
||||
// FIXME: when pyeval is merged
|
||||
var ctx = instance.session.test_eval_contexts(
|
||||
[this._model.context(this._context)]);
|
||||
return this._model.call('read_group', {
|
||||
groupby: grouping,
|
||||
fields: _.uniq(grouping.concat(this._fields || [])),
|
||||
|
@ -130,6 +134,8 @@ instance.web.Query = instance.web.Class.extend({
|
|||
orderby: instance.web.serialize_sort(this._order_by) || false
|
||||
}).pipe(function (results) {
|
||||
return _(results).map(function (result) {
|
||||
// FIX: querygroup initialization
|
||||
_.defaults(result.__context, ctx);
|
||||
return new instance.web.QueryGroup(
|
||||
self._model.name, grouping[0], result);
|
||||
});
|
||||
|
|
|
@ -61,7 +61,7 @@ my.SearchQuery = B.Collection.extend({
|
|||
this.on('change', function (facet) {
|
||||
if(!facet.values.isEmpty()) { return; }
|
||||
|
||||
this.remove(facet);
|
||||
this.remove(facet, {silent: true});
|
||||
}, this);
|
||||
},
|
||||
add: function (values, options) {
|
||||
|
@ -678,45 +678,6 @@ instance.web.SearchView = instance.web.Widget.extend(/** @lends instance.web.Sea
|
|||
self.ready.resolve();
|
||||
});
|
||||
},
|
||||
/**
|
||||
* Handle event when the user make a selection in the filters management select box.
|
||||
*/
|
||||
on_filters_management: function(e) {
|
||||
var self = this;
|
||||
var select = this.$el.find(".oe_search-view-filters-management");
|
||||
var val = select.val();
|
||||
switch(val) {
|
||||
case 'advanced_filter':
|
||||
this.extended_search.on_activate();
|
||||
break;
|
||||
case '':
|
||||
this.do_clear();
|
||||
}
|
||||
if (val.slice(0, 4) == "get:") {
|
||||
val = val.slice(4);
|
||||
val = parseInt(val, 10);
|
||||
var filter = this.managed_filters[val];
|
||||
this.do_clear(false).then(_.bind(function() {
|
||||
select.val('get:' + val);
|
||||
|
||||
var groupbys = [];
|
||||
var group_by = filter.context.group_by;
|
||||
if (group_by) {
|
||||
groupbys = _.map(
|
||||
group_by instanceof Array ? group_by : group_by.split(','),
|
||||
function (el) { return { group_by: el }; });
|
||||
}
|
||||
this.filter_data = {
|
||||
domains: [filter.domain],
|
||||
contexts: [filter.context],
|
||||
groupbys: groupbys
|
||||
};
|
||||
this.do_search();
|
||||
}, this));
|
||||
} else {
|
||||
select.val('');
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Extract search data from the view's facets.
|
||||
*
|
||||
|
@ -775,8 +736,6 @@ instance.web.SearchView = instance.web.Widget.extend(/** @lends instance.web.Sea
|
|||
*
|
||||
* If at least one field failed its validation, triggers
|
||||
* :js:func:`instance.web.SearchView.on_invalid` instead.
|
||||
*
|
||||
* @param e jQuery event object coming from the "Search" button
|
||||
*/
|
||||
do_search: function (_query, options) {
|
||||
if (options && options.preventSearch) {
|
||||
|
|
|
@ -2153,6 +2153,20 @@ instance.web.form.AbstractField = instance.web.form.FormWidget.extend(instance.w
|
|||
self.do_action(r);
|
||||
});
|
||||
},
|
||||
|
||||
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);
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
|
@ -2531,6 +2545,13 @@ instance.web.form.FieldText = instance.web.form.AbstractField.extend(instance.we
|
|||
focus: function($el) {
|
||||
this.$textarea.focus();
|
||||
},
|
||||
set_dimensions: function (height, width) {
|
||||
this._super();
|
||||
this.$textarea.css({
|
||||
width: width,
|
||||
minHeight: height
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
/**
|
||||
|
@ -4058,13 +4079,17 @@ instance.web.form.Many2ManyListView = instance.web.ListView.extend(/** @lends in
|
|||
);
|
||||
var self = this;
|
||||
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]));
|
||||
var reload = false;
|
||||
_(element_ids).each(function (id) {
|
||||
if(! _.detect(self.dataset.ids, function(x) {return x == id;})) {
|
||||
self.dataset.set_ids(self.dataset.ids.concat([id]));
|
||||
self.m2m_field.dataset_changed();
|
||||
self.reload_content();
|
||||
reload = true;
|
||||
}
|
||||
});
|
||||
if (reload) {
|
||||
self.reload_content();
|
||||
}
|
||||
});
|
||||
},
|
||||
do_activate_record: function(index, id) {
|
||||
|
|
|
@ -1232,6 +1232,7 @@ instance.web.ListView.Groups = instance.web.Class.extend( /** @lends instance.we
|
|||
.replaceWith(self.render());
|
||||
});
|
||||
this.$row.children().last()
|
||||
.addClass('oe_list_group_pagination')
|
||||
.append($prev)
|
||||
.append('<span class="oe_list_pager_state"></span>')
|
||||
.append($next);
|
||||
|
@ -1416,10 +1417,12 @@ instance.web.ListView.Groups = instance.web.Class.extend( /** @lends instance.we
|
|||
}))
|
||||
.end()
|
||||
.find('button[data-pager-action=previous]')
|
||||
.attr('disabled', page === 0)
|
||||
.css('visibility',
|
||||
page === 0 ? 'hidden' : '')
|
||||
.end()
|
||||
.find('button[data-pager-action=next]')
|
||||
.attr('disabled', page === pages - 1);
|
||||
.css('visibility',
|
||||
page === pages - 1 ? 'hidden' : '');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -190,10 +190,10 @@ openerp.web.list_editable = function (instance) {
|
|||
this.records.add(record, {
|
||||
at: this.prepends_on_create() ? 0 : null});
|
||||
}
|
||||
var $recordRow = this.groups.get_row_for(record);
|
||||
var cells = this.get_cells_for($recordRow);
|
||||
|
||||
return this.ensure_saved().pipe(function () {
|
||||
var $recordRow = self.groups.get_row_for(record);
|
||||
var cells = self.get_cells_for($recordRow);
|
||||
self.fields_for_resize.splice(0, self.fields_for_resize.length);
|
||||
return self.with_event('edit', {
|
||||
record: record.attributes,
|
||||
|
@ -251,12 +251,10 @@ openerp.web.list_editable = function (instance) {
|
|||
var $cell = $(cell);
|
||||
var position = $cell.position();
|
||||
|
||||
// jquery does not understand !important
|
||||
field.$el.attr('style', 'width: '+$cell.outerWidth()+'px !important');
|
||||
field.set_dimensions($cell.outerHeight(), $cell.outerWidth());
|
||||
field.$el.css({
|
||||
top: position.top,
|
||||
left: position.left,
|
||||
minHeight: $cell.outerHeight()
|
||||
});
|
||||
},
|
||||
/**
|
||||
|
@ -398,7 +396,6 @@ 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")) {
|
||||
|
@ -774,7 +771,7 @@ openerp.web.list_editable = function (instance) {
|
|||
return this._super.apply(this, arguments);
|
||||
}
|
||||
var record_id = $(event.currentTarget).data('id');
|
||||
this.view.start_edition(
|
||||
return this.view.start_edition(
|
||||
record_id ? this.records.get(record_id) : null, {
|
||||
focus_field: $(event.target).data('field')
|
||||
});
|
||||
|
|
|
@ -631,9 +631,9 @@
|
|||
</th>
|
||||
<t t-foreach="columns" t-as="column">
|
||||
<th t-if="!column.meta and column.invisible !== '1'" t-att-data-id="column.id"
|
||||
t-attf-class="oe_list_header_#{column.widget or column.type} #{((options.sortable and column.tag !== 'button') ? 'oe_sortable' : null)}">
|
||||
t-attf-class="oe_list_header_#{column.widget or column.type} #{((options.sortable and column.tag !== 'button') ? 'oe_sortable' : null)}"><div>
|
||||
<t t-if="column.tag !== 'button'"><t t-esc="column.string"/></t>
|
||||
</th>
|
||||
</div></th>
|
||||
</t>
|
||||
<th t-if="options.deletable" class="oe_list_record_delete" width="13px"/>
|
||||
</tr>
|
||||
|
|
|
@ -1044,8 +1044,12 @@ $(document).ready(function () {
|
|||
"second value should be clicked filter");
|
||||
});
|
||||
});
|
||||
asyncTest('click removing from query', 2, function () {
|
||||
asyncTest('click removing from query', 4, function () {
|
||||
var calls = 0;
|
||||
var view = makeSearchView({}, {foo2: true});
|
||||
view.on('search_data', null, function () {
|
||||
++calls;
|
||||
});
|
||||
var $fix = $('#qunit-fixture');
|
||||
view.appendTo($fix)
|
||||
.always(start)
|
||||
|
@ -1054,8 +1058,10 @@ $(document).ready(function () {
|
|||
var $fs = $fix.find('.oe_searchview_filters ul');
|
||||
// sanity check
|
||||
equal(view.query.length, 1, "query should have default facet");
|
||||
strictEqual(calls, 0);
|
||||
$fs.children(':eq(1)').trigger('click');
|
||||
equal(view.query.length, 0, "click should have removed facet");
|
||||
strictEqual(calls, 1, "one search should have been triggered");
|
||||
});
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue