From cda4d5006364d6793889591a6dd9d71d95a33360 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 23 Nov 2017 13:05:43 +0530 Subject: [PATCH] Fixed reserved qty for production logic and patch for reposting (#11691) --- erpnext/patches.txt | 1 + erpnext/patches/v9_2/repost_reserved_qty_for_production.py | 7 +++++++ erpnext/stock/doctype/bin/bin.py | 7 +++---- 3 files changed, 11 insertions(+), 4 deletions(-) create mode 100644 erpnext/patches/v9_2/repost_reserved_qty_for_production.py diff --git a/erpnext/patches.txt b/erpnext/patches.txt index e3d61d9885..d58d73b175 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -461,3 +461,4 @@ execute:frappe.delete_doc_if_exists("DocType", "Program Fee") 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 0000000000..27cce1dc5d --- /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 626a9db97f..fbbe6eea2e 100644 --- a/erpnext/stock/doctype/bin/bin.py +++ b/erpnext/stock/doctype/bin/bin.py @@ -88,11 +88,10 @@ class Bin(Document): 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):