Skip to content
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

fix: rename doc old_doc bug and validate for rename field #23248

Merged
merged 2 commits into from
Nov 17, 2023
Merged

fix: rename doc old_doc bug and validate for rename field #23248

merged 2 commits into from
Nov 17, 2023

Conversation

anandbaburajan
Copy link
Contributor

  • Added a new validate arg for rename_field() since I had a use case where I didn't want the validation to be made. For example: in v14 erpnext, there's a doctype with a fieldname "A". In v15, that doctype was moved to a separate lending app after which the fieldname was renamed to "B". Now on v14->v15 migration, on installation of the lending app, I'm running a patch to rename fieldname "A" to "B", but in rename_field(), frappe.db.has_column(doctype, old_fieldname) would fail since the doctype won't have the old fieldname "A".
  • If rename_doc() is called with validate=False, an old_doc is not defined error is thrown since old_doc is initialised only if validate=True. So now that one line using old_doc is only executed if validate=True.

@anandbaburajan anandbaburajan added the backport version-15-hotfix Backport the PR to v15 label Nov 16, 2023
@anandbaburajan anandbaburajan requested review from a team and shariquerik and removed request for a team November 16, 2023 19:17
@github-actions github-actions bot added the add-test-cases Add test case to validate fix or enhancement label Nov 16, 2023
Copy link

codecov bot commented Nov 16, 2023

Codecov Report

Merging #23248 (ebccab0) into develop (0ff08e4) will decrease coverage by 0.14%.
Report is 24 commits behind head on develop.
The diff coverage is 30.00%.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop   #23248      +/-   ##
===========================================
- Coverage    62.30%   62.16%   -0.14%     
===========================================
  Files          770      770              
  Lines        73740    73941     +201     
  Branches      6349     6349              
===========================================
+ Hits         45943    45969      +26     
- Misses       24183    24358     +175     
  Partials      3614     3614              
Flag Coverage Δ
server 70.78% <30.00%> (-0.04%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

@shariquerik shariquerik merged commit 729f8be into frappe:develop Nov 17, 2023
24 of 25 checks passed
shariquerik added a commit that referenced this pull request Nov 17, 2023
…-23248

fix: rename doc old_doc bug and validate for rename field (backport #23248)
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 2, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
add-test-cases Add test case to validate fix or enhancement backport version-15-hotfix Backport the PR to v15
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants