Skip to content

Commit 5e5b65e

Browse files
committed
[IMP] misc: move AUTOMATIC sentinel to misc.py, add new AUTO alias
This sentinel is relevant to all utils, not just `records.py`'s. The AUTO alias is more convenient to remember/type in userspace. Part-of: #304 Signed-off-by: Christophe Simonis (chs) <chs@odoo.com>
1 parent 6d99555 commit 5e5b65e

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/util/misc.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@ def __repr__(self):
6060
return self.name
6161

6262

63+
AUTO = AUTOMATIC = Sentinel("AUTO")
64+
65+
6366
def _cached(func):
6467
sentinel = Sentinel("sentinel")
6568

src/util/records.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
from .inconsistencies import break_recursive_loops
3535
from .indirect_references import indirect_references
3636
from .inherit import direct_inherit_parents, for_each_inherit
37-
from .misc import Sentinel, chunks, parse_version, version_gte
37+
from .misc import AUTOMATIC, chunks, parse_version, version_gte
3838
from .orm import env, flush
3939
from .pg import (
4040
PGRegexp,
@@ -1006,9 +1006,6 @@ def ensure_xmlid_match_record(cr, xmlid, model, values):
10061006
return new_res_id
10071007

10081008

1009-
AUTOMATIC = Sentinel("AUTOMATIC")
1010-
1011-
10121009
def update_record_from_xml(
10131010
cr,
10141011
xmlid,

0 commit comments

Comments
 (0)