From 92e87f7e6fa762af05b03a6a82d1e135f78172cb Mon Sep 17 00:00:00 2001 From: tsabi <> Date: Thu, 29 Nov 2012 01:22:00 +0100 Subject: [PATCH 01/11] Mark strings to be translated. Maybe some missed, but most of them marked. bzr revid: tsabi-20121129002200-20tppzvh0ap5tfwe --- addons/web/controllers/main.py | 23 +++++++------ addons/web/static/src/js/chrome.js | 34 +++++++++---------- addons/web/static/src/js/dates.js | 13 +++---- addons/web/static/src/js/formats.js | 14 ++++---- addons/web/static/src/js/view_form.js | 24 ++++++------- addons/web/static/src/js/view_list.js | 14 ++++---- .../web/static/src/js/view_list_editable.js | 6 ++-- addons/web/static/src/js/views.js | 12 +++---- addons/web_calendar/static/src/js/calendar.js | 4 +-- addons/web_kanban/static/src/js/kanban.js | 2 +- .../static/src/js/view_editor.js | 10 +++--- 11 files changed, 80 insertions(+), 76 deletions(-) diff --git a/addons/web/controllers/main.py b/addons/web/controllers/main.py index e36b46ed51a..def93c16ea4 100644 --- a/addons/web/controllers/main.py +++ b/addons/web/controllers/main.py @@ -28,6 +28,7 @@ except ImportError: xlwt = None import openerp +from openerp.tools.translate import _ from .. import http from .. import nonliterals @@ -821,7 +822,7 @@ class Database(openerpweb.Controller): except xmlrpclib.Fault, e: if e.faultCode and e.faultCode.split(':')[0] == 'AccessDenied': return {'error': e.faultCode, 'title': 'Drop Database'} - return {'error': 'Could not drop database !', 'title': 'Drop Database'} + return {'error': _('Could not drop database !'), 'title': _('Drop Database')} @openerpweb.httprequest def backup(self, req, backup_db, backup_pwd, token): @@ -839,7 +840,7 @@ class Database(openerpweb.Controller): {'fileToken': int(token)} ) except xmlrpclib.Fault, e: - return simplejson.dumps([[],[{'error': e.faultCode, 'title': 'backup Database'}]]) + return simplejson.dumps([[],[{'error': e.faultCode, 'title': _('Backup Database')}]]) @openerpweb.httprequest def restore(self, req, db_file, restore_pwd, new_db): @@ -860,8 +861,8 @@ class Database(openerpweb.Controller): return req.session.proxy("db").change_admin_password(old_password, new_password) except xmlrpclib.Fault, e: if e.faultCode and e.faultCode.split(':')[0] == 'AccessDenied': - return {'error': e.faultCode, 'title': 'Change Password'} - return {'error': 'Error, password not changed !', 'title': 'Change Password'} + return {'error': e.faultCode, 'title': _('Change Password')} + return {'error': _('Error, password not changed !'), 'title': _('Change Password')} class Session(openerpweb.Controller): _cp_path = "/web/session" @@ -897,16 +898,16 @@ class Session(openerpweb.Controller): old_password, new_password,confirm_password = operator.itemgetter('old_pwd', 'new_password','confirm_pwd')( dict(map(operator.itemgetter('name', 'value'), fields))) if not (old_password.strip() and new_password.strip() and confirm_password.strip()): - return {'error':'You cannot leave any password empty.','title': 'Change Password'} + return {'error':_('You cannot leave any password empty.'),'title': _('Change Password')} if new_password != confirm_password: - return {'error': 'The new password and its confirmation must be identical.','title': 'Change Password'} + return {'error': _('The new password and its confirmation must be identical.'),'title': _('Change Password')} try: if req.session.model('res.users').change_password( old_password, new_password): return {'new_password':new_password} except Exception: - return {'error': 'The old password you provided is incorrect, your password was not changed.', 'title': 'Change Password'} - return {'error': 'Error, password not changed !', 'title': 'Change Password'} + return {'error': _('The old password you provided is incorrect, your password was not changed.'), 'title': _('Change Password')} + return {'error': _('Error, password not changed !'), 'title': _('Change Password')} @openerpweb.jsonrequest def sc_list(self, req): @@ -918,7 +919,7 @@ class Session(openerpweb.Controller): try: return req.session.proxy("db").list_lang() or [] except Exception, e: - return {"error": e, "title": "Languages"} + return {"error": e, "title": _("Languages")} @openerpweb.jsonrequest def modules(self, req): @@ -1450,7 +1451,7 @@ class SearchView(View): if not isinstance(parsed_domain, nonliterals.BaseDomain) else req.session.eval_domain(parsed_domain)) except Exception: - logger.exception("Failed to parse custom filter %s in %s", + logger.exception(_("Failed to parse custom filter %s in %s"), filter['name'], model) filter['disabled'] = True del filter['context'] @@ -1571,7 +1572,7 @@ class Binary(openerpweb.Controller): res = Model.default_get(fields, context) filecontent = base64.b64decode(res.get(field, '')) if not filecontent: - raise ValueError("No content found for field '%s' on '%s:%s'" % + raise ValueError(_("No content found for field '%s' on '%s:%s'") % (field, model, id)) else: filename = '%s_%s' % (model.replace('.', '_'), id) diff --git a/addons/web/static/src/js/chrome.js b/addons/web/static/src/js/chrome.js index 940bf800851..91cca8468d1 100644 --- a/addons/web/static/src/js/chrome.js +++ b/addons/web/static/src/js/chrome.js @@ -289,7 +289,7 @@ instance.web.CrashManager = instance.web.Class.extend({ }); instance.web.Loading = instance.web.Widget.extend({ - template: 'Loading', + template: _t("Loading"), init: function(parent) { this._super(parent); this.count = 0; @@ -390,11 +390,11 @@ instance.web.DatabaseManager = instance.web.Widget.extend({ self.$el.find("form[name=restore_db_form]").validate({ submitHandler: self.do_restore }); self.$el.find("form[name=change_pwd_form]").validate({ messages: { - old_pwd: "Please enter your previous password", - new_pwd: "Please enter your new password", + old_pwd: _t("Please enter your previous password"), + new_pwd: _t("Please enter your new password"), confirm_pwd: { - required: "Please confirm your new password", - equalTo: "The confirmation does not match the password" + required: _t("Please confirm your new password"), + equalTo: _t("The confirmation does not match the password") } }, submitHandler: self.do_change_password @@ -478,7 +478,7 @@ instance.web.DatabaseManager = instance.web.Widget.extend({ self.display_error(result); return; } - self.do_notify("Duplicating database", "The database has been duplicated."); + self.do_notify(_t("Duplicating database"), _t("The database has been duplicated.")); self.start(); }); }, @@ -488,7 +488,7 @@ instance.web.DatabaseManager = instance.web.Widget.extend({ fields = $form.serializeArray(), $db_list = $form.find('[name=drop_db]'), db = $db_list.val(); - if (!db || !confirm("Do you really want to delete the database: " + db + " ?")) { + if (!db || !confirm(_.str.sprintf(_t("Do you really want to delete the database: %s ?"), db))) { return; } self.rpc("/web/database/drop", {'fields': fields}).done(function(result) { @@ -496,7 +496,7 @@ instance.web.DatabaseManager = instance.web.Widget.extend({ self.display_error(result); return; } - self.do_notify("Dropping database", "The database '" + db + "' has been dropped"); + self.do_notify(_t("Dropping database"), _.str.sprintf(_t("The database %s has been dropped"), db)); self.start(); }); }, @@ -511,7 +511,7 @@ instance.web.DatabaseManager = instance.web.Widget.extend({ error: function(error){ if(error){ self.display_error({ - title: 'Backup Database', + title: _t("Backup Database"), error: 'AccessDenied' }); } @@ -534,13 +534,13 @@ instance.web.DatabaseManager = instance.web.Widget.extend({ if (body.indexOf('403 Forbidden') !== -1) { self.display_error({ - title: 'Access Denied', - error: 'Incorrect super-administrator password' + title: _t("Access Denied"), + error: _t("Incorrect super-administrator password") }); } else { self.display_error({ - title: 'Restore Database', - error: 'Could not restore the database' + title: _t("Restore Database"), + error: _t("Could not restore the database") }); } }, @@ -560,7 +560,7 @@ instance.web.DatabaseManager = instance.web.Widget.extend({ return; } self.unblockUI(); - self.do_notify("Changed Password", "Password has been changed successfully"); + self.do_notify(_t("Changed Password"), _t("Password has been changed successfully")); }); }, do_exit: function () { @@ -642,7 +642,7 @@ instance.web.Login = instance.web.Widget.extend({ } var db = this.$("form [name=db]").val(); if (!db) { - this.do_warn("Login", "No database selected !"); + this.do_warn(_t("Login"), _t("No database selected !")); return false; } var login = this.$("form input[name=login]").val(); @@ -678,7 +678,7 @@ instance.web.Login = instance.web.Widget.extend({ self.trigger('login_successful'); }, function () { self.$(".oe_login_pane").fadeIn("fast", function() { - self.show_error("Invalid username or password"); + self.show_error(_t("Invalid username or password")); }); }); }, @@ -765,7 +765,7 @@ instance.web.ChangePassword = instance.web.Widget.extend({ template: "ChangePassword", start: function() { var self = this; - this.getParent().dialog_title = "Change Password"; + this.getParent().dialog_title = _t("Change Password"); var $button = self.$el.find('.oe_form_button'); $button.appendTo(this.getParent().$buttons); $button.eq(2).click(function(){ diff --git a/addons/web/static/src/js/dates.js b/addons/web/static/src/js/dates.js index 3db48c8412a..1a48463df2c 100644 --- a/addons/web/static/src/js/dates.js +++ b/addons/web/static/src/js/dates.js @@ -1,5 +1,6 @@ openerp.web.dates = function(instance) { +var _t = instance.web._t; /** * Converts a string to a Date javascript object using OpenERP's @@ -18,11 +19,11 @@ instance.web.str_to_datetime = function(str) { var regex = /^(\d\d\d\d-\d\d-\d\d \d\d:\d\d:\d\d)(?:\.\d+)?$/; var res = regex.exec(str); if ( !res ) { - throw new Error("'" + str + "' is not a valid datetime"); + throw new Error(_.str.sprintf(_t("'%s' is not a valid datetime"), str)); } var obj = Date.parseExact(res[1] + " UTC", 'yyyy-MM-dd HH:mm:ss zzz'); if (! obj) { - throw new Error("'" + str + "' is not a valid datetime"); + throw new Error(_.str.sprintf(_t("'%s' is not a valid datetime"), str)); } return obj; }; @@ -45,11 +46,11 @@ instance.web.str_to_date = function(str) { var regex = /^\d\d\d\d-\d\d-\d\d$/; var res = regex.exec(str); if ( !res ) { - throw new Error("'" + str + "' is not a valid date"); + throw new Error(_.str.sprintf(_t("'%s' is not a valid date"), str)); } var obj = Date.parseExact(str, 'yyyy-MM-dd'); if (! obj) { - throw new Error("'" + str + "' is not a valid date"); + throw new Error(_.str.sprintf(_t("'%s' is not a valid date"), str)); } return obj; }; @@ -72,11 +73,11 @@ instance.web.str_to_time = function(str) { var regex = /^(\d\d:\d\d:\d\d)(?:\.\d+)?$/; var res = regex.exec(str); if ( !res ) { - throw new Error("'" + str + "' is not a valid time"); + throw new Error(_.str.sprintf(_t("'%s' is not a valid time"), str)); } var obj = Date.parseExact("1970-01-01 " + res[1], 'yyyy-MM-dd HH:mm:ss'); if (! obj) { - throw new Error("'" + str + "' is not a valid time"); + throw new Error(_.str.sprintf(_t("'%s' is not a valid time"), str)); } return obj; }; diff --git a/addons/web/static/src/js/formats.js b/addons/web/static/src/js/formats.js index e586b94db6b..9432b02826f 100644 --- a/addons/web/static/src/js/formats.js +++ b/addons/web/static/src/js/formats.js @@ -224,7 +224,7 @@ instance.web.parse_value = function (value, descriptor, value_if_empty) { } while(tmp !== value); tmp = Number(value); if (isNaN(tmp)) - throw new Error(value + " is not a correct integer"); + throw new Error(_.str.sprintf(_t("'%s' is not a correct integer"), value)); return tmp; case 'float': var tmp = Number(value); @@ -239,7 +239,7 @@ instance.web.parse_value = function (value, descriptor, value_if_empty) { var reformatted_value = tmp.replace(instance.web._t.database.parameters.decimal_point, "."); var parsed = Number(reformatted_value); if (isNaN(parsed)) - throw new Error(value + " is not a correct float"); + throw new Error(_.str.sprintf(_t("'%s' is not a correct float"), value)); return parsed; case 'float_time': var factor = 1; @@ -263,7 +263,7 @@ instance.web.parse_value = function (value, descriptor, value_if_empty) { datetime = Date.parse(value); if (datetime !== null) return instance.web.datetime_to_str(datetime); - throw new Error(value + " is not a valid datetime"); + throw new Error(_.str.sprintf(_t("'%s' is not a correct datetime"), value)); case 'date': var date = Date.parseExact(value, date_pattern); if (date !== null) @@ -271,7 +271,7 @@ instance.web.parse_value = function (value, descriptor, value_if_empty) { date = Date.parse(value); if (date !== null) return instance.web.date_to_str(date); - throw new Error(value + " is not a valid date"); + throw new Error(_.str.sprintf(_t("'%s' is not a correct date"), value)); case 'time': var time = Date.parseExact(value, time_pattern); if (time !== null) @@ -279,7 +279,7 @@ instance.web.parse_value = function (value, descriptor, value_if_empty) { time = Date.parse(value); if (time !== null) return instance.web.time_to_str(time); - throw new Error(value + " is not a valid time"); + throw new Error(_.str.sprintf(_t("'%s' is not a correct time"), value)); } return value; }; @@ -294,7 +294,7 @@ instance.web.auto_str_to_date = function(value, type) { try { return instance.web.str_to_time(value); } catch(e) {} - throw new Error("'" + value + "' is not a valid date, datetime nor time"); + throw new Error(_.str.sprintf(_t("'%s' is not a correct date, datetime nor time"), value)); }; instance.web.auto_date_to_str = function(value, type) { @@ -306,7 +306,7 @@ instance.web.auto_date_to_str = function(value, type) { case 'time': return instance.web.time_to_str(value); default: - throw new Error(type + " is not convertible to date, datetime nor time"); + throw new Error(_.str.sprintf(_t("'%s' is not convertible to date, datetime nor time"), type)); } }; diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index 927d585a5be..dd9b2be5fb0 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -148,7 +148,7 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM load_form: function(data) { var self = this; if (!data) { - throw new Error("No data provided."); + throw new Error(_t("No data provided.")); } if (this.arch) { throw "Form view does not support multiple calls to load_form"; @@ -316,12 +316,12 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM var self = this, set_values = []; if (!record) { this.set({ 'title' : undefined }); - this.do_warn("Form", "The record could not be found in the database.", true); + this.do_warn(_t("Form"), _t("The record could not be found in the database."), true); return $.Deferred().reject(); } this.datarecord = record; this._actualize_mode(); - this.set({ 'title' : record.id ? record.display_name : "New" }); + this.set({ 'title' : record.id ? record.display_name : _t("New") }); _(this.fields).each(function (field, f) { field._dirty_flag = false; @@ -431,7 +431,7 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM var onchange = _.str.trim(on_change); var call = onchange.match(/^\s?(.*?)\((.*?)\)\s?$/); if (!call) { - throw new Error("Wrong on change format: " + onchange); + throw new Error(_.str.sprintf( _t("Wrong on change format: %s"), onchange )); } var method = call[1]; @@ -872,7 +872,7 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM }).value(); warnings.unshift(''); - this.do_warn("The following fields are invalid :", warnings.join('')); + this.do_warn(_t("The following fields are invalid:", warnings.join('')); }, /** * Reload the form after saving @@ -1241,11 +1241,11 @@ instance.web.form.FormRenderingEngine = instance.web.form.FormRenderingEngineInt _.each(this.fields_to_init, function($elem) { var name = $elem.attr("name"); if (!self.fvg.fields[name]) { - throw new Error("Field '" + name + "' specified in view could not be found."); + throw new Error(_.str.sprintf(_t("Field '%s' specified in view could not be found."), name)); } var obj = self.fields_registry.get_any([$elem.attr('widget'), self.fvg.fields[name].type]); if (!obj) { - throw new Error("Widget type '"+ $elem.attr('widget') + "' is not implemented"); + throw new Error(_.str.sprintf(_t("Widget type '%s' is not implemented"), $elem.attr('widget'))); } var w = new (obj)(self.view, instance.web.xml_to_json($elem[0])); var $label = self.labels[$elem.attr("name")]; @@ -2319,7 +2319,7 @@ instance.web.form.FieldEmail = instance.web.form.FieldChar.extend({ }, on_button_clicked: function() { if (!this.get('value') || !this.is_syntax_valid()) { - this.do_warn("E-mail error", "Can't send email to invalid e-mail address"); + this.do_warn(_t("E-mail error"), _t("Can't send email to invalid e-mail address")); } else { location.href = 'mailto:' + this.get('value'); } @@ -2348,7 +2348,7 @@ instance.web.form.FieldUrl = instance.web.form.FieldChar.extend({ }, on_button_clicked: function() { if (!this.get('value')) { - this.do_warn("Resource error", "This resource is empty"); + this.do_warn(_t("Resource error"), _t("This resource is empty")); } else { var url = $.trim(this.get('value')); if(/^www\./i.test(url)) @@ -3385,7 +3385,7 @@ instance.web.form.FieldOne2Many = instance.web.form.AbstractField.extend({ var views = []; _.each(modes, function(mode) { if (! _.include(["list", "tree", "graph", "kanban"], mode)) { - throw new Error(_.str.sprintf("View type '%s' is not supported in One2Many.", mode)); + throw new Error(_.str.sprintf(_t("View type '%s' is not supported in One2Many."), mode)); } var view = { view_id: false, @@ -4840,7 +4840,7 @@ instance.web.form.FieldBinary = instance.web.form.AbstractField.extend(instance. }, on_file_uploaded: function(size, name, content_type, file_base64) { if (size === false) { - this.do_warn("File Upload", "There was a problem while uploading your file"); + this.do_warn(_t("File Upload"), _t("There was a problem while uploading your file")); // TODO: use openerp web crashmanager console.warn("Error while uploading file : ", name); } else { @@ -5009,7 +5009,7 @@ instance.web.form.FieldMany2ManyBinaryMultiFiles = instance.web.form.AbstractFie this.field_manager = field_manager; this.node = node; if(this.field.type != "many2many" || this.field.relation != 'ir.attachment') { - throw "The type of the field '"+this.field.string+"' must be a many2many field with a relation to 'ir.attachment' model."; + throw _.str.sprintf(_t("The type of the field '%s' must be a many2many field with a relation to 'ir.attachment' model."), this.field.string); } this.ds_file = new instance.web.DataSetSearch(this, 'ir.attachment'); this.fileupload_id = _.uniqueId('oe_fileupload_temp'); diff --git a/addons/web/static/src/js/view_list.js b/addons/web/static/src/js/view_list.js index 13c41d48599..5008d1765a6 100644 --- a/addons/web/static/src/js/view_list.js +++ b/addons/web/static/src/js/view_list.js @@ -389,7 +389,7 @@ instance.web.ListView = instance.web.View.extend( /** @lends instance.web.ListVi if (range_stop > total) { range_stop = total; } - spager = _.str.sprintf('%d-%d of %d', range_start, range_stop, total); + spager = _.str.sprintf(_t("%d-%d of %d"), range_start, range_stop, total); } this.$pager.find('.oe_list_pager_state').text(spager); @@ -887,8 +887,8 @@ instance.web.ListView.List = instance.web.Class.extend( /** @lends instance.web. var $row; if (attribute === 'id') { if (old_value) { - throw new Error("Setting 'id' attribute on existing record " - + JSON.stringify(record.attributes)); + throw new Error(_.str.sprintf( _t("Setting 'id' attribute on existing record %s"), + JSON.stringify(record.attributes) )); } if (!_.contains(self.dataset.ids, value)) { // add record to dataset if not already in (added by @@ -956,7 +956,7 @@ instance.web.ListView.List = instance.web.Class.extend( /** @lends instance.web. if (row_id) { e.stopPropagation(); if (!self.dataset.select_id(row_id)) { - throw new Error("Could not find id in dataset"); + throw new Error(_t("Could not find id in dataset")); } self.row_clicked(e); } @@ -1016,7 +1016,7 @@ instance.web.ListView.List = instance.web.Class.extend( /** @lends instance.web. var command = value[0]; // 1. an array of m2m commands (usually (6, false, ids)) if (command[0] !== 6) { - throw new Error(_t("Unknown m2m command ") + command[0]); + throw new Error(_.str.sprintf( _t("Unknown m2m command %s"), command[0])); } ids = command[2]; } else { @@ -1324,7 +1324,7 @@ instance.web.ListView.Groups = instance.web.Class.extend( /** @lends instance.we } // group_label is html-clean (through format or explicit // escaping if format failed), can inject straight into HTML - $group_column.html(_.str.sprintf("%s (%d)", + $group_column.html(_.str.sprintf(_t("%s (%d)"), group_label, group.length)); if (group.length && group.openable) { @@ -1743,7 +1743,7 @@ var Record = instance.web.Class.extend(/** @lends Record# */{ } else if (val instanceof Array) { output[k] = val[0]; } else { - throw new Error("Can't convert value " + val + " to context"); + throw new Error(_.str.sprintf(_t("Can't convert value %s to context"), val)); } } return output; diff --git a/addons/web/static/src/js/view_list_editable.js b/addons/web/static/src/js/view_list_editable.js index 7fe6a8ec42b..e3f35e2068c 100644 --- a/addons/web/static/src/js/view_list_editable.js +++ b/addons/web/static/src/js/view_list_editable.js @@ -3,7 +3,9 @@ * @namespace */ openerp.web.list_editable = function (instance) { - // editability status of list rows + var _t = instance.web._t; + + // editability status of list rows instance.web.ListView.prototype.defaults.editable = null; // TODO: not sure second @lends on existing item is correct, to check @@ -775,7 +777,7 @@ openerp.web.list_editable = function (instance) { cancel: function (force) { if (!(force || this.form.can_be_discarded())) { return $.Deferred().reject({ - message: "The form's data can not be discarded"}).promise(); + message: _t("The form's data can not be discarded")}).promise(); } var record = this.record; this.record = null; diff --git a/addons/web/static/src/js/views.js b/addons/web/static/src/js/views.js index ddedcdd2ff6..600a0b065c1 100644 --- a/addons/web/static/src/js/views.js +++ b/addons/web/static/src/js/views.js @@ -786,7 +786,7 @@ instance.web.ViewManagerAction = instance.web.ViewManager.extend({ break; case 'tests': this.do_action({ - name: "JS Tests", + name: _t("JS Tests"), target: 'new', type : 'ir.actions.act_url', url: '/web/tests?mod=*' @@ -814,7 +814,7 @@ instance.web.ViewManagerAction = instance.web.ViewManager.extend({ break; case 'translate': this.do_action({ - name: "Technical Translation", + name: _t("Technical Translation"), res_model : 'ir.translation', domain : [['type', '!=', 'object'], '|', ['name', '=', this.dataset.model], ['name', 'ilike', this.dataset.model + ',']], views: [[false, 'list'], [false, 'form']], @@ -1395,7 +1395,7 @@ instance.web.json_node_to_xml = function(node, human_readable, indent) { return sindent + node; } else if (typeof(node.tag) !== 'string' || !node.children instanceof Array || !node.attrs instanceof Object) { throw new Error( - _.str.sprintf("Node [%s] is not a JSONified XML node", + _.str.sprintf(_t("Node [%s] is not a JSONified XML node"), JSON.stringify(node))); } for (var attr in node.attrs) { @@ -1429,7 +1429,7 @@ instance.web.xml_to_str = function(node) { } else if (window.ActiveXObject) { return node.xml; } else { - throw new Error("Could not serialize XML"); + throw new Error(_t("Could not serialize XML")); } }; instance.web.str_to_xml = function(s) { @@ -1437,7 +1437,7 @@ instance.web.str_to_xml = function(s) { var dp = new DOMParser(); var r = dp.parseFromString(s, "text/xml"); if (r.body && r.body.firstChild && r.body.firstChild.nodeName == 'parsererror') { - throw new Error("Could not parse string to xml"); + throw new Error(_t("Could not parse string to xml")); } return r; } @@ -1445,7 +1445,7 @@ instance.web.str_to_xml = function(s) { try { xDoc = new ActiveXObject("MSXML2.DOMDocument"); } catch (e) { - throw new Error("Could not find a DOM Parser: " + e.message); + throw new Error(_.str.sprintf( _t("Could not find a DOM Parser: %s"), e.message)); } xDoc.async = false; xDoc.preserveWhiteSpace = true; diff --git a/addons/web_calendar/static/src/js/calendar.js b/addons/web_calendar/static/src/js/calendar.js index 5fd9b6677a0..46d25e749a2 100644 --- a/addons/web_calendar/static/src/js/calendar.js +++ b/addons/web_calendar/static/src/js/calendar.js @@ -88,7 +88,7 @@ instance.web_calendar.CalendarView = instance.web.View.extend({ this.fields = this.fields_view.fields; if (!this.date_start) { - throw new Error("Calendar view has not defined 'date_start' attribute."); + throw new Error(_t("Calendar view has not defined 'date_start' attribute.")); } //* Calendar Fields * @@ -96,7 +96,7 @@ instance.web_calendar.CalendarView = instance.web.View.extend({ if (this.date_delay) { if (this.fields[this.date_delay].type != 'float') { - throw new Error("Calendar view has a 'date_delay' type != float"); + throw new Error(_t("Calendar view has a 'date_delay' type != float")); } this.calendar_fields.date_delay = {'name': this.date_delay, 'kind': this.fields[this.date_delay].type}; } diff --git a/addons/web_kanban/static/src/js/kanban.js b/addons/web_kanban/static/src/js/kanban.js index 4e9157e1d75..c93d7d333e4 100644 --- a/addons/web_kanban/static/src/js/kanban.js +++ b/addons/web_kanban/static/src/js/kanban.js @@ -409,7 +409,7 @@ instance.web_kanban.KanbanView = instance.web.View.extend({ new_group.do_save_sequences(); }).fail(function(error, evt) { evt.preventDefault(); - alert("An error has occured while moving the record to this group."); + alert(_t("An error has occured while moving the record to this group.")); self.do_reload(); // TODO: use draggable + sortable in order to cancel the dragging when the rcp fails }); } diff --git a/addons/web_view_editor/static/src/js/view_editor.js b/addons/web_view_editor/static/src/js/view_editor.js index a844c0f3be8..6b70914f332 100644 --- a/addons/web_view_editor/static/src/js/view_editor.js +++ b/addons/web_view_editor/static/src/js/view_editor.js @@ -161,7 +161,7 @@ instance.web_view_editor.ViewEditor = instance.web.Widget.extend({ } }); msg += ""; - this.do_warn("The following fields are invalid :", msg); + this.do_warn(_t("The following fields are invalid :"), msg); }, add_node_name : function(node) { if(node.tagName.toLowerCase() == "button" || node.tagName.toLowerCase() == "field"){ @@ -260,7 +260,7 @@ instance.web_view_editor.ViewEditor = instance.web.Widget.extend({ "arch": view_arch_list}); }); } else { - self.do_warn("Please select view in list :"); + self.do_warn(_t("Please select view in list :")); } }); }, @@ -387,10 +387,10 @@ instance.web_view_editor.ViewEditor = instance.web.Widget.extend({ self.inherited_view(selected_row); } }else{ - alert("Can't Update View"); + alert(_t("Can't Update View")); } }else{ - alert("Select an element"); + alert(_t("Select an element")); } }}, {text: _t("Preview"), click: function() { @@ -983,7 +983,7 @@ instance.web_view_editor.ViewEditor = instance.web.Widget.extend({ } else { table_selector.append('' + node.string + '' + type_widget.render() ); if (node.name == "field_value") { - table_selector.append(' '); + table_selector.append(' '); } } type_widget.start(); From e2435d4f004a20636aef8a8ee2cc03c8cfc3e78c Mon Sep 17 00:00:00 2001 From: tsabi <> Date: Thu, 29 Nov 2012 02:18:22 +0100 Subject: [PATCH 02/11] fixed a typo that maked javascript error bzr revid: tsabi-20121129011822-fv9v0l72231y0093 --- addons/web/static/src/js/view_form.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index dd9b2be5fb0..06c1a3d989b 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -872,7 +872,7 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM }).value(); warnings.unshift(''); - this.do_warn(_t("The following fields are invalid:", warnings.join('')); + this.do_warn(_t("The following fields are invalid:"), warnings.join('')); }, /** * Reload the form after saving From 93eddbd4a8e60522c209761da08b7b4d200e7f00 Mon Sep 17 00:00:00 2001 From: Fabien Pinckaers Date: Thu, 29 Nov 2012 12:27:37 +0100 Subject: [PATCH 03/11] [IMP] fixes for kanban column visible in tasks & issues bzr revid: fp@tinyerp.com-20121129112737-w3h80e7nbxs0l5lp --- addons/project/project.py | 14 +++----------- addons/project_issue/project_issue.py | 8 +++----- 2 files changed, 6 insertions(+), 16 deletions(-) diff --git a/addons/project/project.py b/addons/project/project.py index 68122d1a614..c6577b00e6a 100644 --- a/addons/project/project.py +++ b/addons/project/project.py @@ -603,18 +603,13 @@ class task(base_stage, osv.osv): stage_obj = self.pool.get('project.task.type') order = stage_obj._order access_rights_uid = access_rights_uid or uid - # lame way to allow reverting search, should just work in the trivial case if read_group_order == 'stage_id desc': order = '%s desc' % order - # retrieve section_id from the context and write the domain - # - ('id', 'in', 'ids'): add columns that should be present - # - OR ('case_default', '=', True), ('fold', '=', False): add default columns that are not folded - # - OR ('project_ids', 'in', project_id), ('fold', '=', False) if project_id: add project columns that are not folded search_domain = [] project_id = self._resolve_project_id_from_context(cr, uid, context=context) if project_id: search_domain += ['|', ('project_ids', '=', project_id)] - search_domain += ['|', ('id', 'in', ids), ('case_default', '=', True)] + search_domain += [('id', 'in', ids)] stage_ids = stage_obj._search(cr, uid, search_domain, order=order, access_rights_uid=access_rights_uid, context=context) result = stage_obj.name_get(cr, access_rights_uid, stage_ids, context=context) # restore order of the search @@ -750,7 +745,7 @@ class task(base_stage, osv.osv): 'priority': fields.selection([('4','Very Low'), ('3','Low'), ('2','Medium'), ('1','Important'), ('0','Very important')], 'Priority', select=True), 'sequence': fields.integer('Sequence', select=True, help="Gives the sequence order when displaying a list of tasks."), 'stage_id': fields.many2one('project.task.type', 'Stage', - domain="['&', ('fold', '=', False), '|', ('project_ids', '=', project_id), ('case_default', '=', True)]"), + domain="['&', ('fold', '=', False), ('project_ids', '=', project_id)]"), 'state': fields.related('stage_id', 'state', type="selection", store=True, selection=_TASK_STATE, string="Status", readonly=True, help='The status is set to \'Draft\', when a case is created.\ @@ -936,14 +931,11 @@ class task(base_stage, osv.osv): for task in cases: if task.project_id: section_ids.append(task.project_id.id) - # OR all section_ids and OR with case_default search_domain = [] if section_ids: - search_domain += [('|')] * len(section_ids) + search_domain = [('|')] * (len(section_ids)-1) for section_id in section_ids: search_domain.append(('project_ids', '=', section_id)) - search_domain.append(('case_default', '=', True)) - # AND with the domain in parameter search_domain += list(domain) # perform search, return the first found stage_ids = self.pool.get('project.task.type').search(cr, uid, search_domain, order=order, context=context) diff --git a/addons/project_issue/project_issue.py b/addons/project_issue/project_issue.py index 90640363906..fe5ce9f325b 100644 --- a/addons/project_issue/project_issue.py +++ b/addons/project_issue/project_issue.py @@ -89,7 +89,7 @@ class project_issue(base_stage, osv.osv): project_id = self._resolve_project_id_from_context(cr, uid, context=context) if project_id: search_domain += ['|', ('project_ids', '=', project_id)] - search_domain += ['|', ('id', 'in', ids), ('case_default', '=', True)] + search_domain += [('id', 'in', ids)] # perform search stage_ids = stage_obj._search(cr, uid, search_domain, order=order, access_rights_uid=access_rights_uid, context=context) result = stage_obj.name_get(cr, access_rights_uid, stage_ids, context=context) @@ -244,7 +244,7 @@ class project_issue(base_stage, osv.osv): 'priority': fields.selection(crm.AVAILABLE_PRIORITIES, 'Priority', select=True), 'version_id': fields.many2one('project.issue.version', 'Version'), 'stage_id': fields.many2one ('project.task.type', 'Stage', - domain="['&', ('fold', '=', False), '|', ('project_ids', '=', project_id), ('case_default', '=', True)]"), + domain="['&', ('fold', '=', False), ('project_ids', '=', project_id)]"), 'project_id':fields.many2one('project.project', 'Project'), 'duration': fields.float('Duration'), 'task_id': fields.many2one('project.task', 'Task', domain="[('project_id','=',project_id)]"), @@ -442,11 +442,9 @@ class project_issue(base_stage, osv.osv): # OR all section_ids and OR with case_default search_domain = [] if section_ids: - search_domain += [('|')] * len(section_ids) + search_domain += [('|')] * (len(section_ids)-1) for section_id in section_ids: search_domain.append(('project_ids', '=', section_id)) - search_domain.append(('case_default', '=', True)) - # AND with the domain in parameter search_domain += list(domain) # perform search, return the first found stage_ids = self.pool.get('project.task.type').search(cr, uid, search_domain, order=order, context=context) From 72109e7541c1748e066ff4fe8b60a3cfa052d247 Mon Sep 17 00:00:00 2001 From: tsabi Date: Thu, 29 Nov 2012 12:53:06 +0100 Subject: [PATCH 04/11] fix tab problem bzr revid: csaba.toth@i3rendszerhaz.hu-20121129115306-ifncjymnmuk989eq --- addons/web/static/src/js/view_list_editable.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/web/static/src/js/view_list_editable.js b/addons/web/static/src/js/view_list_editable.js index e3f35e2068c..17f757d4e72 100644 --- a/addons/web/static/src/js/view_list_editable.js +++ b/addons/web/static/src/js/view_list_editable.js @@ -3,9 +3,9 @@ * @namespace */ openerp.web.list_editable = function (instance) { - var _t = instance.web._t; + var _t = instance.web._t; - // editability status of list rows + // editability status of list rows instance.web.ListView.prototype.defaults.editable = null; // TODO: not sure second @lends on existing item is correct, to check From 83b7823f257b17403a11908c9b359244635cf0b7 Mon Sep 17 00:00:00 2001 From: tsabi Date: Thu, 29 Nov 2012 12:54:54 +0100 Subject: [PATCH 05/11] some more change in the new pyeval.js file bzr revid: csaba.toth@i3rendszerhaz.hu-20121129115454-rpviywfnosjdmovm --- addons/web/static/src/js/pyeval.js | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/addons/web/static/src/js/pyeval.js b/addons/web/static/src/js/pyeval.js index 265449f9f64..417459b3a63 100644 --- a/addons/web/static/src/js/pyeval.js +++ b/addons/web/static/src/js/pyeval.js @@ -2,6 +2,7 @@ * py.js helpers and setup */ openerp.web.pyeval = function (instance) { + var _t = instance.web._t; instance.web.pyeval = {}; var obj = function () {}; @@ -71,7 +72,7 @@ openerp.web.pyeval = function (instance) { var ymd2ord = function (year, month, day) { var dim = days_in_month(year, month); if (!(1 <= day && day <= dim)) { - throw new Error("ValueError: day must be in 1.." + dim); + throw new Error(_.str.sprintf(_t("ValueError: day must be in 1..%d"), dim)); } return days_before_year(year) + days_before_month(year, month) @@ -277,10 +278,11 @@ openerp.web.pyeval = function (instance) { }); var s = _.str.sprintf("%d:%02d:%02d", hh, mm, ss); if (this.days) { - s = _.str.sprintf("%d day%s, %s", - this.days, - (this.days != 1 && this.days != -1) ? 's' : '', - s); + if (this.days != 1 && this.days != -1) { + s = _.str.sprintf(_t("%d days, %s"), this.days, s); + } else { + s = _.str.sprintf(_t("%d day, %s"), this.days, s); + }; } if (this.microseconds) { s = _.str.sprintf("%s.%06d", s, this.microseconds); @@ -726,7 +728,7 @@ openerp.web.pyeval = function (instance) { case 'context': case 'compound_context': return instance.web.pyeval.eval('contexts', [arg]); default: - throw new Error(instance.web._t("Unknown nonliteral type " + arg.__ref)); + throw new Error(_t("Unknown nonliteral type ") + arg.__ref); } }; /** @@ -760,11 +762,11 @@ openerp.web.pyeval = function (instance) { } catch (e) { d.resolve({ error: { code: 400, - message: instance.web._t("Evaluation Error"), + message: _t("Evaluation Error"), data: { type: 'local_exception', debug: _.str.sprintf( - instance.web._t("Local evaluation failure\n%s\n\n%s"), + _t("Local evaluation failure\n%s\n\n%s"), e.message, JSON.stringify(source)) } }}); From 7bfab22e1f6699890d79512f2b7f8ac486fa52f0 Mon Sep 17 00:00:00 2001 From: Fabien Meghazi Date: Thu, 29 Nov 2012 13:07:38 +0100 Subject: [PATCH 06/11] [FIX] Propagate context to kanban's add_group() action bzr revid: fme@openerp.com-20121129120738-fgulo5hqib2uqeqa --- addons/web_kanban/static/src/js/kanban.js | 1 + 1 file changed, 1 insertion(+) diff --git a/addons/web_kanban/static/src/js/kanban.js b/addons/web_kanban/static/src/js/kanban.js index 4e9157e1d75..4eabcf0533b 100644 --- a/addons/web_kanban/static/src/js/kanban.js +++ b/addons/web_kanban/static/src/js/kanban.js @@ -190,6 +190,7 @@ instance.web_kanban.KanbanView = instance.web.View.extend({ views: [[false, 'form']], type: 'ir.actions.act_window', target: "new", + context: self.dataset.get_context(), flags: { action_buttons: true, } From bd61641572949ab2c9b1a07267cd7d7344d17a7d Mon Sep 17 00:00:00 2001 From: Fabien Pinckaers Date: Thu, 29 Nov 2012 14:06:55 +0100 Subject: [PATCH 07/11] [FIX] project issue bzr revid: fp@tinyerp.com-20121129130655-rm5hrk8m7tsy8g4v --- addons/project/project.py | 6 ++++++ addons/project/project_demo.xml | 21 +++++++++++++++++++-- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/addons/project/project.py b/addons/project/project.py index c6577b00e6a..b7c88f3532b 100644 --- a/addons/project/project.py +++ b/addons/project/project.py @@ -49,11 +49,17 @@ class project_task_type(osv.osv): 'fold': fields.boolean('Hide in views if empty', help="This stage is not visible, for example in status bar or kanban view, when there are no records in that stage to display."), } + def _get_default_project_id(self, cr, uid, ctx={}): + proj = ctx.get('default_project_id', False) + if type(proj) is int: + return [proj] + return proj _defaults = { 'sequence': 1, 'state': 'open', 'fold': False, 'case_default': True, + 'project_ids': _get_default_project_id } _order = 'sequence' diff --git a/addons/project/project_demo.xml b/addons/project/project_demo.xml index ee887c2728c..d2bf7d0a2df 100644 --- a/addons/project/project_demo.xml +++ b/addons/project/project_demo.xml @@ -36,6 +36,10 @@ Implement new website for Sale and Warehouse Management for a customer. project.task + + + + @@ -45,6 +49,10 @@ public project.task + + + + @@ -58,6 +66,9 @@ + + + @@ -67,24 +78,30 @@ Website Design Templates project.task - + + + + 2 Data Import/Export Plugin project.task - + + + + From 9f76458404ff3d99824149d09121952c4f2fc775 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Thu, 29 Nov 2012 14:13:01 +0100 Subject: [PATCH 08/11] [FIX] groupby on editable list Because of the "meta" columns (e.g. group name column), ListView#columns would end up with a different number of elements than ListView#fields_view.arch.children, and when zipping them together (to build the form view for edition) things wouldn't match anymore. It would seem simply filtering out meta columns (and only keep those actually specified by the view) is sufficient to fix the issue and have everything line up again. I'm midly impressed. bzr revid: xmo@openerp.com-20121129131301-scc38i4l55ea7lis --- addons/web/static/src/js/view_list_editable.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/web/static/src/js/view_list_editable.js b/addons/web/static/src/js/view_list_editable.js index 7fe6a8ec42b..79b91a41b3c 100644 --- a/addons/web/static/src/js/view_list_editable.js +++ b/addons/web/static/src/js/view_list_editable.js @@ -383,7 +383,8 @@ openerp.web.list_editable = function (instance) { version: '7.0' }); _(view.arch.children).chain() - .zip(this.columns) + .zip(_(this.columns).filter(function (c) { + return !(c instanceof instance.web.list.MetaColumn);})) .each(function (ar) { var widget = ar[0], column = ar[1]; var modifiers = _.extend({}, column.modifiers); From 759f11f11077514bbf5e45ffa88a69ec1d0066ef Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Thu, 29 Nov 2012 14:27:38 +0100 Subject: [PATCH 09/11] [FIX] py.js: bug in tokenization of single-quoted empty string bzr revid: xmo@openerp.com-20121129132738-fcnam8bkqyt7h8ey --- addons/web/static/lib/py.js/.hg_archival.txt | 4 ++-- addons/web/static/lib/py.js/lib/py.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/web/static/lib/py.js/.hg_archival.txt b/addons/web/static/lib/py.js/.hg_archival.txt index 33dcdd88830..771b798ac84 100644 --- a/addons/web/static/lib/py.js/.hg_archival.txt +++ b/addons/web/static/lib/py.js/.hg_archival.txt @@ -1,5 +1,5 @@ repo: 076b192d0d8ab2b92d1dbcfa3da055382f30eaea -node: ccf62e5d0291f66a39f4049f3e880004e59c3654 +node: 2b62048dd1d86c45e4bf0442b5da4122534132bf branch: default latesttag: 0.7 -latesttagdistance: 4 +latesttagdistance: 5 diff --git a/addons/web/static/lib/py.js/lib/py.js b/addons/web/static/lib/py.js/lib/py.js index 854232a0d80..04ecd3aeb5c 100644 --- a/addons/web/static/lib/py.js/lib/py.js +++ b/addons/web/static/lib/py.js/lib/py.js @@ -311,7 +311,7 @@ var py = {}; } else if (string_pattern.test(token)) { var m = string_pattern.exec(token); tokens.push(create(symbols['(string)'], { - value: m[2] || m[3] + value: (m[2] !== undefined ? m[2] : m[3]) })); } else if (token in symbols) { var symbol; From 184593003b3aec7d40660ae13002f4a4a205fa12 Mon Sep 17 00:00:00 2001 From: niv-openerp Date: Thu, 29 Nov 2012 14:40:51 +0100 Subject: [PATCH 10/11] [FIX] race condition problem with m2m bzr revid: nicolas.vanhoren@openerp.com-20121129134051-5hiw9z5hi99fxtve --- addons/web/static/src/js/view_form.js | 76 ++++++++++++--------------- 1 file changed, 35 insertions(+), 41 deletions(-) diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index 49f4e30815f..ad5fcdd29d8 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -4069,13 +4069,12 @@ instance.web.form.FieldMany2ManyTags = instance.web.form.AbstractField.extend(in If you see this options, do not use it, it's basically a dirty hack to make one precise o2m to behave the way we want. */ -instance.web.form.FieldMany2Many = instance.web.form.AbstractField.extend({ +instance.web.form.FieldMany2Many = instance.web.form.AbstractField.extend(instance.web.form.ReinitializeFieldMixin, { multi_selection: false, disable_utility_classes: true, init: function(field_manager, node) { this._super(field_manager, node); this.is_loaded = $.Deferred(); - this.initial_is_loaded = this.is_loaded; this.dataset = new instance.web.form.Many2ManyDataSet(this, this.field.relation); this.dataset.m2m = this; var self = this; @@ -4083,24 +4082,44 @@ instance.web.form.FieldMany2Many = instance.web.form.AbstractField.extend({ self.dataset_changed(); }); this.set_value([]); + this.list_dm = new instance.web.DropMisordered(); + this.render_value_dm = new instance.web.DropMisordered(); }, - start: function() { - this.$el.addClass('oe_form_field oe_form_field_many2many'); - + initialize_content: function() { var self = this; - self.load_view(); - this.is_loaded.done(function() { - self.on("change:effective_readonly", self, function() { - self.is_loaded = self.is_loaded.then(function() { - self.list_view.destroy(); - return $.when(self.load_view()).done(function() { - self.render_value(); - }); - }); + this.$el.addClass('oe_form_field oe_form_field_many2many'); + + this.list_view = new instance.web.form.Many2ManyListView(this, this.dataset, false, { + 'addable': this.get("effective_readonly") ? null : _t("Add"), + 'deletable': this.get("effective_readonly") ? false : true, + 'selectable': this.multi_selection, + 'sortable': false, + 'reorderable': false, + 'import_enabled': false, }); + var embedded = (this.field.views || {}).tree; + if (embedded) { + this.list_view.set_embedded_view(embedded); + } + this.list_view.m2m_field = this; + var loaded = $.Deferred(); + this.list_view.on("list_view_loaded", this, function() { + loaded.resolve(); }); - this._super.apply(this, arguments); + this.list_view.appendTo(this.$el); + + var old_def = self.is_loaded; + self.is_loaded = $.Deferred().done(function() { + old_def.resolve(); + }); + this.list_dm.add(loaded).then(function() { + self.is_loaded.resolve(); + }); + }, + destroy_content: function() { + this.list_view.destroy(); + this.list_view = undefined; }, set_value: function(value_) { value_ = value_ || []; @@ -4115,35 +4134,10 @@ instance.web.form.FieldMany2Many = instance.web.form.AbstractField.extend({ is_false: function () { return _(this.get("value")).isEmpty(); }, - load_view: function() { - var self = this; - this.list_view = new instance.web.form.Many2ManyListView(this, this.dataset, false, { - 'addable': self.get("effective_readonly") ? null : _t("Add"), - 'deletable': self.get("effective_readonly") ? false : true, - 'selectable': self.multi_selection, - 'sortable': false, - 'reorderable': false, - 'import_enabled': false, - }); - var embedded = (this.field.views || {}).tree; - if (embedded) { - this.list_view.set_embedded_view(embedded); - } - this.list_view.m2m_field = this; - var loaded = $.Deferred(); - this.list_view.on("list_view_loaded", self, function() { - self.initial_is_loaded.resolve(); - loaded.resolve(); - }); - $.async_when().done(function () { - self.list_view.appendTo(self.$el); - }); - return loaded; - }, render_value: function() { var self = this; this.dataset.set_ids(this.get("value")); - this.is_loaded = this.is_loaded.then(function() { + this.render_value_dm.add(this.is_loaded).then(function() { return self.list_view.reload_content(); }); }, From c166c19ed18a2737d7a885641ebb7b0d25f2b0ed Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Thu, 29 Nov 2012 15:17:59 +0100 Subject: [PATCH 11/11] [REM] dead code from evaluation being client-side only bzr revid: xmo@openerp.com-20121129141759-wj4je85nkrfznql1 --- addons/web/session.py | 30 ------------------------------ 1 file changed, 30 deletions(-) diff --git a/addons/web/session.py b/addons/web/session.py index 523aaa9f1fa..65e3beab84a 100644 --- a/addons/web/session.py +++ b/addons/web/session.py @@ -188,34 +188,4 @@ class OpenERPSession(object): context['lang'] = lang - @property - def base_eval_context(self): - """ Default evaluation context for the session. - - Used to evaluate contexts and domains. - """ - base = dict( - uid=self._uid, - current_date=datetime.date.today().strftime('%Y-%m-%d'), - time=time, - datetime=datetime, - relativedelta=dateutil.relativedelta.relativedelta - ) - base.update(self.context) - return base - - def evaluation_context(self, context=None): - """ Returns the session's evaluation context, augmented with the - provided context if any. - - :param dict context: to add merge in the session's base eval context - :returns: the augmented context - :rtype: dict - """ - d = dict(self.base_eval_context) - if context: - d.update(context) - d['context'] = d - return d - # vim:et:ts=4:sw=4: