def validate_date(self): gr_eod = frappe.db.get_single_value("End Of Day", "gr_eod") if self.posting_date <= gr_eod and not frappe.session.user == "Administrator": frappe.throw("Day Closed: {}. Day has been closed for GR. No amendment is allowed in closed days".format(gr_eod)) # Skip future check if posting is from app if frappe.form_dict.client == "app": return if utils.get_next_date(gr_eod) < self.posting_date: frappe.throw("Day Closed: {}. Date is disabled for entry, will be allowed when previous day is closed".format(gr_eod))
def validate_date(self, date): stock_eod = frappe.db.get_single_value("End Of Day", "gr_eod") if str(date) <= str( stock_eod) and not frappe.session.user == "Administrator": frappe.throw( "Day has been closed for GR. No amendment is allowed in closed days" ) if date > utils.get_next_date(stock_eod, days=2): frappe.throw( "Date is disabled for entry, will be allowed when previous day is closed" )
def execute(filters=None): if filters.bifurcate: filters.bifurcate = cint(filters.bifurcate) columns = get_columns(filters) filled_iwb_map = get_item_warehouse_map(filters) filters.item_code = filters.item_code.replace('FC', 'EC') empty_iwb_map = get_item_warehouse_map(filters) import json from flows.stdlogger import root root.debug(json.dumps(filled_iwb_map)) data = [] empty_dict = frappe._dict({ "opening_qty": 0.0, "in": { 'GR': 0, 'PR': 0, 'GP': 0, 'OTHER': 0 }, "out": { 'GR': 0, 'PR': 0, 'GP': 0, 'OTHER': 0 }, "bal_qty": 0.0 }) posting_date = filters.from_date while posting_date <= filters.to_date: filled_qty_dict = filled_iwb_map.get(posting_date) empty_qty_dict = empty_iwb_map.get(posting_date) if not filled_qty_dict: filled_qty_dict = empty_dict if not empty_qty_dict: empty_qty_dict = empty_dict data.append( get_row(posting_date, filled_qty_dict, empty_qty_dict, filters)) posting_date = get_next_date(posting_date) return columns, data