[FIX] base: allow admin to freeze the value of "web.base.url" config parameter.
authorChristophe Simonis <chs@openerp.com>
Fri, 1 Mar 2013 09:55:51 +0000 (10:55 +0100)
committerChristophe Simonis <chs@openerp.com>
Fri, 1 Mar 2013 09:55:51 +0000 (10:55 +0100)
This config parameter is automatically updated when the admin log-in.
As this value is mean to be used in emails and links given to users, we sometime don't want
it to be updated inconditionnaly. In some cases, the admin may use alternative, private or
even local uri to connect to the server, which may not be suitable for users

bzr revid: chs@openerp.com-20130301095551-fzrlwblnawxqj9di

openerp/addons/base/res/res_users.py

index df83f0a..da70d0d 100644 (file)
@@ -3,7 +3,7 @@
 #
 #    OpenERP, Open Source Management Solution
 #    Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
-#    Copyright (C) 2010-2012 OpenERP s.a. (<http://openerp.com>).
+#    Copyright (C) 2010-2013 OpenERP s.a. (<http://openerp.com>).
 #
 #    This program is free software: you can redistribute it and/or modify
 #    it under the terms of the GNU Affero General Public License as
@@ -426,7 +426,9 @@ class res_users(osv.osv):
                 cr = pooler.get_db(db).cursor()
                 try:
                     base = user_agent_env['base_location']
-                    self.pool.get('ir.config_parameter').set_param(cr, uid, 'web.base.url', base)
+                    ICP = self.pool.get('ir.config_parameter')
+                    if not ICP.get_param(cr, uid, 'web.base.url.freeze'):
+                        ICP.set_param(cr, uid, 'web.base.url', base)
                     cr.commit()
                 except Exception:
                     _logger.exception("Failed to update web.base.url configuration parameter")