Keanehan Odoo Parameter web.base.url

Kenapa suka berubah reset sendiri ke nilai awal ?

vITraining Admin

Pernah nemu parameter web.base.url berubah reset sendiri ke nilai awal, apa itu IP address server atau domain server tanpa port... ?

Ternyata di coding nya Odoo memang ada perintah untuk nge-reset parameter tsb...

Di file odooc/odoo/addons/base/res/res_users.py baris 466:

@classmethod
def authenticate(cls, db, login, password, user_agent_env):
        """Verifies and returns the user ID corresponding to the given
 ``login`` and ``password`` combination, or False if there was
 no matching user.
           :param str db: the database on which user is trying to authenticate
 :param str login: username
 :param str password: user password
 :param dict user_agent_env: environment dictionary describing any
 relevant environment attributes
 """
 uid = cls._login(db, login, password)
 if uid == SUPERUSER_ID:
            # Successfully logged in as admin!
            # Attempt to guess the web base url...
            if user_agent_env and user_agent_env.get('base_location'):
                try:
                    with cls.pool.cursor() as cr:
                        base = user_agent_env['base_location']
 ICP = api.Environment(cr, uid, {})['ir.config_parameter']
   if not ICP.get_param('web.base.url.freeze'):
                            ICP.set_param('web.base.url', base)

 except Exception:
                    _logger.exception("Failed to update web.base.url configuration parameter")
 return uid


Jadi kalau login sebagai admin, Odoo berusaha nge-reset nilai web.base.url dengan environtment base_location si admin, yang bisa berupa domain maupun IP address local server, kecuali kalau kita set parameter web.base.url.freeze dengan True.

Jadi solusi supaya web.base.url nggak ke-reset, cukup tambah parameter web.base.url.freeze dengan nilai True.


Materi ini is part of Odoo Advanced Training yang dibuka oleh vitraining.com Klik vitraining.com untuk jadwal training selengkapnya. Sekarang kita sudah buka kelas di Bandung dan Surabaya, selain kelas Online teleconference.