fix(patch): updates maintenance schedule field for old docs
(cherry picked from commit c872aa43f8)
# Conflicts:
# erpnext/patches.txt
This commit is contained in:
@@ -336,8 +336,13 @@ erpnext.patches.v12_0.update_production_plan_status
|
||||
erpnext.patches.v13_0.item_naming_series_not_mandatory
|
||||
erpnext.patches.v13_0.update_category_in_ltds_certificate
|
||||
erpnext.patches.v13_0.create_ksa_vat_custom_fields
|
||||
<<<<<<< HEAD
|
||||
erpnext.patches.v13_0.rename_ksa_qr_field
|
||||
erpnext.patches.v13_0.disable_ksa_print_format_for_others # 16-12-2021
|
||||
erpnext.patches.v13_0.update_tax_category_for_rcm
|
||||
erpnext.patches.v13_0.convert_to_website_item_in_item_card_group_template
|
||||
erpnext.patches.v13_0.agriculture_deprecation_warning
|
||||
=======
|
||||
erpnext.patches.v13_0.update_maintenance_schedule_field_in_visit
|
||||
erpnext.patches.v14_0.migrate_crm_settings
|
||||
>>>>>>> c872aa43f8 (fix(patch): updates maintenance schedule field for old docs)
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
|
||||
import frappe
|
||||
|
||||
|
||||
def execute():
|
||||
# Updates the Maintenance Schedule link to fetch serial nos
|
||||
from frappe.query_builder.functions import Coalesce
|
||||
mvp = frappe.qb.DocType('Maintenance Visit Purpose')
|
||||
mv = frappe.qb.DocType('Maintenance Visit')
|
||||
|
||||
frappe.qb.update(
|
||||
mv
|
||||
).join(
|
||||
mvp
|
||||
).on(mvp.parent == mv.name).set(
|
||||
mv.maintenance_schedule,
|
||||
Coalesce(mvp.prevdoc_docname, '')
|
||||
).where(
|
||||
(mv.maintenance_type == "Scheduled")
|
||||
& (mvp.prevdoc_docname.notnull())
|
||||
& (mv.docstatus < 2)
|
||||
).run(as_dict=1)
|
||||
Reference in New Issue
Block a user