bzr revid: ahu@openerp.com-20111214152544-qmfkzaqubwsafwzy
This commit is contained in:
Antoine Huvelle 2011-12-14 16:25:44 +01:00
commit 9b1f2d686e
9 changed files with 95 additions and 53 deletions

View File

@ -727,11 +727,9 @@ label.error {
padding: 10px 0 10px 0;
vertical-align:middle;
}
.openerp .oe_search-view-custom-filter-btn span {
background: url(/web/static/src/img/icons/gtk-add.png) repeat-y;
padding-left: 18px;
.openerp .oe_search-view-filters-management {
float: right;
}
.openerp .oe_search-view-filters-management, .openerp .oe_search-view-custom-filter-btn {
float:right;
}
@ -1192,7 +1190,11 @@ label.error {
.openerp .oe_forms select{
padding-top: 2px;
}
.openerp .oe_forms input[disabled],
.openerp .oe_forms select[disabled],
.openerp .oe_forms textarea[disabled]{
background: #E0E0E0;
}
.openerp .oe_forms textarea {
resize:vertical;
}

View File

@ -916,6 +916,8 @@ openerp.web.Menu = openerp.web.Widget.extend(/** @lends openerp.web.Menu# */{
if (!(this.folded && manual)) {
this.do_show_secondary($sub_menu, $main_menu);
} else {
this.do_show_secondary();
}
if ($main_menu != $clicked_menu) {
@ -941,8 +943,15 @@ openerp.web.Menu = openerp.web.Widget.extend(/** @lends openerp.web.Menu# */{
}
return false;
},
do_hide_secondary: function() {
this.$secondary_menu.hide();
},
do_show_secondary: function($sub_menu, $main_menu) {
var self = this;
this.$secondary_menu.show();
if (!arguments.length) {
return;
}
if (this.folded) {
var css = $main_menu.position(),
fold_width = this.$secondary_menu.width() + 2,

View File

@ -155,6 +155,7 @@ openerp.web.SearchView = openerp.web.Widget.extend(/** @lends openerp.web.Search
var ext = new openerp.web.search.ExtendedSearch(this, this.model);
lines.push([ext]);
this.inputs.push(ext);
this.extended_search = ext;
var render = QWeb.render("SearchView", {
'view': data.fields_view['arch'],
@ -163,7 +164,6 @@ openerp.web.SearchView = openerp.web.Widget.extend(/** @lends openerp.web.Search
});
this.$element.html(render);
this.$element.find(".oe_search-view-custom-filter-btn").click(ext.on_activate);
var f = this.$element.find('form');
this.$element.find('form')
@ -199,6 +199,9 @@ openerp.web.SearchView = openerp.web.Widget.extend(/** @lends openerp.web.Search
var select = this.$element.find(".oe_search-view-filters-management");
var val = select.val();
switch(val) {
case 'advanced_filter':
this.extended_search.on_activate();
break;
case 'add_to_dashboard':
this.on_add_to_dashboard();
break;

View File

@ -619,8 +619,8 @@ openerp.web.form.SidebarAttachments = openerp.web.Widget.extend({
var $e = $(e.target);
if ($e.val() != '') {
this.$element.find('form.oe-binary-form').submit();
$e.parent().find('input[type=file]').attr('disabled', 'true');
$e.parent().find('button').attr('disabled', 'true').find('img, span').toggle();
$e.parent().find('input[type=file]').prop('disabled', true);
$e.parent().find('button').prop('disabled', true).find('img, span').toggle();
}
},
on_attachment_delete: function(e) {
@ -1094,13 +1094,9 @@ openerp.web.form.WidgetButton = openerp.web.form.Widget.extend({
this.check_disable();
},
check_disable: function() {
if (this.readonly || this.force_disabled || !this.view.is_interactible_record()) {
this.$element.find("button").attr("disabled", "disabled");
this.$element.find("button").css("color", "grey");
} else {
this.$element.find("button").removeAttr("disabled");
this.$element.find("button").css("color", "");
}
var disabled = (this.readonly || this.force_disabled || !this.view.is_interactible_record());
this.$element.find('button').prop('disabled', disabled);
this.$element.find("button").css('color', disabled ? 'grey' : '');
}
});
@ -1268,7 +1264,7 @@ openerp.web.form.FieldChar = openerp.web.form.Field.extend({
},
update_dom: function() {
this._super.apply(this, arguments);
this.$element.find('input').attr('disabled', this.readonly);
this.$element.find('input').prop('disabled', this.readonly);
},
set_value_from_ui: function() {
this.value = openerp.web.parse_value(this.$element.find('input').val(), this);
@ -1392,7 +1388,7 @@ openerp.web.DateTimeWidget = openerp.web.Widget.extend({
},
set_readonly: function(readonly) {
this.readonly = readonly;
this.$input.attr('disabled', this.readonly);
this.$input.prop('disabled', this.readonly);
this.$element.find('img.oe_datepicker_trigger').toggleClass('oe_input_icon_disabled', readonly);
},
is_valid: function(required) {
@ -1479,7 +1475,7 @@ openerp.web.form.FieldText = openerp.web.form.Field.extend({
},
update_dom: function() {
this._super.apply(this, arguments);
this.$element.find('textarea').attr('disabled', this.readonly);
this.$element.find('textarea').prop('disabled', this.readonly);
},
set_value_from_ui: function() {
this.value = openerp.web.parse_value(this.$element.find('textarea').val(), this);
@ -1516,7 +1512,7 @@ openerp.web.form.FieldBoolean = openerp.web.form.Field.extend({
},
update_dom: function() {
this._super.apply(this, arguments);
this.$element.find('input').attr('disabled', this.readonly);
this.$element.find('input').prop('disabled', this.readonly);
},
focus: function() {
this.$element.find('input').focus();
@ -1599,7 +1595,7 @@ openerp.web.form.FieldSelection = openerp.web.form.Field.extend({
},
update_dom: function() {
this._super.apply(this, arguments);
this.$element.find('select').attr('disabled', this.readonly);
this.$element.find('select').prop('disabled', this.readonly);
},
validate: function() {
var value = this.values[this.$element.find('select')[0].selectedIndex];
@ -1948,7 +1944,7 @@ openerp.web.form.FieldMany2One = openerp.web.form.Field.extend({
},
update_dom: function() {
this._super.apply(this, arguments);
this.$input.attr('disabled', this.readonly);
this.$input.prop('disabled', this.readonly);
}
});
@ -2905,7 +2901,7 @@ openerp.web.form.FieldBinaryFile = openerp.web.form.FieldBinary.extend({
update_dom: function() {
this._super.apply(this, arguments);
this.$element.find('.oe-binary-file-set, .oe-binary-file-clear').toggle(!this.readonly);
this.$element.find('input[type=text]').attr('disabled', this.readonly);
this.$element.find('input[type=text]').prop('disabled', this.readonly);
},
set_value: function(value) {
this._super.apply(this, arguments);

View File

@ -79,6 +79,7 @@ openerp.web.ListView = openerp.web.View.extend( /** @lends openerp.web.ListView#
self.compute_aggregates();
});
this.no_leaf = false;
},
/**
* Retrieves the view's number of records per page (|| section)
@ -473,6 +474,7 @@ openerp.web.ListView = openerp.web.View.extend( /** @lends openerp.web.ListView#
if (_.isEmpty(group_by) && !context['group_by_no_leaf']) {
group_by = null;
}
this.no_leaf = !!context['group_by_no_leaf'];
this.reload_view(!!group_by, context).then(
$.proxy(this, 'reload_content'));

View File

@ -102,9 +102,10 @@ openerp.web.page = function (openerp) {
this._super(s[2]);
}
});
openerp.web.page.FieldBooleanReadonly = openerp.web.page.FieldCharReadonly.extend({
set_value: function (value) {
this._super(value ? '\u2611' : '\u2610');
openerp.web.page.FieldBooleanReadonly = openerp.web.form.FieldBoolean.extend({
update_dom: function() {
this._super.apply(this, arguments);
this.$element.find('input').prop('disabled', true);
}
});
openerp.web.page.FieldSelectionReadonly = openerp.web.page.FieldReadonly.extend({

View File

@ -481,6 +481,10 @@
</t>
<t t-extend="ViewManager" t-name="One2Many.viewmanager">
<t t-jquery="span.oe_view_title_text" t-operation="replace"/>
<t t-jquery=".oe-view-manager-header">
this.attr('t-if', 'views.length != 1');
</t>
</t>
<t t-name="Sidebar">
@ -567,7 +571,7 @@
<th t-att-colspan="columns_count">
<table>
<tr>
<td t-if="options.action_buttons !== false" class="oe-actions">
<td t-if="!no_leaf and options.action_buttons !== false" class="oe-actions">
<button type="button" class="oe-list-add"
t-if="options.addable">
<t t-esc="options.addable"/>
@ -617,6 +621,9 @@
<t t-jquery="thead.ui-widget-header > tr:first">
this.removeAttr('t-if');
</t>
<t t-jquery="tfoot &gt; tr:last-child" t-operation="replace"/>
<t t-jquery="td.oe-actions">
this.removeAttr('t-if');
var $title = $(document.createElement('h3')).addClass('oe_view_title');
@ -625,7 +632,7 @@
this.prepend($title);
</t>
</t>
<th t-name="Listview.navigation.button" t-if="options.pager !== false"
<th t-name="Listview.navigation.button" t-if="!no_leaf and options.pager !== false"
class="oe-list-pager" t-att-colspan="columns_count">
<button type="button" disabled="disabled"
data-pager-action="first"></button>
@ -1146,7 +1153,6 @@
<div class="oe_search-view-buttons">
<button>Search</button>
<button type="reset">Clear</button>
<button type="button" class="oe_search-view-custom-filter-btn"><span>Advanced Filter</span></button>
<select class="oe_search-view-filters-management">
</select>
</div>
@ -1160,6 +1166,7 @@
</t>
</optgroup>
<optgroup label="-- Actions --">
<option value="advanced_filter">Advanced Filter</option>
<option value="save_filter">Save Filter</option>
<option value="add_to_dashboard">Add to Dashboard</option>
<option value="manage_filters">Manage Filters</option>

View File

@ -149,10 +149,11 @@ openerp.web.form.DashBoard = openerp.web.form.Widget.extend({
view_mode = action_attrs.view_mode;
if (action_attrs.context) {
action.context = action_attrs.context;
action.context = _.extend((action.context || {}), action_attrs.context);
}
if (action_attrs.domain) {
action.domain = action_attrs.domain;
action.domain = action.domain || [];
action.domain.unshift.apply(action.domain, action_attrs.domain);
}
var action_orig = _.extend({ flags : {} }, action);
@ -397,8 +398,8 @@ openerp.web_dashboard.ApplicationTiles = openerp.web.Widget.extend({
this._super(parent);
},
start: function() {
// TODO menu hide
var self = this;
openerp.webclient.menu.do_hide_secondary();
var domain = [['application','=',true], ['state','=','installed'], ['name', '!=', 'base']];
var ds = new openerp.web.DataSetSearch(this, 'ir.module.module',{},domain);
ds.read_slice(['id'], {}, function(result) {

View File

@ -177,19 +177,20 @@ openerp.web_graph.GraphView = openerp.web.View.extend({
graph_data = _(graph_data).sortBy(function (point) {
return point[self.abscissa] + '[[--]]' + point[self.group_field];
});
if (this.chart == 'bar') {
return this.schedule_bar(graph_data);
if (this.chart == 'bar' || 'line' || 'area') {
return this.schedule_bar_line_area(graph_data);
} else if (this.chart == "pie") {
return this.schedule_pie(graph_data);
}
},
schedule_bar: function(results) {
schedule_bar_line_area: function(results) {
var self = this;
var group_list, view_chart;
var group_list,
view_chart = (self.chart == 'line')?'line':(self.chart == 'area')?'area':'';
if (!this.group_field) {
view_chart = (this.orientation === 'horizontal') ? 'barH' : 'bar';
if (self.chart == 'bar'){
view_chart = (this.orientation === 'horizontal') ? 'barH' : 'bar';
}
group_list = _(this.columns).map(function (column, index) {
return {
group: column.name,
@ -202,7 +203,7 @@ openerp.web_graph.GraphView = openerp.web.View.extend({
// value) and stacked bar charts (basically the same but with the
// columns on top of one another instead of side by side), but it
// does not handle clustered stacked bar charts
if (this.columns.length > 1) {
if (self.chart == 'bar' && (this.columns.length > 1)) {
this.$element.text(
'OpenERP Web does not support combining grouping and '
+ 'multiple columns in graph at this time.');
@ -211,8 +212,10 @@ openerp.web_graph.GraphView = openerp.web.View.extend({
}
// transform series for clustered charts into series for stacked
// charts
view_chart = (this.orientation === 'horizontal')
? 'stackedBarH' : 'stackedBar';
if (self.chart == 'bar'){
view_chart = (this.orientation === 'horizontal')
? 'stackedBarH' : 'stackedBar';
}
group_list = _(results).chain()
.pluck(this.group_field)
.uniq()
@ -253,7 +256,7 @@ openerp.web_graph.GraphView = openerp.web.View.extend({
};
var x_axis, y_axis;
if (self.orientation == 'horizontal') {
if (self.chart == 'bar' && self.orientation == 'horizontal') {
x_axis = ordinate_description;
y_axis = abscissa_description;
} else {
@ -266,11 +269,12 @@ openerp.web_graph.GraphView = openerp.web.View.extend({
return;
}
self.renderer = null;
var bar_chart = new dhtmlXChart({
var charts = new dhtmlXChart({
view: view_chart,
container: self.element_id+"-barchart",
container: self.element_id+"-"+self.chart+"chart",
value:"#"+group_list[0].group+"#",
gradient: "3d",
gradient: (self.chart == "bar") ? "3d" : "light",
alpha: (self.chart == "area") ? 0.6 : 1,
border: false,
width: 1024,
tooltip:{
@ -278,7 +282,15 @@ openerp.web_graph.GraphView = openerp.web.View.extend({
self.abscissa, group_list[0].text, group_list[0].group)
},
radius: 0,
color:group_list[0].color,
color: (self.chart != "line") ? group_list[0].color : "",
item: (self.chart == "line") ? {
borderColor: group_list[0].color,
color: "#000000"
} : "",
line: (self.chart == "line") ? {
color: group_list[0].color,
width: 3
} : "",
origin:0,
xAxis: x_axis,
yAxis: y_axis,
@ -296,23 +308,32 @@ openerp.web_graph.GraphView = openerp.web.View.extend({
}
}
});
for (var m = 1; m<group_list.length;m++){
var column = group_list[m];
if (column.group === self.group_field) { continue; }
bar_chart.addSeries({
charts.addSeries({
value: "#"+column.group+"#",
tooltip:{
template: _.str.sprintf("#%s#, %s=#%s#",
self.abscissa, column.text, column.group)
},
color: column.color
color: (self.chart != "line") ? column.color : "",
item: (self.chart == "line") ? {
borderColor: column.color,
color: "#000000"
} : "",
line: (self.chart == "line") ? {
color: column.color,
width: 3
} : ""
});
}
bar_chart.parse(results, "json");
self.$element.find("#"+self.element_id+"-barchart").height(
self.$element.find("#"+self.element_id+"-barchart").height()+50);
bar_chart.attachEvent("onItemClick", function(id) {
self.open_list_view(bar_chart.get(id));
charts.parse(results, "json");
self.$element.find("#"+self.element_id+"-"+self.chart+"chart").height(
self.$element.find("#"+self.element_id+"-"+self.chart+"chart").height()+50);
charts.attachEvent("onItemClick", function(id) {
self.open_list_view(charts.get(id));
});
};
if (this.renderer) {