Fixed issue while updating Requested Qty on stoping material request and patch to recalculate
This commit is contained in:
parent
ab1ed013b3
commit
6752b31091
@ -152,3 +152,4 @@ erpnext.patches.v5_0.link_warehouse_with_account
|
|||||||
execute:frappe.delete_doc("Page", "stock-ledger")
|
execute:frappe.delete_doc("Page", "stock-ledger")
|
||||||
execute:frappe.delete_doc("Page","stock-level")
|
execute:frappe.delete_doc("Page","stock-level")
|
||||||
erpnext.patches.v5_0.reclculate_planned_operating_cost_in_production_order
|
erpnext.patches.v5_0.reclculate_planned_operating_cost_in_production_order
|
||||||
|
erpnext.patches.v5_0.repost_requested_qty
|
||||||
|
21
erpnext/patches/v5_0/repost_requested_qty.py
Normal file
21
erpnext/patches/v5_0/repost_requested_qty.py
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||||
|
# License: GNU General Public License v3. See license.txt
|
||||||
|
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
import frappe
|
||||||
|
|
||||||
|
def execute():
|
||||||
|
from erpnext.utilities.repost_stock import update_bin_qty, get_indented_qty
|
||||||
|
|
||||||
|
count=0
|
||||||
|
for item_code, warehouse in frappe.db.sql("""select distinct item_code, warehouse
|
||||||
|
from `tabMaterial Request Item` where docstatus = 1"""):
|
||||||
|
try:
|
||||||
|
count += 1
|
||||||
|
update_bin_qty(item_code, warehouse, {
|
||||||
|
"indented_qty": get_indented_qty(item_code, warehouse),
|
||||||
|
})
|
||||||
|
if count % 200 == 0:
|
||||||
|
frappe.db.commit()
|
||||||
|
except:
|
||||||
|
frappe.db.rollback()
|
@ -7,7 +7,7 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
import frappe
|
import frappe
|
||||||
|
|
||||||
from frappe.utils import cstr, flt
|
from frappe.utils import cstr, flt, getdate
|
||||||
from frappe import _
|
from frappe import _
|
||||||
from frappe.model.mapper import get_mapped_doc
|
from frappe.model.mapper import get_mapped_doc
|
||||||
|
|
||||||
@ -53,7 +53,7 @@ class MaterialRequest(BuyingController):
|
|||||||
|
|
||||||
def validate_schedule_date(self):
|
def validate_schedule_date(self):
|
||||||
for d in self.get('items'):
|
for d in self.get('items'):
|
||||||
if d.schedule_date and d.schedule_date < self.transaction_date:
|
if d.schedule_date and getdate(d.schedule_date) < getdate(self.transaction_date):
|
||||||
frappe.throw(_("Expected Date cannot be before Material Request Date"))
|
frappe.throw(_("Expected Date cannot be before Material Request Date"))
|
||||||
|
|
||||||
# Validate
|
# Validate
|
||||||
@ -94,8 +94,8 @@ class MaterialRequest(BuyingController):
|
|||||||
|
|
||||||
def update_status(self, status):
|
def update_status(self, status):
|
||||||
self.check_modified_date()
|
self.check_modified_date()
|
||||||
self.update_requested_qty()
|
|
||||||
frappe.db.set(self, 'status', cstr(status))
|
frappe.db.set(self, 'status', cstr(status))
|
||||||
|
self.update_requested_qty()
|
||||||
frappe.msgprint(_("Status updated to {0}").format(_(status)))
|
frappe.msgprint(_("Status updated to {0}").format(_(status)))
|
||||||
|
|
||||||
def on_cancel(self):
|
def on_cancel(self):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user