fix: add missing patch for new fields added in #34214

This commit is contained in:
anandbaburajan 2023-03-09 17:55:27 +05:30
parent 428274df56
commit ebb6953274
2 changed files with 21 additions and 0 deletions

View File

@ -323,6 +323,7 @@ erpnext.patches.v14_0.update_entry_type_for_journal_entry
erpnext.patches.v14_0.change_autoname_for_tax_withheld_vouchers
erpnext.patches.v14_0.set_pick_list_status
erpnext.patches.v15_0.update_asset_value_for_manual_depr_entries
erpnext.patches.v15_0.update_gpa_and_ndb_for_assdeprsch
# below 2 migration patches should always run last
erpnext.patches.v14_0.migrate_gl_to_payment_ledger
erpnext.patches.v14_0.migrate_remarks_from_gl_to_payment_ledger

View File

@ -0,0 +1,20 @@
import frappe
def execute():
# not using frappe.qb because https://github.com/frappe/frappe/issues/20292
frappe.db.sql(
"""UPDATE `tabAsset Depreciation Schedule`
JOIN `tabAsset`
ON `tabAsset Depreciation Schedule`.`asset`=`tabAsset`.`name`
SET
`tabAsset Depreciation Schedule`.`gross_purchase_amount`=`tabAsset`.`gross_purchase_amount`,
`tabAsset Depreciation Schedule`.`number_of_depreciations_booked`=`tabAsset`.`number_of_depreciations_booked`
WHERE
(
`tabAsset Depreciation Schedule`.`gross_purchase_amount`<>`tabAsset`.`gross_purchase_amount`
OR
`tabAsset Depreciation Schedule`.`number_of_depreciations_booked`<>`tabAsset`.`number_of_depreciations_booked`
)
AND `tabAsset Depreciation Schedule`.`docstatus`<2"""
)