Skip to content

[18.0][IMP] upgrade_analysis: consider 'translate' value attribute #3299

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: 18.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions upgrade_analysis/compare.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,13 @@
else:
text = "not related anymore"
fieldprint(old, new, "", text, reprs)
elif attr == "translate":
if old[attr] != new[attr]:

Check warning on line 171 in upgrade_analysis/compare.py

View check run for this annotation

Codecov / codecov/patch

upgrade_analysis/compare.py#L170-L171

Added lines #L170 - L171 were not covered by tests
if new[attr]:
text = "now translatable"
else:
text = "not translatable anymore"

Check warning on line 175 in upgrade_analysis/compare.py

View check run for this annotation

Codecov / codecov/patch

upgrade_analysis/compare.py#L175

Added line #L175 was not covered by tests
fieldprint(old, new, "", text, reprs)
elif attr == "table":
if old[attr] != new[attr]:
fieldprint(old, new, attr, "", reprs)
Expand Down Expand Up @@ -246,6 +253,7 @@
"stored",
"isfunction",
"isrelated",
"translate",
"required",
"table",
"_order",
Expand All @@ -263,6 +271,7 @@
"stored",
"isfunction",
"isrelated",
"translate",
"required",
"table",
"_order",
Expand All @@ -280,6 +289,7 @@
"stored",
"isfunction",
"isrelated",
"translate",
"required",
"table",
"_order",
Expand All @@ -298,6 +308,7 @@
# Info that is displayed for new fields
printkeys_new = printkeys_old + [
"hasdefault",
"translate",
]
for column in old_records:
if column["field"] == "_order":
Expand Down
1 change: 1 addition & 0 deletions upgrade_analysis/models/upgrade_record.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ def field_dump(self):
"isfunction",
"isproperty",
"isrelated",
"translate",
"relation",
"required",
"stored",
Expand Down
7 changes: 7 additions & 0 deletions upgrade_analysis/upgrade_log.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,12 @@
return ""


def istranslate(field):
if field.translate:
return "translate"
return ""

Check warning on line 125 in upgrade_analysis/upgrade_log.py

View check run for this annotation

Codecov / codecov/patch

upgrade_analysis/upgrade_log.py#L124-L125

Added lines #L124 - L125 were not covered by tests


def _get_relation(field):
if field.type in ("many2many", "many2one", "one2many"):
return field.comodel_name
Expand Down Expand Up @@ -154,6 +160,7 @@
"isfunction": isfunction(field),
"isproperty": isproperty(field),
"isrelated": isrelated(field),
"translate": istranslate(field),
"relation": _get_relation(field),
"table": field.relation if field.type == "many2many" else "",
"required": field.required and "required" or "",
Expand Down