Fixed reserved qty for production logic and patch for reposting (#11691)
diff --git a/erpnext/patches.txt b/erpnext/patches.txt
index e3d61d9..d58d73b 100644
--- a/erpnext/patches.txt
+++ b/erpnext/patches.txt
@@ -461,3 +461,4 @@
erpnext.patches.v9_0.update_employee_loan_details
erpnext.patches.v9_2.delete_healthcare_domain_default_items
erpnext.patches.v9_2.rename_translated_domains_in_en
+erpnext.patches.v9_2.repost_reserved_qty_for_production
\ No newline at end of file
diff --git a/erpnext/patches/v9_2/repost_reserved_qty_for_production.py b/erpnext/patches/v9_2/repost_reserved_qty_for_production.py
new file mode 100644
index 0000000..27cce1d
--- /dev/null
+++ b/erpnext/patches/v9_2/repost_reserved_qty_for_production.py
@@ -0,0 +1,7 @@
+import frappe
+
+def execute():
+ bins = frappe.db.sql("select name from `tabBin` where reserved_qty_for_production > 0")
+ for d in bins:
+ bin_doc = frappe.get_doc("Bin", d[0])
+ bin_doc.update_reserved_qty_for_production()
\ No newline at end of file
diff --git a/erpnext/stock/doctype/bin/bin.py b/erpnext/stock/doctype/bin/bin.py
index 626a9db..fbbe6ee 100644
--- a/erpnext/stock/doctype/bin/bin.py
+++ b/erpnext/stock/doctype/bin/bin.py
@@ -88,11 +88,10 @@
and item.source_warehouse = %s
and pro.status not in ("Stopped", "Completed")''', (self.item_code, self.warehouse))[0][0]
- if self.reserved_qty_for_production:
- self.set_projected_qty()
+ self.set_projected_qty()
- self.db_set('reserved_qty_for_production', self.reserved_qty_for_production)
- self.db_set('projected_qty', self.projected_qty)
+ self.db_set('reserved_qty_for_production', flt(self.reserved_qty_for_production))
+ self.db_set('projected_qty', self.projected_qty)
def update_item_projected_qty(item_code):