[FIX] Display name instead of number in graph of purchase.

bzr revid: jra@tinyerp.com-20120917054124-1q8gt53scpx9zzpp
bzr revid: jra@tinyerp.com-20120917130934-710qntzcvl54112a
This commit is contained in:
Jiten (OpenERP) 2012-09-17 18:39:34 +05:30
commit 130119e1db
6 changed files with 46 additions and 33 deletions

View File

@ -156,30 +156,32 @@ instance.web.Session = instance.web.JsonRPC.extend( /** @lends instance.web.Sess
var to_load = _.difference(result, self.module_list).join(',');
self.module_list = all_modules;
var loaded = $.Deferred().resolve().promise();
if (to_load.length) {
var loaded = self.rpc('/web/webclient/translations', params).then(function(trans) {
instance.web._t.database.set_bundle(trans);
});
var file_list = ["/web/static/lib/datejs/globalization/" + lang.replace("_", "-") + ".js"];
if(to_load.length) {
loaded = $.when(
self.rpc('/web/webclient/csslist', {mods: to_load}, self.do_load_css),
loaded,
self.rpc('/web/webclient/csslist', {mods: to_load}).then(self.do_load_css),
self.rpc('/web/webclient/qweblist', {mods: to_load}).pipe(self.do_load_qweb),
self.rpc('/web/webclient/translations', params).pipe(function(trans) {
instance.web._t.database.set_bundle(trans);
var file_list = ["/web/static/lib/datejs/globalization/" + lang.replace("_", "-") + ".js"];
return self.rpc('/web/webclient/jslist', {mods: to_load}).pipe(function(files) {
return self.do_load_js(file_list.concat(files));
}).then(function () {
if (!Date.CultureInfo.pmDesignator) {
// If no am/pm designator is specified but the openerp
// datetime format uses %i, date.js won't be able to
// correctly format a date. See bug#938497.
Date.CultureInfo.amDesignator = 'AM';
Date.CultureInfo.pmDesignator = 'PM';
}
});
}))
self.rpc('/web/webclient/jslist', {mods: to_load}).then(function(files) {
file_list = file_list.concat(files);
})
);
}
return loaded.then(function() {
return loaded.pipe(function () {
return self.do_load_js(file_list);
}).then(function() {
self.on_modules_loaded();
self.trigger('module_loaded');
if (!Date.CultureInfo.pmDesignator) {
// If no am/pm designator is specified but the openerp
// datetime format uses %i, date.js won't be able to
// correctly format a date. See bug#938497.
Date.CultureInfo.amDesignator = 'AM';
Date.CultureInfo.pmDesignator = 'PM';
}
});
});
},

View File

@ -159,10 +159,11 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM
this.has_been_loaded.resolve();
// Add bounce effect on button 'Edit' when click on readonly page view.
this.$el.find(".oe_form_field,label").on('click', function (e) {
this.$el.find(".oe_form_group_row,.oe_form_field,label").on('click', function (e) {
if(self.get("actual_mode") == "view") {
var $button = self.options.$buttons.find(".oe_form_button_edit");
$button.effect('bounce', {distance: 18, times: 5}, 150)
e.stopPropagation();
}
});

View File

@ -830,6 +830,10 @@ instance.web.ListView = instance.web.View.extend( /** @lends instance.web.ListVi
this.$el.prepend(
$('<div class="oe_view_nocontent">').html(this.options.action.help)
);
var create_nocontent = this.$buttons;
this.$el.find('.oe_view_nocontent').click(function() {
create_nocontent.effect('bounce', {distance: 18, times: 5}, 150);
});
}
});
instance.web.ListView.List = instance.web.Class.extend( /** @lends instance.web.ListView.List# */{
@ -919,8 +923,7 @@ instance.web.ListView.List = instance.web.Class.extend( /** @lends instance.web.
this.records.bind(event, callback);
}, this);
this.$_element = $('<tbody>')
.appendTo(document.body)
this.$current = $('<tbody>')
.delegate('th.oe_list_record_selector', 'click', function (e) {
e.stopPropagation();
var selection = self.get_selection();
@ -1011,11 +1014,6 @@ instance.web.ListView.List = instance.web.Class.extend( /** @lends instance.web.
});
},
render: function () {
var self = this;
if (this.$current) {
this.$current.remove();
}
this.$current = this.$_element.clone(true);
this.$current.empty().append(
QWeb.render('ListView.rows', _.extend({
render_cell: function () {
@ -1051,7 +1049,11 @@ instance.web.ListView.List = instance.web.Class.extend( /** @lends instance.web.
var row = cells.join('');
this.$current
.children('tr:not([data-id])').remove().end()
.append(new Array(count - this.records.length + 1).join(row));
.append(new Array(count - this.records.length + 1).join(row)).click(
function() {
$('button.oe_list_add').effect('bounce', {distance: 18, times: 5}, 150);
}
);
},
/**
* Gets the ids of all currently selected records, if any
@ -1091,7 +1093,6 @@ instance.web.ListView.List = instance.web.Class.extend( /** @lends instance.web.
if (!this.$current) { return; }
this.$current.remove();
this.$current = null;
this.$_element.remove();
},
get_records: function () {
return this.records.map(function (record) {

View File

@ -650,9 +650,11 @@
</table>
<div t-name="ListView.buttons" class="oe_list_buttons">
<t t-if="!widget.no_leaf and widget.options.action_buttons !== false and widget.options.addable and widget.is_action_enabled('create')">
<button type="button" class="oe_button oe_list_add oe_highlight">
<t t-esc="widget.options.addable"/>
</button>
<div name="oe_list_add_div">
<button type="button" class="oe_button oe_list_add oe_highlight">
<t t-esc="widget.options.addable"/>
</button>
</div>
</t>
</div>
<t t-name="ListView.pager">
@ -693,7 +695,7 @@
</td>
</tr>
<t t-extend="ListView.buttons">
<t t-jquery="button.oe_list_add" t-operation="after">
<t t-jquery="div.oe_list_add_div" t-operation="after">
<button class="oe_button oe_list_save oe_highlight"
type="button">Save</button>
<span class="oe_alternative">

View File

@ -53,6 +53,9 @@ class GraphView(View):
if fields[field]['type']=='many2one':
data = data and data[1]
if tick:
if fields[field]['type']=='selection':
d = dict(fields[field]['selection'])
data = d[data]
return ticks.setdefault(data, len(ticks))
return data or 0

View File

@ -427,6 +427,10 @@ instance.web_kanban.KanbanView = instance.web.View.extend({
this.$el.prepend(
$('<div class="oe_view_nocontent">').html(this.options.action.help)
);
var create_nocontent = this.$buttons;
this.$el.find('.oe_view_nocontent').click(function() {
create_nocontent.effect('bounce', {distance: 18, times: 5}, 150);
});
}
});