Validation for reserved warhouse

This commit is contained in:
pawan 2017-11-29 21:16:02 +05:30
parent 54465f5df1
commit 11398fd572
3 changed files with 9 additions and 4 deletions

View File

@ -257,8 +257,8 @@ class PurchaseOrder(BuyingController):
def update_reserved_qty_for_subcontract(self):
for d in self.supplied_items:
if d.rm_item_code:
stock_bin = get_bin(d.rm_item_code, d.reserve_warehouse)
stock_bin.update_reserved_qty_for_sub_contracting()
stock_bin = get_bin(d.rm_item_code, d.reserve_warehouse)
stock_bin.update_reserved_qty_for_sub_contracting()
@frappe.whitelist()
def close_or_unclose_purchase_orders(names, status):

View File

@ -327,7 +327,6 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
"default": "",
"fieldname": "reserve_warehouse",
"fieldtype": "Link",
"hidden": 0,
@ -364,7 +363,7 @@
"issingle": 0,
"istable": 1,
"max_attachments": 0,
"modified": "2017-11-29 08:51:08.362463",
"modified": "2017-11-29 21:10:40.431423",
"modified_by": "Administrator",
"module": "Buying",
"name": "Purchase Order Item Supplied",

View File

@ -812,6 +812,12 @@ class StockEntry(StockController):
#Get PO Supplied Items Details
po_doc = frappe.get_doc("Purchase Order",self.purchase_order)
po_supplied_items = po_doc.get("supplied_items")
#Validate source warehouse is same as reserved warehouse
for item in self.get("items"):
if item.s_warehouse:
for d in po_supplied_items:
if item.item_code == d.rm_item_code and item.s_warehouse != d.reserve_warehouse:
frappe.throw(_("In case of Sub Contract Stock Entry, Source Warehouse: {0} should match with Reserved Warehouse: {1} on PO").format(item.s_warehouse,d.reserve_warehouse))
#Update reserved sub contracted quantity in bin based on Supplied Item Details
for d in po_supplied_items:
stock_bin = get_bin(d.rm_item_code, d.reserve_warehouse)