Skip to content

Commit d2de0a8

Browse files
Xavier-DoKangOl
andcommitted
[IMP] fields: use ignored field for respawn
When a field reappears after an upgrade, a log with the format "field ... has respawn!" is emited. In some case, it is possible that this error should be silenced. The current case was because an upgrade script targeting 18.2 was merged during the freeze and should target 18.3. During a short time frame after a freeze, some branch may be tested without testing the upgrade from the freshly created branch since no template are available. In this case, a script was merged with an invalid version number. A pull request (#7240) was created to fix it but it took some time to be merged and then to be used by latest builds. An exeption was added in master, fixing the 18.2-> master but this exception was not working for the 18.*->18.2 error. This commit will use the same exception to silence this error allowing quick fixes in this kind of situation. closes #213 Related: odoo/upgrade#7261 Signed-off-by: Christophe Simonis (chs) <[email protected]> Co-authored-by: Christophe Simonis <[email protected]>
1 parent 0eb4088 commit d2de0a8

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/base/0.0.0/end-no-respawn-fields.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# -*- coding: utf-8 -*-
22
import logging
3+
import os
34

45
from psycopg2.extras import execute_values
56

@@ -40,10 +41,22 @@ def migrate(cr, version):
4041
"""
4142
)
4243

44+
key = "field_respawn:"
45+
ignored_fields_respawn = {
46+
e[len(key) :]
47+
for e in os.environ.get("suppress_upgrade_warnings", "").split(",") # noqa: SIM112
48+
if e.startswith(key)
49+
}
50+
4351
for model, field, transient, store in cr.fetchall():
4452
qualifier = "field" if store else "non-stored field"
4553
if transient:
4654
qualifier = "transient " + qualifier
4755
lvl = util.NEARLYWARN if transient or not store else logging.CRITICAL
56+
action = ""
57+
58+
if "{}/{}".format(model, field) in ignored_fields_respawn:
59+
lvl = util.NEARLYWARN
60+
action = "; explicitly ignored"
4861

49-
_logger.log(lvl, "%s %s/%s has respawn!", qualifier, model, field)
62+
_logger.log(lvl, "%s %s/%s has respawn%s.", qualifier, model, field, action)

0 commit comments

Comments
 (0)