patch: Set against_blanket_order value in existing SO/PO (#19810)
* patch: Set against_blanket_order value in existing SO/PO
* Update set_against_blanket_order_in_sales_and_purchase_order.py
diff --git a/erpnext/patches.txt b/erpnext/patches.txt
index daedca7..68b6cc0 100644
--- a/erpnext/patches.txt
+++ b/erpnext/patches.txt
@@ -647,4 +647,5 @@
erpnext.patches.v12_0.set_default_for_add_taxes_from_item_tax_template
erpnext.patches.v12_0.remove_denied_leaves_from_leave_ledger
erpnext.patches.v12_0.update_price_or_product_discount
-erpnext.patches.v12_0.set_production_capacity_in_workstation
\ No newline at end of file
+erpnext.patches.v12_0.set_production_capacity_in_workstation
+erpnext.patches.v12_0.set_against_blanket_order_in_sales_and_purchase_order
\ No newline at end of file
diff --git a/erpnext/patches/v12_0/set_against_blanket_order_in_sales_and_purchase_order.py b/erpnext/patches/v12_0/set_against_blanket_order_in_sales_and_purchase_order.py
new file mode 100644
index 0000000..555d8ae
--- /dev/null
+++ b/erpnext/patches/v12_0/set_against_blanket_order_in_sales_and_purchase_order.py
@@ -0,0 +1,9 @@
+import frappe
+def execute():
+ for doctype in ['Sales Order Item', 'Purchase Order Item']:
+ frappe.reload_doctype(doctype)
+ frappe.db.sql("""
+ UPDATE `tab{0}`
+ SET against_blanket_order = 1
+ WHERE ifnull(blanket_order, '') != ''
+ """.format(doctype))