Added semicolons
bzr revid: nicolas.vanhoren@openerp.com-20130725103301-65nld10p1if7k0zt
This commit is contained in:
parent
42e493e73e
commit
c767a0d34c
|
@ -5,7 +5,6 @@ module.exports = function(grunt) {
|
|||
files: ['static/src/**/*.js'],
|
||||
options: {
|
||||
sub: true, //[] instead of .
|
||||
asi: true, //semicolons
|
||||
evil: true, //eval
|
||||
laxbreak: true, //unsafe line breaks
|
||||
loopfunc: true, // functions in loops
|
||||
|
|
|
@ -438,7 +438,7 @@ instance.web.DatabaseManager = instance.web.Widget.extend({
|
|||
self.$el.html(QWeb.render("DatabaseManager", { 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 }));
|
||||
$('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) {
|
||||
var menuitem = $(this);
|
||||
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.eq(2).click(function(){
|
||||
self.getParent().close();
|
||||
})
|
||||
});
|
||||
$button.eq(0).click(function(){
|
||||
self.rpc("/web/session/change_password",{
|
||||
'fields': $("form[name=change_password_form]").serializeArray()
|
||||
|
@ -881,7 +881,7 @@ instance.web.ChangePassword = instance.web.Widget.extend({
|
|||
instance.webclient.on_logout();
|
||||
}
|
||||
});
|
||||
})
|
||||
});
|
||||
},
|
||||
display_error: function (error) {
|
||||
return instance.web.dialog($('<div>'), {
|
||||
|
@ -892,7 +892,7 @@ instance.web.ChangePassword = instance.web.Widget.extend({
|
|||
]
|
||||
}).html(error.error);
|
||||
},
|
||||
})
|
||||
});
|
||||
instance.web.client_actions.add("change_password", "instance.web.ChangePassword");
|
||||
|
||||
instance.web.Menu = instance.web.Widget.extend({
|
||||
|
|
|
@ -145,7 +145,7 @@ openerp.web.corelib = function(instance) {
|
|||
var ret = fn.apply(this, arguments);
|
||||
this._super = tmp;
|
||||
return ret;
|
||||
}
|
||||
};
|
||||
})(name, properties[name], prototype[name]);
|
||||
} else if (typeof _super[name] === 'function') {
|
||||
prototype[name] = (function (name, fn) {
|
||||
|
@ -155,7 +155,7 @@ openerp.web.corelib = function(instance) {
|
|||
var ret = fn.apply(this, arguments);
|
||||
this._super = tmp;
|
||||
return ret;
|
||||
}
|
||||
};
|
||||
})(name, properties[name]);
|
||||
}
|
||||
}
|
||||
|
@ -503,7 +503,7 @@ instance.web.Controller = instance.web.Class.extend(instance.web.PropertiesMixin
|
|||
return function () {
|
||||
var fn = (typeof method === 'string') ? self[method] : method;
|
||||
return fn.apply(self, arguments);
|
||||
}
|
||||
};
|
||||
},
|
||||
/**
|
||||
* 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) {
|
||||
if (key === undefined) { return false; }
|
||||
if (key in this.map) {
|
||||
return true
|
||||
return true;
|
||||
}
|
||||
if (this.parent) {
|
||||
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}));
|
||||
};
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
// vim:et fdc=0 fdl=0 foldnestmax=3 fdm=syntax:
|
||||
|
|
|
@ -88,7 +88,7 @@ instance.web.Session = instance.web.JsonRPC.extend( /** @lends instance.web.Sess
|
|||
this.session_id = this.get_cookie('session_id');
|
||||
}
|
||||
return def.then(function() {
|
||||
return self.rpc("/web/session/get_session_info", {})
|
||||
return self.rpc("/web/session/get_session_info", {});
|
||||
}).then(function(result) {
|
||||
// If immediately follows a login (triggered by trying to restore
|
||||
// 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 + '">')
|
||||
.appendTo($form_data);
|
||||
}
|
||||
$input.val(value)
|
||||
$input.val(value);
|
||||
});
|
||||
|
||||
$form
|
||||
|
@ -404,7 +404,7 @@ instance.web.Bus = instance.web.Class.extend(instance.web.EventDispatcherMixin,
|
|||
});
|
||||
});
|
||||
}
|
||||
})
|
||||
});
|
||||
instance.web.bus = new instance.web.Bus();
|
||||
|
||||
/** OpenERP Translations */
|
||||
|
@ -466,12 +466,12 @@ $.fn.getAttributes = function() {
|
|||
var o = {};
|
||||
if (this.length) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
return o;
|
||||
}
|
||||
};
|
||||
$.fn.openerpClass = function(additionalClass) {
|
||||
// This plugin should be applied on top level elements
|
||||
additionalClass = additionalClass || '';
|
||||
|
@ -557,7 +557,7 @@ instance.web._t = new instance.web.TranslationDataBase().build_translation_funct
|
|||
* @returns {Object} lazy translation object
|
||||
*/
|
||||
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.debug = instance.session.debug;
|
||||
|
@ -692,13 +692,13 @@ instance.web.blockUI = function() {
|
|||
instance.web.Throbber.throbbers.push(throbber);
|
||||
throbber.appendTo($(".oe_blockui_spin_container"));
|
||||
return tmp;
|
||||
}
|
||||
};
|
||||
instance.web.unblockUI = function() {
|
||||
_.each(instance.web.Throbber.throbbers, function(el) {
|
||||
el.destroy();
|
||||
});
|
||||
return $.unblockUI.apply($, arguments);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Registry for all the client actions key: tag value: widget
|
||||
|
|
|
@ -494,7 +494,7 @@ instance.web.DataSet = instance.web.Class.extend(instance.web.PropertiesMixin,
|
|||
return this._model.call('create', [data], {
|
||||
context: this.get_context()
|
||||
}).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], {
|
||||
context: this.get_context(options.context)
|
||||
}).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], {
|
||||
context: this.get_context()
|
||||
}).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;
|
||||
_.each(ids, function(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);});
|
||||
|
@ -838,7 +838,7 @@ instance.web.BufferedDataSet = instance.web.DataSetStatic.extend({
|
|||
_.each(fields, function(x) {if (cached.values[x] === undefined)
|
||||
cached.values[x] = created.defaults[x] || false;});
|
||||
} 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);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -71,7 +71,7 @@ instance.web.DataExport = instance.web.Dialog.extend({
|
|||
opt.replaceChild(
|
||||
document.createTextNode(
|
||||
_.str.sprintf("%s — %s", format.label, format.error)),
|
||||
opt.childNodes[0])
|
||||
opt.childNodes[0]);
|
||||
}
|
||||
$fmts.append(opt);
|
||||
});
|
||||
|
|
|
@ -200,7 +200,7 @@ instance.web.format_value = function (value, descriptor, value_if_empty) {
|
|||
case 'selection': case 'statusbar':
|
||||
// Each choice is [value, label]
|
||||
if(_.isArray(value)) {
|
||||
value = value[0]
|
||||
value = value[0];
|
||||
}
|
||||
var result = _(descriptor.selection).detect(function (choice) {
|
||||
return choice[0] === value;
|
||||
|
|
|
@ -97,7 +97,7 @@ openerp.web.pyeval = function (instance) {
|
|||
divmod(n, 365, function (_n1, n) {
|
||||
n1 = _n1;
|
||||
n0 = n;
|
||||
})
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -139,7 +139,7 @@ openerp.web.pyeval = function (instance) {
|
|||
if (microsecond < 0 || microsecond > 999999) {
|
||||
divmod(microsecond, 1000000, function (carry, ms) {
|
||||
microsecond = ms;
|
||||
second += carry
|
||||
second += carry;
|
||||
});
|
||||
}
|
||||
if (second < 0 || second > 59) {
|
||||
|
@ -152,13 +152,13 @@ openerp.web.pyeval = function (instance) {
|
|||
divmod(minute, 60, function (carry, m) {
|
||||
minute = m;
|
||||
hour += carry;
|
||||
})
|
||||
});
|
||||
}
|
||||
if (hour < 0 || hour > 23) {
|
||||
divmod(hour, 24, function (carry, h) {
|
||||
hour = h;
|
||||
day += carry;
|
||||
})
|
||||
});
|
||||
}
|
||||
// That was easy. Now it gets muddy: the proper range for day
|
||||
// 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) {
|
||||
month = m + 1;
|
||||
year += carry;
|
||||
})
|
||||
});
|
||||
}
|
||||
// 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).
|
||||
|
@ -247,7 +247,7 @@ openerp.web.pyeval = function (instance) {
|
|||
});
|
||||
divmod(seconds, 24*3600, function (days, seconds) {
|
||||
d += days;
|
||||
s += seconds
|
||||
s += seconds;
|
||||
});
|
||||
// seconds isn't referenced again before redefinition
|
||||
|
||||
|
@ -358,7 +358,7 @@ openerp.web.pyeval = function (instance) {
|
|||
return py.float.fromJSON(
|
||||
this.days * 86400
|
||||
+ this.seconds
|
||||
+ this.microseconds / 1000000)
|
||||
+ this.microseconds / 1000000);
|
||||
},
|
||||
__nonzero__: function () {
|
||||
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));
|
||||
},
|
||||
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 '
|
||||
+ 'years months weeks days hours minutes secondes microseconds '
|
||||
+ 'weekday leakdays yearday nlyearday').split(' '), function (arg) {
|
||||
return [arg, null]
|
||||
return [arg, null];
|
||||
});
|
||||
args.unshift('*');
|
||||
var relativedelta = py.type('relativedelta', null, {
|
||||
|
@ -808,7 +808,7 @@ openerp.web.pyeval = function (instance) {
|
|||
case 'groupbys':
|
||||
return eval_groupbys(object, context);
|
||||
}
|
||||
throw new Error("Unknow evaluation type " + type)
|
||||
throw new Error("Unknow evaluation type " + type);
|
||||
};
|
||||
|
||||
var eval_arg = function (arg) {
|
||||
|
@ -863,5 +863,5 @@ openerp.web.pyeval = function (instance) {
|
|||
}});
|
||||
}
|
||||
}, 0); });
|
||||
}
|
||||
};
|
||||
};
|
||||
|
|
|
@ -148,7 +148,7 @@ my.InputView = instance.web.Widget.extend({
|
|||
range.setStart(root, 0);
|
||||
}
|
||||
if (range.endContainer === this.el && range.endOffset === 1) {
|
||||
range.setEnd(root, root.length)
|
||||
range.setEnd(root, root.length);
|
||||
}
|
||||
assert(range.startContainer === root,
|
||||
"selection should be in the input view");
|
||||
|
@ -157,7 +157,7 @@ my.InputView = instance.web.Widget.extend({
|
|||
return {
|
||||
start: range.startOffset,
|
||||
end: range.endOffset
|
||||
}
|
||||
};
|
||||
},
|
||||
onKeydown: function (e) {
|
||||
this.el.normalize();
|
||||
|
@ -401,7 +401,7 @@ instance.web.SearchView = instance.web.Widget.extend(/** @lends instance.web.Sea
|
|||
});
|
||||
|
||||
$.when(load_view).then(function (r) {
|
||||
return self.search_view_loaded(r)
|
||||
return self.search_view_loaded(r);
|
||||
}).fail(function () {
|
||||
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>}
|
||||
*/
|
||||
complete: function (value) {
|
||||
return $.when(null)
|
||||
return $.when(null);
|
||||
},
|
||||
/**
|
||||
* 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,
|
||||
values: values,
|
||||
field: this
|
||||
}
|
||||
};
|
||||
},
|
||||
make_value: function (filter) {
|
||||
return {
|
||||
|
@ -1176,7 +1176,7 @@ instance.web.search.FilterGroup = instance.web.search.Input.extend(/** @lends in
|
|||
label: _.str.sprintf(self.completion_label.toString(),
|
||||
_.escape(facet_value.label)),
|
||||
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_domain: this.proxy('get_domain'),
|
||||
get_groupby: this.proxy('get_groupby')
|
||||
}
|
||||
};
|
||||
}
|
||||
},
|
||||
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) {
|
||||
if (_(names).isEmpty()) { return null; }
|
||||
return facet_from(self, names[0]);
|
||||
})
|
||||
});
|
||||
},
|
||||
value_from: function (facetValue) {
|
||||
return facetValue.get('label');
|
||||
|
|
|
@ -73,6 +73,6 @@ openerp.test_support = {
|
|||
return;
|
||||
}
|
||||
fn(e.data.name);
|
||||
})
|
||||
});
|
||||
}
|
||||
};
|
||||
|
|
|
@ -176,9 +176,9 @@ openerp.testing = {};
|
|||
});
|
||||
|
||||
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)) {
|
||||
callback = options;
|
||||
options = {};
|
||||
|
@ -359,7 +359,7 @@ openerp.testing = {};
|
|||
|
||||
return $.Deferred(function (d) {
|
||||
$.when(result).then(function () {
|
||||
d.resolve.apply(d, arguments)
|
||||
d.resolve.apply(d, arguments);
|
||||
}, function () {
|
||||
d.reject.apply(d, arguments);
|
||||
});
|
||||
|
|
|
@ -437,7 +437,7 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM
|
|||
|
||||
var method = call[1];
|
||||
if (!_.str.trim(call[2])) {
|
||||
return {method: method, args: []}
|
||||
return {method: method, args: []};
|
||||
}
|
||||
|
||||
var argument_replacement = {
|
||||
|
@ -778,7 +778,7 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM
|
|||
} else {
|
||||
$.async_when().done(function () {
|
||||
def.reject();
|
||||
})
|
||||
});
|
||||
}
|
||||
});
|
||||
return def.promise();
|
||||
|
@ -1028,7 +1028,7 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM
|
|||
return field.get_displayed();
|
||||
}
|
||||
return value;
|
||||
}
|
||||
};
|
||||
var fields = _.chain(this.fields)
|
||||
.map(function (field) {
|
||||
var value = field.get_value();
|
||||
|
@ -1049,7 +1049,7 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM
|
|||
string: field.string,
|
||||
value: value,
|
||||
displayed: display(field, value),
|
||||
}
|
||||
};
|
||||
})
|
||||
.compact()
|
||||
.sortBy(function (field) { return field.string; })
|
||||
|
@ -1063,7 +1063,7 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM
|
|||
string: field.string,
|
||||
value: value,
|
||||
displayed: display(field, value),
|
||||
}
|
||||
};
|
||||
})
|
||||
.value();
|
||||
|
||||
|
@ -1429,7 +1429,7 @@ instance.web.form.FormRenderingEngine = instance.web.form.FormRenderingEngineInt
|
|||
row_cols = cols;
|
||||
} else if (tagName==='group') {
|
||||
// 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;
|
||||
|
||||
|
@ -1852,7 +1852,8 @@ instance.web.form.FormWidget = instance.web.Widget.extend(instance.web.form.Invi
|
|||
return QWeb.render(template, {
|
||||
debug: instance.session.debug,
|
||||
widget: widget
|
||||
})},
|
||||
});
|
||||
},
|
||||
gravity: $.fn.tipsy.autoBounds(50, 'nw'),
|
||||
html: true,
|
||||
opacity: 0.85,
|
||||
|
@ -2073,7 +2074,7 @@ instance.web.form.AbstractField = instance.web.form.FormWidget.extend(instance.w
|
|||
* @param node
|
||||
*/
|
||||
init: function(field_manager, node) {
|
||||
var self = this
|
||||
var self = this;
|
||||
this._super(field_manager, node);
|
||||
this.name = this.node.attrs.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_) {
|
||||
if (value_) {
|
||||
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) {
|
||||
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.$("input:checked").prop("checked", false);
|
||||
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] : "");
|
||||
}
|
||||
}
|
||||
|
@ -3090,7 +3091,7 @@ instance.web.form.CompletionFieldMixin = {
|
|||
self.field.relation,
|
||||
{
|
||||
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,
|
||||
disable_multiple_selection: true
|
||||
},
|
||||
|
@ -3455,7 +3456,7 @@ instance.web.form.FieldMany2One = instance.web.form.AbstractField.extend(instanc
|
|||
var self = this;
|
||||
if (value_ instanceof Array) {
|
||||
this.display_value = {};
|
||||
this.display_value_backup = {}
|
||||
this.display_value_backup = {};
|
||||
if (! this.options.always_reload) {
|
||||
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);
|
||||
} else if (view_type == "graph") {
|
||||
self.reload_current_view()
|
||||
self.reload_current_view();
|
||||
}
|
||||
def.resolve();
|
||||
});
|
||||
|
@ -3963,7 +3964,7 @@ instance.web.form.One2ManyListView = instance.web.ListView.extend({
|
|||
var form = editor.form;
|
||||
// If no edition is pending, the listview can not be invalid (?)
|
||||
if (!editor.record) {
|
||||
return true
|
||||
return true;
|
||||
}
|
||||
// If the form has not been modified, the view can only be valid
|
||||
// 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) {
|
||||
$padding.before($newrow);
|
||||
} 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.appendTo(this.$(".oe_form_view_reference_selection"));
|
||||
this.selection
|
||||
.on('focused', null, function () {self.trigger('focused')})
|
||||
.on('blurred', null, function () {self.trigger('blurred')});
|
||||
.on('focused', null, function () {self.trigger('focused');})
|
||||
.on('blurred', null, function () {self.trigger('blurred');});
|
||||
|
||||
this.m2o = new instance.web.form.FieldMany2One(fm, { attrs: {
|
||||
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.appendTo(this.$(".oe_form_view_reference_m2o"));
|
||||
this.m2o
|
||||
.on('focused', null, function () {self.trigger('focused')})
|
||||
.on('blurred', null, function () {self.trigger('blurred')});
|
||||
.on('focused', null, function () {self.trigger('focused');})
|
||||
.on('blurred', null, function () {self.trigger('blurred');});
|
||||
},
|
||||
on_selection_changed: function() {
|
||||
if (this.reference_ready) {
|
||||
|
@ -5203,7 +5204,7 @@ instance.web.form.FieldBinaryFile = instance.web.form.FieldBinary.extend({
|
|||
} else {
|
||||
this.$el.find('a').toggle(!!this.get('value'));
|
||||
if (this.get('value')) {
|
||||
show_value = _t("Download")
|
||||
show_value = _t("Download");
|
||||
if (this.view)
|
||||
show_value += " " + (this.view.datarecord[this.node.attrs.filename] || '');
|
||||
this.$el.find('a').text(show_value);
|
||||
|
@ -5422,7 +5423,7 @@ instance.web.form.FieldMany2ManyBinaryMultiFiles = instance.web.form.AbstractFie
|
|||
values.push(result.id);
|
||||
this.set({'value': values});
|
||||
}
|
||||
this.render_value()
|
||||
this.render_value();
|
||||
},
|
||||
on_file_delete: function (event) {
|
||||
event.stopPropagation();
|
||||
|
@ -5476,7 +5477,7 @@ instance.web.form.FieldStatus = instance.web.form.AbstractField.extend({
|
|||
var self = this;
|
||||
var content = QWeb.render("FieldStatus.content", {
|
||||
'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);
|
||||
},
|
||||
|
@ -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"))
|
||||
.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) {
|
||||
_.each(records, function (record) {
|
||||
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]);
|
||||
}
|
||||
});
|
||||
})
|
||||
});
|
||||
});
|
||||
});
|
||||
} 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) {
|
||||
self.distant_fields = fields;
|
||||
return fields;
|
||||
})
|
||||
});
|
||||
},
|
||||
on_click_stage: function (ev) {
|
||||
var self = this;
|
||||
|
|
|
@ -363,7 +363,7 @@ instance.web.ListView = instance.web.View.extend( /** @lends instance.web.ListVi
|
|||
sort_by_column: function (e) {
|
||||
e.stopPropagation();
|
||||
var $column = $(e.currentTarget);
|
||||
var col_name = $column.data('id')
|
||||
var col_name = $column.data('id');
|
||||
var field = this.fields_view.fields[col_name];
|
||||
// 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
|
||||
|
@ -1430,7 +1430,7 @@ instance.web.ListView.Groups = instance.web.Class.extend( /** @lends instance.we
|
|||
d = new $.Deferred(),
|
||||
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} };
|
||||
//TODO xmo: investigate why we need to put the setTimeout
|
||||
$.async_when().done(function() {
|
||||
|
@ -1545,7 +1545,7 @@ instance.web.ListView.Groups = instance.web.Class.extend( /** @lends instance.we
|
|||
|
||||
this.datagroup.list(
|
||||
_(this.view.visible_columns).chain()
|
||||
.filter(function (column) { return column.tag === 'field' })
|
||||
.filter(function (column) { return column.tag === 'field';})
|
||||
.pluck('name').value(),
|
||||
function (groups) {
|
||||
$el[0].appendChild(
|
||||
|
@ -1590,7 +1590,7 @@ instance.web.ListView.Groups = instance.web.Class.extend( /** @lends instance.we
|
|||
return {
|
||||
count: this.datagroup.length,
|
||||
values: this.datagroup.aggregates
|
||||
}
|
||||
};
|
||||
}
|
||||
return _(this.children).chain()
|
||||
.map(function (child) {
|
||||
|
@ -1958,7 +1958,7 @@ var Collection = instance.web.Class.extend(/** @lends Collection# */{
|
|||
var record;
|
||||
for(var section in this._proxies) {
|
||||
if (!this._proxies.hasOwnProperty(section)) {
|
||||
continue
|
||||
continue;
|
||||
}
|
||||
if ((record = this._proxies[section].find(callback))) {
|
||||
return record;
|
||||
|
@ -2075,7 +2075,7 @@ instance.web.list.columns.for_ = function (id, field, node) {
|
|||
tag + '.'+ description.type,
|
||||
tag
|
||||
]);
|
||||
return new Type(id, node.tag, description)
|
||||
return new Type(id, node.tag, description);
|
||||
};
|
||||
|
||||
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) {
|
||||
var value = row_data[this.id].value;
|
||||
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);
|
||||
}
|
||||
|
|
|
@ -202,7 +202,7 @@ openerp.web.list_editable = function (instance) {
|
|||
make_empty_record: function (id) {
|
||||
var attrs = {id: id};
|
||||
_(this.columns).chain()
|
||||
.filter(function (x) { return x.tag === 'field'})
|
||||
.filter(function (x) { return x.tag === 'field';})
|
||||
.pluck('name')
|
||||
.each(function (field) { attrs[field] = false; });
|
||||
return new instance.web.list.Record(attrs);
|
||||
|
@ -260,7 +260,7 @@ openerp.web.list_editable = function (instance) {
|
|||
get_cells_for: function ($row) {
|
||||
var cells = {};
|
||||
$row.children('td').each(function (index, el) {
|
||||
cells[el.getAttribute('data-field')] = el
|
||||
cells[el.getAttribute('data-field')] = el;
|
||||
});
|
||||
return cells;
|
||||
},
|
||||
|
@ -346,7 +346,7 @@ openerp.web.list_editable = function (instance) {
|
|||
var record = self.records.get(attrs.id);
|
||||
if (!record) {
|
||||
// Record removed by third party during edition
|
||||
return
|
||||
return;
|
||||
}
|
||||
return self.reload_record(record);
|
||||
}
|
||||
|
@ -691,7 +691,7 @@ openerp.web.list_editable = function (instance) {
|
|||
var arch = edition_view.arch;
|
||||
if (!(arch && arch.children instanceof Array)) {
|
||||
throw new Error("Editor delegate's #edition_view must have a" +
|
||||
" non-empty arch")
|
||||
" non-empty arch");
|
||||
}
|
||||
if (arch.tag !== "form") {
|
||||
throw new Error("Editor delegate's #edition_view must have a" +
|
||||
|
|
|
@ -459,7 +459,7 @@ instance.web.ActionManager = instance.web.Widget.extend({
|
|||
action_id: action.id,
|
||||
context: action.context || {}
|
||||
}).done(function (action) {
|
||||
self.do_action(action, options)
|
||||
self.do_action(action, options);
|
||||
});
|
||||
},
|
||||
ir_actions_report_xml: function(action, options) {
|
||||
|
@ -478,8 +478,8 @@ instance.web.ActionManager = instance.web.Widget.extend({
|
|||
var params = {
|
||||
action: JSON.stringify(action),
|
||||
token: new Date().getTime()
|
||||
}
|
||||
var url = self.session.url('/web/report', params)
|
||||
};
|
||||
var url = self.session.url('/web/report', params);
|
||||
instance.web.unblockUI();
|
||||
$('<a href="'+url+'" target="_blank"></a>')[0].click();
|
||||
return;
|
||||
|
@ -502,7 +502,7 @@ instance.web.ActionManager = instance.web.Widget.extend({
|
|||
c.rpc_error.apply(c, arguments);
|
||||
d.reject();
|
||||
}
|
||||
})
|
||||
});
|
||||
});
|
||||
});
|
||||
},
|
||||
|
@ -1121,7 +1121,7 @@ instance.web.Sidebar = instance.web.Widget.extend({
|
|||
self.$("[title]").tipsy({
|
||||
'html': true,
|
||||
'delayIn': 500,
|
||||
})
|
||||
});
|
||||
},
|
||||
/**
|
||||
* For each item added to the section:
|
||||
|
@ -1165,7 +1165,7 @@ instance.web.Sidebar = instance.web.Widget.extend({
|
|||
label: items[i]['name'],
|
||||
action: items[i],
|
||||
classname: 'oe_sidebar_' + type
|
||||
}
|
||||
};
|
||||
}
|
||||
self.add_items(type=='print' ? 'print' : 'other', items);
|
||||
}
|
||||
|
@ -1425,7 +1425,7 @@ instance.web.View = instance.web.Widget.extend({
|
|||
if (self.is_active()) {
|
||||
fn.apply(self, arguments);
|
||||
}
|
||||
}
|
||||
};
|
||||
},
|
||||
do_push_state: function(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) {
|
||||
return instance.web.xml_to_json(node, strip_whitespace);
|
||||
})),
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
instance.web.json_node_to_xml = function(node, human_readable, indent) {
|
||||
// For debugging purpose, this function will convert a json node back to xml
|
||||
indent = indent || 0;
|
||||
|
|
Loading…
Reference in New Issue