Skip to content

Commit ef4aec5

Browse files
committed
[IMP] util/fields: improve rex to be more precise
So far we've been matching very broadly, now we only look for actual references of the field, eg .data or "data". closes #29 Signed-off-by: Christophe Simonis (chs) <[email protected]>
1 parent 73780bd commit ef4aec5

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/util/fields.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -832,6 +832,7 @@ def _update_field_usage_multi(cr, models, old, new, domain_adapter=None, skip_in
832832

833833
p = {
834834
"old": r"\y%s\y" % (re.escape(old),),
835+
"old_pattern": r"""[.'"]{0}\y""".format(re.escape(old)),
835836
"new": new,
836837
"def_old": r"\ydefault_%s\y" % (re.escape(old),),
837838
"def_new": "default_%s" % (new,),
@@ -851,7 +852,7 @@ def _update_field_usage_multi(cr, models, old, new, domain_adapter=None, skip_in
851852
SELECT id, {name}
852853
FROM ir_act_server
853854
WHERE state = 'code'
854-
AND (code ~ %(old)s
855+
AND (code ~ %(old_pattern)s
855856
{col_prefix} OR condition ~ %(old)s
856857
)
857858
"""

0 commit comments

Comments
 (0)