Added semicolons

bzr revid: nicolas.vanhoren@openerp.com-20130725103301-65nld10p1if7k0zt
This commit is contained in:
niv-openerp 2013-07-25 12:33:01 +02:00
parent 42e493e73e
commit c767a0d34c
15 changed files with 94 additions and 93 deletions

View File

@ -5,7 +5,6 @@ module.exports = function(grunt) {
files: ['static/src/**/*.js'], files: ['static/src/**/*.js'],
options: { options: {
sub: true, //[] instead of . sub: true, //[] instead of .
asi: true, //semicolons
evil: true, //eval evil: true, //eval
laxbreak: true, //unsafe line breaks laxbreak: true, //unsafe line breaks
loopfunc: true, // functions in loops loopfunc: true, // functions in loops

View File

@ -438,7 +438,7 @@ instance.web.DatabaseManager = instance.web.Widget.extend({
self.$el.html(QWeb.render("DatabaseManager", { widget : self })); self.$el.html(QWeb.render("DatabaseManager", { widget : self }));
$('.oe_user_menu_placeholder').append(QWeb.render("DatabaseManager.user_menu",{ widget : self })); $('.oe_user_menu_placeholder').append(QWeb.render("DatabaseManager.user_menu",{ widget : self }));
$('.oe_secondary_menus_container').append(QWeb.render("DatabaseManager.menu",{ widget : self })); $('.oe_secondary_menus_container').append(QWeb.render("DatabaseManager.menu",{ widget : self }));
$('ul.oe_secondary_submenu > li:first').addClass('oe_active') $('ul.oe_secondary_submenu > li:first').addClass('oe_active');
$('ul.oe_secondary_submenu > li').bind('click', function (event) { $('ul.oe_secondary_submenu > li').bind('click', function (event) {
var menuitem = $(this); var menuitem = $(this);
menuitem.addClass('oe_active').siblings().removeClass('oe_active'); menuitem.addClass('oe_active').siblings().removeClass('oe_active');
@ -869,7 +869,7 @@ instance.web.ChangePassword = instance.web.Widget.extend({
$button.appendTo(this.getParent().$buttons); $button.appendTo(this.getParent().$buttons);
$button.eq(2).click(function(){ $button.eq(2).click(function(){
self.getParent().close(); self.getParent().close();
}) });
$button.eq(0).click(function(){ $button.eq(0).click(function(){
self.rpc("/web/session/change_password",{ self.rpc("/web/session/change_password",{
'fields': $("form[name=change_password_form]").serializeArray() 'fields': $("form[name=change_password_form]").serializeArray()
@ -881,7 +881,7 @@ instance.web.ChangePassword = instance.web.Widget.extend({
instance.webclient.on_logout(); instance.webclient.on_logout();
} }
}); });
}) });
}, },
display_error: function (error) { display_error: function (error) {
return instance.web.dialog($('<div>'), { return instance.web.dialog($('<div>'), {
@ -892,7 +892,7 @@ instance.web.ChangePassword = instance.web.Widget.extend({
] ]
}).html(error.error); }).html(error.error);
}, },
}) });
instance.web.client_actions.add("change_password", "instance.web.ChangePassword"); instance.web.client_actions.add("change_password", "instance.web.ChangePassword");
instance.web.Menu = instance.web.Widget.extend({ instance.web.Menu = instance.web.Widget.extend({

View File

@ -145,7 +145,7 @@ openerp.web.corelib = function(instance) {
var ret = fn.apply(this, arguments); var ret = fn.apply(this, arguments);
this._super = tmp; this._super = tmp;
return ret; return ret;
} };
})(name, properties[name], prototype[name]); })(name, properties[name], prototype[name]);
} else if (typeof _super[name] === 'function') { } else if (typeof _super[name] === 'function') {
prototype[name] = (function (name, fn) { prototype[name] = (function (name, fn) {
@ -155,7 +155,7 @@ openerp.web.corelib = function(instance) {
var ret = fn.apply(this, arguments); var ret = fn.apply(this, arguments);
this._super = tmp; this._super = tmp;
return ret; return ret;
} };
})(name, properties[name]); })(name, properties[name]);
} }
} }
@ -503,7 +503,7 @@ instance.web.Controller = instance.web.Class.extend(instance.web.PropertiesMixin
return function () { return function () {
var fn = (typeof method === 'string') ? self[method] : method; var fn = (typeof method === 'string') ? self[method] : method;
return fn.apply(self, arguments); return fn.apply(self, arguments);
} };
}, },
/** /**
* Informs the action manager to do an action. This supposes that * Informs the action manager to do an action. This supposes that
@ -883,7 +883,7 @@ instance.web.Registry = instance.web.Class.extend({
contains: function (key) { contains: function (key) {
if (key === undefined) { return false; } if (key === undefined) { return false; }
if (key in this.map) { if (key in this.map) {
return true return true;
} }
if (this.parent) { if (this.parent) {
return this.parent.contains(key); return this.parent.contains(key);
@ -1148,6 +1148,6 @@ instance.web.py_eval = function(expr, context) {
return py.eval(expr, _.extend({}, context || {}, {"true": true, "false": false, "null": null})); return py.eval(expr, _.extend({}, context || {}, {"true": true, "false": false, "null": null}));
}; };
} };
// vim:et fdc=0 fdl=0 foldnestmax=3 fdm=syntax: // vim:et fdc=0 fdl=0 foldnestmax=3 fdm=syntax:

View File

@ -88,7 +88,7 @@ instance.web.Session = instance.web.JsonRPC.extend( /** @lends instance.web.Sess
this.session_id = this.get_cookie('session_id'); this.session_id = this.get_cookie('session_id');
} }
return def.then(function() { return def.then(function() {
return self.rpc("/web/session/get_session_info", {}) return self.rpc("/web/session/get_session_info", {});
}).then(function(result) { }).then(function(result) {
// If immediately follows a login (triggered by trying to restore // If immediately follows a login (triggered by trying to restore
// an invalid session or no session at all), refresh session data // an invalid session or no session at all), refresh session data
@ -343,7 +343,7 @@ instance.web.Session = instance.web.JsonRPC.extend( /** @lends instance.web.Sess
$input = $('<input type="hidden" name="' + key + '">') $input = $('<input type="hidden" name="' + key + '">')
.appendTo($form_data); .appendTo($form_data);
} }
$input.val(value) $input.val(value);
}); });
$form $form
@ -404,7 +404,7 @@ instance.web.Bus = instance.web.Class.extend(instance.web.EventDispatcherMixin,
}); });
}); });
} }
}) });
instance.web.bus = new instance.web.Bus(); instance.web.bus = new instance.web.Bus();
/** OpenERP Translations */ /** OpenERP Translations */
@ -466,12 +466,12 @@ $.fn.getAttributes = function() {
var o = {}; var o = {};
if (this.length) { if (this.length) {
for (var attr, i = 0, attrs = this[0].attributes, l = attrs.length; i < l; i++) { for (var attr, i = 0, attrs = this[0].attributes, l = attrs.length; i < l; i++) {
attr = attrs.item(i) attr = attrs.item(i);
o[attr.nodeName] = attr.nodeValue; o[attr.nodeName] = attr.nodeValue;
} }
} }
return o; return o;
} };
$.fn.openerpClass = function(additionalClass) { $.fn.openerpClass = function(additionalClass) {
// This plugin should be applied on top level elements // This plugin should be applied on top level elements
additionalClass = additionalClass || ''; additionalClass = additionalClass || '';
@ -557,7 +557,7 @@ instance.web._t = new instance.web.TranslationDataBase().build_translation_funct
* @returns {Object} lazy translation object * @returns {Object} lazy translation object
*/ */
instance.web._lt = function (s) { instance.web._lt = function (s) {
return {toString: function () { return instance.web._t(s); }} return {toString: function () { return instance.web._t(s); }};
}; };
instance.web.qweb = new QWeb2.Engine(); instance.web.qweb = new QWeb2.Engine();
instance.web.qweb.debug = instance.session.debug; instance.web.qweb.debug = instance.session.debug;
@ -692,13 +692,13 @@ instance.web.blockUI = function() {
instance.web.Throbber.throbbers.push(throbber); instance.web.Throbber.throbbers.push(throbber);
throbber.appendTo($(".oe_blockui_spin_container")); throbber.appendTo($(".oe_blockui_spin_container"));
return tmp; return tmp;
} };
instance.web.unblockUI = function() { instance.web.unblockUI = function() {
_.each(instance.web.Throbber.throbbers, function(el) { _.each(instance.web.Throbber.throbbers, function(el) {
el.destroy(); el.destroy();
}); });
return $.unblockUI.apply($, arguments); return $.unblockUI.apply($, arguments);
} };
/** /**
* Registry for all the client actions key: tag value: widget * Registry for all the client actions key: tag value: widget

View File

@ -494,7 +494,7 @@ instance.web.DataSet = instance.web.Class.extend(instance.web.PropertiesMixin,
return this._model.call('create', [data], { return this._model.call('create', [data], {
context: this.get_context() context: this.get_context()
}).done(function () { }).done(function () {
self.trigger('dataset_changed', data, options) self.trigger('dataset_changed', data, options);
}); });
}, },
/** /**
@ -514,7 +514,7 @@ instance.web.DataSet = instance.web.Class.extend(instance.web.PropertiesMixin,
return this._model.call('write', [[id], data], { return this._model.call('write', [[id], data], {
context: this.get_context(options.context) context: this.get_context(options.context)
}).done(function () { }).done(function () {
self.trigger('dataset_changed', id, data, options) self.trigger('dataset_changed', id, data, options);
}); });
}, },
/** /**
@ -527,7 +527,7 @@ instance.web.DataSet = instance.web.Class.extend(instance.web.PropertiesMixin,
return this._model.call('unlink', [ids], { return this._model.call('unlink', [ids], {
context: this.get_context() context: this.get_context()
}).done(function () { }).done(function () {
self.trigger('dataset_changed', ids) self.trigger('dataset_changed', ids);
}); });
}, },
/** /**
@ -810,7 +810,7 @@ instance.web.BufferedDataSet = instance.web.DataSetStatic.extend({
var self = this; var self = this;
_.each(ids, function(id) { _.each(ids, function(id) {
if (! _.detect(self.to_create, function(x) { return x.id === id; })) { if (! _.detect(self.to_create, function(x) { return x.id === id; })) {
self.to_delete.push({id: id}) self.to_delete.push({id: id});
} }
}); });
this.to_create = _.reject(this.to_create, function(x) { return _.include(ids, x.id);}); this.to_create = _.reject(this.to_create, function(x) { return _.include(ids, x.id);});
@ -838,7 +838,7 @@ instance.web.BufferedDataSet = instance.web.DataSetStatic.extend({
_.each(fields, function(x) {if (cached.values[x] === undefined) _.each(fields, function(x) {if (cached.values[x] === undefined)
cached.values[x] = created.defaults[x] || false;}); cached.values[x] = created.defaults[x] || false;});
} else { } else {
if (!cached || !_.all(fields, function(x) {return cached.values[x] !== undefined})) if (!cached || !_.all(fields, function(x) {return cached.values[x] !== undefined;}))
to_get.push(id); to_get.push(id);
} }
}); });

View File

@ -71,7 +71,7 @@ instance.web.DataExport = instance.web.Dialog.extend({
opt.replaceChild( opt.replaceChild(
document.createTextNode( document.createTextNode(
_.str.sprintf("%s — %s", format.label, format.error)), _.str.sprintf("%s — %s", format.label, format.error)),
opt.childNodes[0]) opt.childNodes[0]);
} }
$fmts.append(opt); $fmts.append(opt);
}); });

View File

@ -200,7 +200,7 @@ instance.web.format_value = function (value, descriptor, value_if_empty) {
case 'selection': case 'statusbar': case 'selection': case 'statusbar':
// Each choice is [value, label] // Each choice is [value, label]
if(_.isArray(value)) { if(_.isArray(value)) {
value = value[0] value = value[0];
} }
var result = _(descriptor.selection).detect(function (choice) { var result = _(descriptor.selection).detect(function (choice) {
return choice[0] === value; return choice[0] === value;

View File

@ -97,7 +97,7 @@ openerp.web.pyeval = function (instance) {
divmod(n, 365, function (_n1, n) { divmod(n, 365, function (_n1, n) {
n1 = _n1; n1 = _n1;
n0 = n; n0 = n;
}) });
}); });
}); });
}); });
@ -139,7 +139,7 @@ openerp.web.pyeval = function (instance) {
if (microsecond < 0 || microsecond > 999999) { if (microsecond < 0 || microsecond > 999999) {
divmod(microsecond, 1000000, function (carry, ms) { divmod(microsecond, 1000000, function (carry, ms) {
microsecond = ms; microsecond = ms;
second += carry second += carry;
}); });
} }
if (second < 0 || second > 59) { if (second < 0 || second > 59) {
@ -152,13 +152,13 @@ openerp.web.pyeval = function (instance) {
divmod(minute, 60, function (carry, m) { divmod(minute, 60, function (carry, m) {
minute = m; minute = m;
hour += carry; hour += carry;
}) });
} }
if (hour < 0 || hour > 23) { if (hour < 0 || hour > 23) {
divmod(hour, 24, function (carry, h) { divmod(hour, 24, function (carry, h) {
hour = h; hour = h;
day += carry; day += carry;
}) });
} }
// That was easy. Now it gets muddy: the proper range for day // That was easy. Now it gets muddy: the proper range for day
// can't be determined without knowing the correct month and year, // can't be determined without knowing the correct month and year,
@ -170,7 +170,7 @@ openerp.web.pyeval = function (instance) {
divmod(month-1, 12, function (carry, m) { divmod(month-1, 12, function (carry, m) {
month = m + 1; month = m + 1;
year += carry; year += carry;
}) });
} }
// Now only day can be out of bounds (year may also be out of bounds // Now only day can be out of bounds (year may also be out of bounds
// for a datetime object, but we don't care about that here). // for a datetime object, but we don't care about that here).
@ -247,7 +247,7 @@ openerp.web.pyeval = function (instance) {
}); });
divmod(seconds, 24*3600, function (days, seconds) { divmod(seconds, 24*3600, function (days, seconds) {
d += days; d += days;
s += seconds s += seconds;
}); });
// seconds isn't referenced again before redefinition // seconds isn't referenced again before redefinition
@ -358,7 +358,7 @@ openerp.web.pyeval = function (instance) {
return py.float.fromJSON( return py.float.fromJSON(
this.days * 86400 this.days * 86400
+ this.seconds + this.seconds
+ this.microseconds / 1000000) + this.microseconds / 1000000);
}, },
__nonzero__: function () { __nonzero__: function () {
return (!!this.days || !!this.seconds || !!this.microseconds) return (!!this.days || !!this.seconds || !!this.microseconds)
@ -466,7 +466,7 @@ openerp.web.pyeval = function (instance) {
return py.float.fromJSON(ymd2ord(this.year, this.month, this.day)); return py.float.fromJSON(ymd2ord(this.year, this.month, this.day));
}, },
fromJSON: function (year, month, day) { fromJSON: function (year, month, day) {
return py.PY_call(datetime.date, [year, month, day]) return py.PY_call(datetime.date, [year, month, day]);
} }
}); });
/** /**
@ -505,7 +505,7 @@ openerp.web.pyeval = function (instance) {
var args = _.map(('year month day hour minute second microsecond ' var args = _.map(('year month day hour minute second microsecond '
+ 'years months weeks days hours minutes secondes microseconds ' + 'years months weeks days hours minutes secondes microseconds '
+ 'weekday leakdays yearday nlyearday').split(' '), function (arg) { + 'weekday leakdays yearday nlyearday').split(' '), function (arg) {
return [arg, null] return [arg, null];
}); });
args.unshift('*'); args.unshift('*');
var relativedelta = py.type('relativedelta', null, { var relativedelta = py.type('relativedelta', null, {
@ -808,7 +808,7 @@ openerp.web.pyeval = function (instance) {
case 'groupbys': case 'groupbys':
return eval_groupbys(object, context); return eval_groupbys(object, context);
} }
throw new Error("Unknow evaluation type " + type) throw new Error("Unknow evaluation type " + type);
}; };
var eval_arg = function (arg) { var eval_arg = function (arg) {
@ -863,5 +863,5 @@ openerp.web.pyeval = function (instance) {
}}); }});
} }
}, 0); }); }, 0); });
} };
}; };

View File

@ -148,7 +148,7 @@ my.InputView = instance.web.Widget.extend({
range.setStart(root, 0); range.setStart(root, 0);
} }
if (range.endContainer === this.el && range.endOffset === 1) { if (range.endContainer === this.el && range.endOffset === 1) {
range.setEnd(root, root.length) range.setEnd(root, root.length);
} }
assert(range.startContainer === root, assert(range.startContainer === root,
"selection should be in the input view"); "selection should be in the input view");
@ -157,7 +157,7 @@ my.InputView = instance.web.Widget.extend({
return { return {
start: range.startOffset, start: range.startOffset,
end: range.endOffset end: range.endOffset
} };
}, },
onKeydown: function (e) { onKeydown: function (e) {
this.el.normalize(); this.el.normalize();
@ -401,7 +401,7 @@ instance.web.SearchView = instance.web.Widget.extend(/** @lends instance.web.Sea
}); });
$.when(load_view).then(function (r) { $.when(load_view).then(function (r) {
return self.search_view_loaded(r) return self.search_view_loaded(r);
}).fail(function () { }).fail(function () {
self.ready.reject.apply(null, arguments); self.ready.reject.apply(null, arguments);
}); });
@ -950,7 +950,7 @@ instance.web.search.Input = instance.web.search.Widget.extend( /** @lends instan
* @returns {jQuery.Deferred<null|Array>} * @returns {jQuery.Deferred<null|Array>}
*/ */
complete: function (value) { complete: function (value) {
return $.when(null) return $.when(null);
}, },
/** /**
* Returns a Facet instance for the provided defaults if they apply to * Returns a Facet instance for the provided defaults if they apply to
@ -1073,7 +1073,7 @@ instance.web.search.FilterGroup = instance.web.search.Input.extend(/** @lends in
icon: this.icon, icon: this.icon,
values: values, values: values,
field: this field: this
} };
}, },
make_value: function (filter) { make_value: function (filter) {
return { return {
@ -1176,7 +1176,7 @@ instance.web.search.FilterGroup = instance.web.search.Input.extend(/** @lends in
label: _.str.sprintf(self.completion_label.toString(), label: _.str.sprintf(self.completion_label.toString(),
_.escape(facet_value.label)), _.escape(facet_value.label)),
facet: self.make_facet([facet_value]) facet: self.make_facet([facet_value])
} };
})); }));
} }
}); });
@ -1198,7 +1198,7 @@ instance.web.search.GroupbyGroup = instance.web.search.FilterGroup.extend({
get_context: this.proxy('get_context'), get_context: this.proxy('get_context'),
get_domain: this.proxy('get_domain'), get_domain: this.proxy('get_domain'),
get_groupby: this.proxy('get_groupby') get_groupby: this.proxy('get_groupby')
} };
} }
}, },
match_facet: function (facet) { match_facet: function (facet) {
@ -1564,7 +1564,7 @@ instance.web.search.ManyToOneField = instance.web.search.CharField.extend({
return this.model.call('name_get', [value]).then(function (names) { return this.model.call('name_get', [value]).then(function (names) {
if (_(names).isEmpty()) { return null; } if (_(names).isEmpty()) { return null; }
return facet_from(self, names[0]); return facet_from(self, names[0]);
}) });
}, },
value_from: function (facetValue) { value_from: function (facetValue) {
return facetValue.get('label'); return facetValue.get('label');

View File

@ -73,6 +73,6 @@ openerp.test_support = {
return; return;
} }
fn(e.data.name); fn(e.data.name);
}) });
} }
}; };

View File

@ -176,9 +176,9 @@ openerp.testing = {};
}); });
QUnit.module(testing.current_module + '.' + name, {_oe: options}); QUnit.module(testing.current_module + '.' + name, {_oe: options});
body(testing.case); body(testing['case']);
}; };
testing.case = function (name, options, callback) { testing['case'] = function (name, options, callback) {
if (_.isFunction(options)) { if (_.isFunction(options)) {
callback = options; callback = options;
options = {}; options = {};
@ -359,7 +359,7 @@ openerp.testing = {};
return $.Deferred(function (d) { return $.Deferred(function (d) {
$.when(result).then(function () { $.when(result).then(function () {
d.resolve.apply(d, arguments) d.resolve.apply(d, arguments);
}, function () { }, function () {
d.reject.apply(d, arguments); d.reject.apply(d, arguments);
}); });

View File

@ -437,7 +437,7 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM
var method = call[1]; var method = call[1];
if (!_.str.trim(call[2])) { if (!_.str.trim(call[2])) {
return {method: method, args: []} return {method: method, args: []};
} }
var argument_replacement = { var argument_replacement = {
@ -778,7 +778,7 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM
} else { } else {
$.async_when().done(function () { $.async_when().done(function () {
def.reject(); def.reject();
}) });
} }
}); });
return def.promise(); return def.promise();
@ -1028,7 +1028,7 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM
return field.get_displayed(); return field.get_displayed();
} }
return value; return value;
} };
var fields = _.chain(this.fields) var fields = _.chain(this.fields)
.map(function (field) { .map(function (field) {
var value = field.get_value(); var value = field.get_value();
@ -1049,7 +1049,7 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM
string: field.string, string: field.string,
value: value, value: value,
displayed: display(field, value), displayed: display(field, value),
} };
}) })
.compact() .compact()
.sortBy(function (field) { return field.string; }) .sortBy(function (field) { return field.string; })
@ -1063,7 +1063,7 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM
string: field.string, string: field.string,
value: value, value: value,
displayed: display(field, value), displayed: display(field, value),
} };
}) })
.value(); .value();
@ -1429,7 +1429,7 @@ instance.web.form.FormRenderingEngine = instance.web.form.FormRenderingEngineInt
row_cols = cols; row_cols = cols;
} else if (tagName==='group') { } else if (tagName==='group') {
// When <group> <group/><group/> </group>, we need a spacing between the two groups // When <group> <group/><group/> </group>, we need a spacing between the two groups
$td.addClass('oe_group_right') $td.addClass('oe_group_right');
} }
row_cols -= colspan; row_cols -= colspan;
@ -1852,7 +1852,8 @@ instance.web.form.FormWidget = instance.web.Widget.extend(instance.web.form.Invi
return QWeb.render(template, { return QWeb.render(template, {
debug: instance.session.debug, debug: instance.session.debug,
widget: widget widget: widget
})}, });
},
gravity: $.fn.tipsy.autoBounds(50, 'nw'), gravity: $.fn.tipsy.autoBounds(50, 'nw'),
html: true, html: true,
opacity: 0.85, opacity: 0.85,
@ -2073,7 +2074,7 @@ instance.web.form.AbstractField = instance.web.form.FormWidget.extend(instance.w
* @param node * @param node
*/ */
init: function(field_manager, node) { init: function(field_manager, node) {
var self = this var self = this;
this._super(field_manager, node); this._super(field_manager, node);
this.name = this.node.attrs.name; this.name = this.node.attrs.name;
this.field = this.field_manager.get_field_desc(this.name); this.field = this.field_manager.get_field_desc(this.name);
@ -2937,7 +2938,7 @@ instance.web.form.FieldRadio = instance.web.form.AbstractField.extend(instance.w
set_value: function (value_) { set_value: function (value_) {
if (value_) { if (value_) {
if (this.field.type == "selection") { if (this.field.type == "selection") {
value_ = _.find(this.field.selection, function (sel) { return sel[0] == value_}); value_ = _.find(this.field.selection, function (sel) { return sel[0] == value_;});
} }
else if (!this.selection.length) { else if (!this.selection.length) {
this.selection = [value_]; this.selection = [value_];
@ -2954,7 +2955,7 @@ instance.web.form.FieldRadio = instance.web.form.AbstractField.extend(instance.w
this.$el.toggleClass("oe_readonly", this.get('effective_readonly')); this.$el.toggleClass("oe_readonly", this.get('effective_readonly'));
this.$("input:checked").prop("checked", false); this.$("input:checked").prop("checked", false);
if (this.get_value()) { if (this.get_value()) {
this.$("input").filter(function () {return this.value == self.get_value()}).prop("checked", true); this.$("input").filter(function () {return this.value == self.get_value();}).prop("checked", true);
this.$(".oe_radio_readonly").text(this.get('value') ? this.get('value')[1] : ""); this.$(".oe_radio_readonly").text(this.get('value') ? this.get('value')[1] : "");
} }
} }
@ -3090,7 +3091,7 @@ instance.web.form.CompletionFieldMixin = {
self.field.relation, self.field.relation,
{ {
title: (view === 'search' ? _t("Search: ") : _t("Create: ")) + this.string, title: (view === 'search' ? _t("Search: ") : _t("Create: ")) + this.string,
initial_ids: ids ? _.map(ids, function(x) {return x[0]}) : undefined, initial_ids: ids ? _.map(ids, function(x) {return x[0];}) : undefined,
initial_view: view, initial_view: view,
disable_multiple_selection: true disable_multiple_selection: true
}, },
@ -3455,7 +3456,7 @@ instance.web.form.FieldMany2One = instance.web.form.AbstractField.extend(instanc
var self = this; var self = this;
if (value_ instanceof Array) { if (value_ instanceof Array) {
this.display_value = {}; this.display_value = {};
this.display_value_backup = {} this.display_value_backup = {};
if (! this.options.always_reload) { if (! this.options.always_reload) {
this.display_value["" + value_[0]] = value_[1]; this.display_value["" + value_[0]] = value_[1];
} }
@ -3720,7 +3721,7 @@ instance.web.form.FieldOne2Many = instance.web.form.AbstractField.extend({
}); });
controller.on('pager_action_executed',self,self.save_any_view); controller.on('pager_action_executed',self,self.save_any_view);
} else if (view_type == "graph") { } else if (view_type == "graph") {
self.reload_current_view() self.reload_current_view();
} }
def.resolve(); def.resolve();
}); });
@ -3963,7 +3964,7 @@ instance.web.form.One2ManyListView = instance.web.ListView.extend({
var form = editor.form; var form = editor.form;
// If no edition is pending, the listview can not be invalid (?) // If no edition is pending, the listview can not be invalid (?)
if (!editor.record) { if (!editor.record) {
return true return true;
} }
// If the form has not been modified, the view can only be valid // If the form has not been modified, the view can only be valid
// NB: is_dirty will also be set on defaults/onchanges/whatever? // NB: is_dirty will also be set on defaults/onchanges/whatever?
@ -4168,7 +4169,7 @@ instance.web.form.One2ManyList = instance.web.ListView.List.extend({
if ($padding.length) { if ($padding.length) {
$padding.before($newrow); $padding.before($newrow);
} else { } else {
this.$current.append($newrow) this.$current.append($newrow);
} }
} }
}); });
@ -5022,8 +5023,8 @@ instance.web.form.FieldReference = instance.web.form.AbstractField.extend(instan
this.selection.on("change:value", this, this.on_selection_changed); this.selection.on("change:value", this, this.on_selection_changed);
this.selection.appendTo(this.$(".oe_form_view_reference_selection")); this.selection.appendTo(this.$(".oe_form_view_reference_selection"));
this.selection this.selection
.on('focused', null, function () {self.trigger('focused')}) .on('focused', null, function () {self.trigger('focused');})
.on('blurred', null, function () {self.trigger('blurred')}); .on('blurred', null, function () {self.trigger('blurred');});
this.m2o = new instance.web.form.FieldMany2One(fm, { attrs: { this.m2o = new instance.web.form.FieldMany2One(fm, { attrs: {
name: 'm2o', name: 'm2o',
@ -5032,8 +5033,8 @@ instance.web.form.FieldReference = instance.web.form.AbstractField.extend(instan
this.m2o.on("change:value", this, this.data_changed); this.m2o.on("change:value", this, this.data_changed);
this.m2o.appendTo(this.$(".oe_form_view_reference_m2o")); this.m2o.appendTo(this.$(".oe_form_view_reference_m2o"));
this.m2o this.m2o
.on('focused', null, function () {self.trigger('focused')}) .on('focused', null, function () {self.trigger('focused');})
.on('blurred', null, function () {self.trigger('blurred')}); .on('blurred', null, function () {self.trigger('blurred');});
}, },
on_selection_changed: function() { on_selection_changed: function() {
if (this.reference_ready) { if (this.reference_ready) {
@ -5203,7 +5204,7 @@ instance.web.form.FieldBinaryFile = instance.web.form.FieldBinary.extend({
} else { } else {
this.$el.find('a').toggle(!!this.get('value')); this.$el.find('a').toggle(!!this.get('value'));
if (this.get('value')) { if (this.get('value')) {
show_value = _t("Download") show_value = _t("Download");
if (this.view) if (this.view)
show_value += " " + (this.view.datarecord[this.node.attrs.filename] || ''); show_value += " " + (this.view.datarecord[this.node.attrs.filename] || '');
this.$el.find('a').text(show_value); this.$el.find('a').text(show_value);
@ -5422,7 +5423,7 @@ instance.web.form.FieldMany2ManyBinaryMultiFiles = instance.web.form.AbstractFie
values.push(result.id); values.push(result.id);
this.set({'value': values}); this.set({'value': values});
} }
this.render_value() this.render_value();
}, },
on_file_delete: function (event) { on_file_delete: function (event) {
event.stopPropagation(); event.stopPropagation();
@ -5476,7 +5477,7 @@ instance.web.form.FieldStatus = instance.web.form.AbstractField.extend({
var self = this; var self = this;
var content = QWeb.render("FieldStatus.content", { var content = QWeb.render("FieldStatus.content", {
'widget': self, 'widget': self,
'value_folded': _.find(self.selection.folded, function(i){return i[0] === self.get('value')}) 'value_folded': _.find(self.selection.folded, function(i){return i[0] === self.get('value');})
}); });
self.$el.html(content); self.$el.html(content);
}, },
@ -5508,7 +5509,7 @@ instance.web.form.FieldStatus = instance.web.form.AbstractField.extend({
return new instance.web.DataSetSearch(self, self.field.relation, self.build_context(), self.get("evaluated_selection_domain")) return new instance.web.DataSetSearch(self, self.field.relation, self.build_context(), self.get("evaluated_selection_domain"))
.read_slice(fields.fold ? ['fold'] : ['id'], {}).then(function (records) { .read_slice(fields.fold ? ['fold'] : ['id'], {}).then(function (records) {
var ids = _.map(records, function (val) {return val.id}); var ids = _.map(records, function (val) {return val.id;});
return self.dataset.name_get(ids).then(function (records_name) { return self.dataset.name_get(ids).then(function (records_name) {
_.each(records, function (record) { _.each(records, function (record) {
var name = _.find(records_name, function (val) {return val[0] == record.id;})[1]; var name = _.find(records_name, function (val) {return val[0] == record.id;})[1];
@ -5518,7 +5519,7 @@ instance.web.form.FieldStatus = instance.web.form.AbstractField.extend({
selection_unfolded.push([record.id, name]); selection_unfolded.push([record.id, name]);
} }
}); });
}) });
}); });
}); });
} else { } else {
@ -5550,7 +5551,7 @@ instance.web.form.FieldStatus = instance.web.form.AbstractField.extend({
return new instance.web.Model(self.field.relation).call("fields_get", [["fold"]]).then(function(fields) { return new instance.web.Model(self.field.relation).call("fields_get", [["fold"]]).then(function(fields) {
self.distant_fields = fields; self.distant_fields = fields;
return fields; return fields;
}) });
}, },
on_click_stage: function (ev) { on_click_stage: function (ev) {
var self = this; var self = this;

View File

@ -363,7 +363,7 @@ instance.web.ListView = instance.web.View.extend( /** @lends instance.web.ListVi
sort_by_column: function (e) { sort_by_column: function (e) {
e.stopPropagation(); e.stopPropagation();
var $column = $(e.currentTarget); var $column = $(e.currentTarget);
var col_name = $column.data('id') var col_name = $column.data('id');
var field = this.fields_view.fields[col_name]; var field = this.fields_view.fields[col_name];
// test if the field is a function field with store=false, since it's impossible // test if the field is a function field with store=false, since it's impossible
// for the server to sort those fields we desactivate the feature // for the server to sort those fields we desactivate the feature
@ -1430,7 +1430,7 @@ instance.web.ListView.Groups = instance.web.Class.extend( /** @lends instance.we
d = new $.Deferred(), d = new $.Deferred(),
page = this.datagroup.openable ? this.page : view.page; page = this.datagroup.openable ? this.page : view.page;
var fields = _.pluck(_.select(this.columns, function(x) {return x.tag == "field"}), 'name'); var fields = _.pluck(_.select(this.columns, function(x) {return x.tag == "field";}), 'name');
var options = { offset: page * limit, limit: limit, context: {bin_size: true} }; var options = { offset: page * limit, limit: limit, context: {bin_size: true} };
//TODO xmo: investigate why we need to put the setTimeout //TODO xmo: investigate why we need to put the setTimeout
$.async_when().done(function() { $.async_when().done(function() {
@ -1545,7 +1545,7 @@ instance.web.ListView.Groups = instance.web.Class.extend( /** @lends instance.we
this.datagroup.list( this.datagroup.list(
_(this.view.visible_columns).chain() _(this.view.visible_columns).chain()
.filter(function (column) { return column.tag === 'field' }) .filter(function (column) { return column.tag === 'field';})
.pluck('name').value(), .pluck('name').value(),
function (groups) { function (groups) {
$el[0].appendChild( $el[0].appendChild(
@ -1590,7 +1590,7 @@ instance.web.ListView.Groups = instance.web.Class.extend( /** @lends instance.we
return { return {
count: this.datagroup.length, count: this.datagroup.length,
values: this.datagroup.aggregates values: this.datagroup.aggregates
} };
} }
return _(this.children).chain() return _(this.children).chain()
.map(function (child) { .map(function (child) {
@ -1958,7 +1958,7 @@ var Collection = instance.web.Class.extend(/** @lends Collection# */{
var record; var record;
for(var section in this._proxies) { for(var section in this._proxies) {
if (!this._proxies.hasOwnProperty(section)) { if (!this._proxies.hasOwnProperty(section)) {
continue continue;
} }
if ((record = this._proxies[section].find(callback))) { if ((record = this._proxies[section].find(callback))) {
return record; return record;
@ -2075,7 +2075,7 @@ instance.web.list.columns.for_ = function (id, field, node) {
tag + '.'+ description.type, tag + '.'+ description.type,
tag tag
]); ]);
return new Type(id, node.tag, description) return new Type(id, node.tag, description);
}; };
instance.web.list.Column = instance.web.Class.extend({ instance.web.list.Column = instance.web.Class.extend({
@ -2238,7 +2238,7 @@ instance.web.list.Char = instance.web.list.Column.extend({
_format: function (row_data, options) { _format: function (row_data, options) {
var value = row_data[this.id].value; var value = row_data[this.id].value;
if (value && this.password === 'True') { if (value && this.password === 'True') {
return value.replace(/[\s\S]/g, _.escape(this.replacement)) return value.replace(/[\s\S]/g, _.escape(this.replacement));
} }
return this._super(row_data, options); return this._super(row_data, options);
} }

View File

@ -202,7 +202,7 @@ openerp.web.list_editable = function (instance) {
make_empty_record: function (id) { make_empty_record: function (id) {
var attrs = {id: id}; var attrs = {id: id};
_(this.columns).chain() _(this.columns).chain()
.filter(function (x) { return x.tag === 'field'}) .filter(function (x) { return x.tag === 'field';})
.pluck('name') .pluck('name')
.each(function (field) { attrs[field] = false; }); .each(function (field) { attrs[field] = false; });
return new instance.web.list.Record(attrs); return new instance.web.list.Record(attrs);
@ -260,7 +260,7 @@ openerp.web.list_editable = function (instance) {
get_cells_for: function ($row) { get_cells_for: function ($row) {
var cells = {}; var cells = {};
$row.children('td').each(function (index, el) { $row.children('td').each(function (index, el) {
cells[el.getAttribute('data-field')] = el cells[el.getAttribute('data-field')] = el;
}); });
return cells; return cells;
}, },
@ -346,7 +346,7 @@ openerp.web.list_editable = function (instance) {
var record = self.records.get(attrs.id); var record = self.records.get(attrs.id);
if (!record) { if (!record) {
// Record removed by third party during edition // Record removed by third party during edition
return return;
} }
return self.reload_record(record); return self.reload_record(record);
} }
@ -691,7 +691,7 @@ openerp.web.list_editable = function (instance) {
var arch = edition_view.arch; var arch = edition_view.arch;
if (!(arch && arch.children instanceof Array)) { if (!(arch && arch.children instanceof Array)) {
throw new Error("Editor delegate's #edition_view must have a" + throw new Error("Editor delegate's #edition_view must have a" +
" non-empty arch") " non-empty arch");
} }
if (arch.tag !== "form") { if (arch.tag !== "form") {
throw new Error("Editor delegate's #edition_view must have a" + throw new Error("Editor delegate's #edition_view must have a" +

View File

@ -459,7 +459,7 @@ instance.web.ActionManager = instance.web.Widget.extend({
action_id: action.id, action_id: action.id,
context: action.context || {} context: action.context || {}
}).done(function (action) { }).done(function (action) {
self.do_action(action, options) self.do_action(action, options);
}); });
}, },
ir_actions_report_xml: function(action, options) { ir_actions_report_xml: function(action, options) {
@ -478,8 +478,8 @@ instance.web.ActionManager = instance.web.Widget.extend({
var params = { var params = {
action: JSON.stringify(action), action: JSON.stringify(action),
token: new Date().getTime() token: new Date().getTime()
} };
var url = self.session.url('/web/report', params) var url = self.session.url('/web/report', params);
instance.web.unblockUI(); instance.web.unblockUI();
$('<a href="'+url+'" target="_blank"></a>')[0].click(); $('<a href="'+url+'" target="_blank"></a>')[0].click();
return; return;
@ -502,7 +502,7 @@ instance.web.ActionManager = instance.web.Widget.extend({
c.rpc_error.apply(c, arguments); c.rpc_error.apply(c, arguments);
d.reject(); d.reject();
} }
}) });
}); });
}); });
}, },
@ -1121,7 +1121,7 @@ instance.web.Sidebar = instance.web.Widget.extend({
self.$("[title]").tipsy({ self.$("[title]").tipsy({
'html': true, 'html': true,
'delayIn': 500, 'delayIn': 500,
}) });
}, },
/** /**
* For each item added to the section: * For each item added to the section:
@ -1165,7 +1165,7 @@ instance.web.Sidebar = instance.web.Widget.extend({
label: items[i]['name'], label: items[i]['name'],
action: items[i], action: items[i],
classname: 'oe_sidebar_' + type classname: 'oe_sidebar_' + type
} };
} }
self.add_items(type=='print' ? 'print' : 'other', items); self.add_items(type=='print' ? 'print' : 'other', items);
} }
@ -1425,7 +1425,7 @@ instance.web.View = instance.web.Widget.extend({
if (self.is_active()) { if (self.is_active()) {
fn.apply(self, arguments); fn.apply(self, arguments);
} }
} };
}, },
do_push_state: function(state) { do_push_state: function(state) {
if (this.getParent() && this.getParent().do_push_state) { if (this.getParent() && this.getParent().do_push_state) {
@ -1536,9 +1536,10 @@ instance.web.xml_to_json = function(node, strip_whitespace) {
children: _.compact(_.map(node.childNodes, function(node) { children: _.compact(_.map(node.childNodes, function(node) {
return instance.web.xml_to_json(node, strip_whitespace); return instance.web.xml_to_json(node, strip_whitespace);
})), })),
} };
} }
} };
instance.web.json_node_to_xml = function(node, human_readable, indent) { instance.web.json_node_to_xml = function(node, human_readable, indent) {
// For debugging purpose, this function will convert a json node back to xml // For debugging purpose, this function will convert a json node back to xml
indent = indent || 0; indent = indent || 0;