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

refactor: reset update_outstanding_for_self flag for old records #40622

Merged
merged 2 commits into from
Mar 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 3 additions & 2 deletions erpnext/accounts/doctype/sales_invoice/sales_invoice.json
Original file line number Diff line number Diff line change
Expand Up @@ -2180,7 +2180,8 @@
"fieldname": "update_outstanding_for_self",
"fieldtype": "Check",
"label": "Update Outstanding for Self",
"no_copy": 1
"no_copy": 1,
"print_hide": 1
}
],
"icon": "fa fa-file-text",
Expand All @@ -2193,7 +2194,7 @@
"link_fieldname": "consolidated_invoice"
}
],
"modified": "2024-03-20 16:02:52.237732",
"modified": "2024-03-22 17:50:34.395602",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Sales Invoice",
Expand Down
2 changes: 1 addition & 1 deletion erpnext/patches.txt
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ erpnext.patches.v14_0.update_total_asset_cost_field
erpnext.patches.v15_0.create_advance_payment_status
erpnext.patches.v15_0.allow_on_submit_dimensions_for_repostable_doctypes
erpnext.patches.v14_0.create_accounting_dimensions_in_reconciliation_tool
erpnext.patches.v14_0.update_flag_for_return_invoices
erpnext.patches.v14_0.update_flag_for_return_invoices #2024-03-22
# below migration patch should always run last
erpnext.patches.v14_0.migrate_gl_to_payment_ledger
erpnext.stock.doctype.delivery_note.patches.drop_unused_return_against_index # 2023-12-20
Expand Down
8 changes: 8 additions & 0 deletions erpnext/patches/v14_0/update_flag_for_return_invoices.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ def execute():
creation_date = "2024-01-25"

si = qb.DocType("Sales Invoice")

# unset flag, as migration would have set it for all records, as the field was introduced with default '1'
qb.update(si).set(si.update_outstanding_for_self, False).run()

if cr_notes := (
qb.from_(si)
.select(si.name)
Expand All @@ -37,6 +41,10 @@ def execute():
).run()

pi = qb.DocType("Purchase Invoice")

# unset flag, as migration would have set it for all records, as the field was introduced with default '1'
qb.update(pi).set(pi.update_outstanding_for_self, False).run()

if dr_notes := (
qb.from_(pi)
.select(pi.name)
Expand Down