From e5eed00aa5b496ab1ddc1b82a0b869a6a268c4dc Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 17 Oct 2016 17:37:35 +0530 Subject: [PATCH] Update stock_entry.py --- .../stock/doctype/stock_entry/stock_entry.py | 33 ------------------- 1 file changed, 33 deletions(-) diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.py b/erpnext/stock/doctype/stock_entry/stock_entry.py index d44ef57a8ff..e35f3d29659 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry.py +++ b/erpnext/stock/doctype/stock_entry/stock_entry.py @@ -36,7 +36,6 @@ class StockEntry(StockController): self.pro_doc = frappe.get_doc('Production Order', self.production_order) self.validate_posting_time() - self.validate_posting_date() self.validate_purpose() self.validate_item() self.set_transfer_qty() @@ -66,38 +65,6 @@ class StockEntry(StockController): self.update_production_order() self.make_gl_entries_on_cancel() - def validate_posting_date(self): - allow_negative_stock = cint(frappe.db.get_value("Stock Settings", None, "allow_negative_stock")) - items, warehouses = self.get_items_and_warehouses() - previous_stock_vouchers = self.get_previous_stock_vouchers(self.posting_date, self.posting_time, warehouses, - items) - - if allow_negative_stock and previous_stock_vouchers: - for voucher_type, voucher_no in previous_stock_vouchers: - frappe.msgprint( - _("The posting date is after {0}: {1}, this will cause missing data in the General Ledger").format( - voucher_type, voucher_no)) - - def get_previous_stock_vouchers(self, posting_date, posting_time, for_warehouses=None, for_items=None): - previous_stock_vouchers = [] - - values = [] - condition = "" - - if for_items: - condition += " and item_code in ({})".format(", ".join(["%(item_code)s"] * len(for_items))) - values += for_items - - for d in frappe.db.sql("""select distinct sle.voucher_type, sle.voucher_no - from `tabStock Ledger Entry` sle - where timestamp(sle.posting_date, sle.posting_time) <= timestamp(%(date)s, %(time)s) {condition} - and warehouse = %(warehouse)s - order by timestamp(sle.posting_date, sle.posting_time) asc, name asc""".format(condition=condition), - {"warehouse":for_warehouses,"date":posting_date,"time":posting_time,"item_code":values}, as_dict=1): - previous_stock_vouchers.append([d.voucher_type, d.voucher_no]) - - return previous_stock_vouchers - def validate_purpose(self): valid_purposes = ["Material Issue", "Material Receipt", "Material Transfer", "Material Transfer for Manufacture", "Manufacture", "Repack", "Subcontract"]