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
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');
$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()
instance.webclient.on_logout();
}
});
- })
+ });
},
display_error: function (error) {
return instance.web.dialog($('<div>'), {
]
}).html(error.error);
},
-})
+});
instance.web.client_actions.add("change_password", "instance.web.ChangePassword");
instance.web.Menu = instance.web.Widget.extend({
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) {
var ret = fn.apply(this, arguments);
this._super = tmp;
return ret;
- }
+ };
})(name, properties[name]);
}
}
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
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);
return py.eval(expr, _.extend({}, context || {}, {"true": true, "false": false, "null": null}));
};
-}
+};
// vim:et fdc=0 fdl=0 foldnestmax=3 fdm=syntax:
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
$input = $('<input type="hidden" name="' + key + '">')
.appendTo($form_data);
}
- $input.val(value)
+ $input.val(value);
});
$form
});
});
}
-})
+});
instance.web.bus = new instance.web.Bus();
/** OpenERP Translations */
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 || '';
* @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;
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
return this._model.call('create', [data], {
context: this.get_context()
}).done(function () {
- self.trigger('dataset_changed', data, options)
+ self.trigger('dataset_changed', data, options);
});
},
/**
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);
});
},
/**
return this._model.call('unlink', [ids], {
context: this.get_context()
}).done(function () {
- self.trigger('dataset_changed', ids)
+ self.trigger('dataset_changed', ids);
});
},
/**
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);});
_.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);
}
});
opt.replaceChild(
document.createTextNode(
_.str.sprintf("%s — %s", format.label, format.error)),
- opt.childNodes[0])
+ opt.childNodes[0]);
}
$fmts.append(opt);
});
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;
divmod(n, 365, function (_n1, n) {
n1 = _n1;
n0 = n;
- })
+ });
});
});
});
if (microsecond < 0 || microsecond > 999999) {
divmod(microsecond, 1000000, function (carry, ms) {
microsecond = ms;
- second += carry
+ second += carry;
});
}
if (second < 0 || second > 59) {
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,
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).
});
divmod(seconds, 24*3600, function (days, seconds) {
d += days;
- s += seconds
+ s += seconds;
});
// seconds isn't referenced again before redefinition
return py.float.fromJSON(
this.days * 86400
+ this.seconds
- + this.microseconds / 1000000)
+ + this.microseconds / 1000000);
},
__nonzero__: function () {
return (!!this.days || !!this.seconds || !!this.microseconds)
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]);
}
});
/**
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, {
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) {
}});
}
}, 0); });
- }
+ };
};
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");
return {
start: range.startOffset,
end: range.endOffset
- }
+ };
},
onKeydown: function (e) {
this.el.normalize();
});
$.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);
});
* @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
icon: this.icon,
values: values,
field: this
- }
+ };
},
make_value: function (filter) {
return {
label: _.str.sprintf(self.completion_label.toString(),
_.escape(facet_value.label)),
facet: self.make_facet([facet_value])
- }
+ };
}));
}
});
get_context: this.proxy('get_context'),
get_domain: this.proxy('get_domain'),
get_groupby: this.proxy('get_groupby')
- }
+ };
}
},
match_facet: function (facet) {
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');
return;
}
fn(e.data.name);
- })
+ });
}
};
});
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 = {};
return $.Deferred(function (d) {
$.when(result).then(function () {
- d.resolve.apply(d, arguments)
+ d.resolve.apply(d, arguments);
}, function () {
d.reject.apply(d, arguments);
});
var method = call[1];
if (!_.str.trim(call[2])) {
- return {method: method, args: []}
+ return {method: method, args: []};
}
var argument_replacement = {
} else {
$.async_when().done(function () {
def.reject();
- })
+ });
}
});
return def.promise();
return field.get_displayed();
}
return value;
- }
+ };
var fields = _.chain(this.fields)
.map(function (field) {
var value = field.get_value();
string: field.string,
value: value,
displayed: display(field, value),
- }
+ };
})
.compact()
.sortBy(function (field) { return field.string; })
string: field.string,
value: value,
displayed: display(field, value),
- }
+ };
})
.value();
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;
return QWeb.render(template, {
debug: instance.session.debug,
widget: widget
- })},
+ });
+ },
gravity: $.fn.tipsy.autoBounds(50, 'nw'),
html: true,
opacity: 0.85,
* @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);
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_];
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] : "");
}
}
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
},
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];
}
});
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();
});
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?
if ($padding.length) {
$padding.before($newrow);
} else {
- this.$current.append($newrow)
+ this.$current.append($newrow);
}
}
});
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',
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) {
} 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);
values.push(result.id);
this.set({'value': values});
}
- this.render_value()
+ this.render_value();
},
on_file_delete: function (event) {
event.stopPropagation();
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);
},
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];
selection_unfolded.push([record.id, name]);
}
});
- })
+ });
});
});
} else {
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;
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
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() {
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(
return {
count: this.datagroup.length,
values: this.datagroup.aggregates
- }
+ };
}
return _(this.children).chain()
.map(function (child) {
var record;
for(var section in this._proxies) {
if (!this._proxies.hasOwnProperty(section)) {
- continue
+ continue;
}
if ((record = this._proxies[section].find(callback))) {
return record;
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({
_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);
}
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);
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;
},
var record = self.records.get(attrs.id);
if (!record) {
// Record removed by third party during edition
- return
+ return;
}
return self.reload_record(record);
}
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" +
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) {
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;
c.rpc_error.apply(c, arguments);
d.reject();
}
- })
+ });
});
});
},
self.$("[title]").tipsy({
'html': true,
'delayIn': 500,
- })
+ });
},
/**
* For each item added to the section:
label: items[i]['name'],
action: items[i],
classname: 'oe_sidebar_' + type
- }
+ };
}
self.add_items(type=='print' ? 'print' : 'other', items);
}
if (self.is_active()) {
fn.apply(self, arguments);
}
- }
+ };
},
do_push_state: function(state) {
if (this.getParent() && this.getParent().do_push_state) {
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;