fix: if accepted warehouse not selected during rejection then stock ledger not created

This commit is contained in:
Rohit Waghchaure 2022-04-04 15:10:57 +05:30
parent 12c01e2975
commit 0a71cabab1

View File

@ -463,6 +463,9 @@ class BuyingController(StockController, Subcontracting):
stock_items = self.get_stock_items()
for d in self.get("items"):
if d.item_code not in stock_items:
continue
if d.item_code in stock_items and d.warehouse:
pr_qty = flt(d.qty) * flt(d.conversion_factor)
@ -488,6 +491,7 @@ class BuyingController(StockController, Subcontracting):
sle = self.get_sl_entries(
d, {"actual_qty": flt(pr_qty), "serial_no": cstr(d.serial_no).strip()}
)
if self.is_return:
outgoing_rate = get_rate_for_return(
self.doctype, self.name, d.item_code, self.return_against, item_row=d
@ -517,18 +521,18 @@ class BuyingController(StockController, Subcontracting):
sl_entries.append(from_warehouse_sle)
if flt(d.rejected_qty) != 0:
sl_entries.append(
self.get_sl_entries(
d,
{
"warehouse": d.rejected_warehouse,
"actual_qty": flt(d.rejected_qty) * flt(d.conversion_factor),
"serial_no": cstr(d.rejected_serial_no).strip(),
"incoming_rate": 0.0,
},
)
if flt(d.rejected_qty) != 0:
sl_entries.append(
self.get_sl_entries(
d,
{
"warehouse": d.rejected_warehouse,
"actual_qty": flt(d.rejected_qty) * flt(d.conversion_factor),
"serial_no": cstr(d.rejected_serial_no).strip(),
"incoming_rate": 0.0,
},
)
)
self.make_sl_entries_for_supplier_warehouse(sl_entries)
self.make_sl_entries(