mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-08 15:42:52 +00:00
Stock reconciliation when valuation rate column is blank
This commit is contained in:
@@ -74,7 +74,7 @@ class StockReconciliation(StockController):
|
|||||||
self.validation_messages.append(_get_msg(row_num, _("Warehouse not found in the system")))
|
self.validation_messages.append(_get_msg(row_num, _("Warehouse not found in the system")))
|
||||||
|
|
||||||
# if both not specified
|
# if both not specified
|
||||||
if row[2] == "" and row[3] == "":
|
if row[2] in ["", None] and row[3] in ["", None]:
|
||||||
self.validation_messages.append(_get_msg(row_num,
|
self.validation_messages.append(_get_msg(row_num,
|
||||||
_("Please specify either Quantity or Valuation Rate or both")))
|
_("Please specify either Quantity or Valuation Rate or both")))
|
||||||
|
|
||||||
@@ -149,7 +149,7 @@ class StockReconciliation(StockController):
|
|||||||
})
|
})
|
||||||
|
|
||||||
# check valuation rate mandatory
|
# check valuation rate mandatory
|
||||||
if row.qty != "" and not row.valuation_rate and \
|
if row.qty not in ["", None] and not row.valuation_rate and \
|
||||||
flt(previous_sle.get("qty_after_transaction")) <= 0:
|
flt(previous_sle.get("qty_after_transaction")) <= 0:
|
||||||
frappe.throw(_("Valuation Rate required for Item {0}").format(row.item_code))
|
frappe.throw(_("Valuation Rate required for Item {0}").format(row.item_code))
|
||||||
|
|
||||||
@@ -171,7 +171,7 @@ class StockReconciliation(StockController):
|
|||||||
if previous_valuation_rate == 0:
|
if previous_valuation_rate == 0:
|
||||||
return flt(valuation_rate)
|
return flt(valuation_rate)
|
||||||
else:
|
else:
|
||||||
if valuation_rate == "":
|
if valuation_rate in ["", None]:
|
||||||
valuation_rate = previous_valuation_rate
|
valuation_rate = previous_valuation_rate
|
||||||
return (qty * valuation_rate - previous_qty * previous_valuation_rate) \
|
return (qty * valuation_rate - previous_qty * previous_valuation_rate) \
|
||||||
/ flt(qty - previous_qty)
|
/ flt(qty - previous_qty)
|
||||||
@@ -179,8 +179,7 @@ class StockReconciliation(StockController):
|
|||||||
if change_in_qty:
|
if change_in_qty:
|
||||||
# if change in qty, irrespective of change in rate
|
# if change in qty, irrespective of change in rate
|
||||||
incoming_rate = _get_incoming_rate(flt(row.qty), flt(row.valuation_rate),
|
incoming_rate = _get_incoming_rate(flt(row.qty), flt(row.valuation_rate),
|
||||||
flt(previous_sle.get("qty_after_transaction")),
|
flt(previous_sle.get("qty_after_transaction")), flt(previous_sle.get("valuation_rate")))
|
||||||
flt(previous_sle.get("valuation_rate")))
|
|
||||||
|
|
||||||
row["voucher_detail_no"] = "Row: " + cstr(row.row_num) + "/Actual Entry"
|
row["voucher_detail_no"] = "Row: " + cstr(row.row_num) + "/Actual Entry"
|
||||||
self.insert_entries({"actual_qty": change_in_qty, "incoming_rate": incoming_rate}, row)
|
self.insert_entries({"actual_qty": change_in_qty, "incoming_rate": incoming_rate}, row)
|
||||||
@@ -211,7 +210,7 @@ class StockReconciliation(StockController):
|
|||||||
def _insert_entries():
|
def _insert_entries():
|
||||||
if previous_stock_queue != [[row.qty, row.valuation_rate]]:
|
if previous_stock_queue != [[row.qty, row.valuation_rate]]:
|
||||||
# make entry as per attachment
|
# make entry as per attachment
|
||||||
if row.qty:
|
if flt(row.qty):
|
||||||
row["voucher_detail_no"] = "Row: " + cstr(row.row_num) + "/Actual Entry"
|
row["voucher_detail_no"] = "Row: " + cstr(row.row_num) + "/Actual Entry"
|
||||||
self.insert_entries({"actual_qty": row.qty,
|
self.insert_entries({"actual_qty": row.qty,
|
||||||
"incoming_rate": flt(row.valuation_rate)}, row)
|
"incoming_rate": flt(row.valuation_rate)}, row)
|
||||||
@@ -225,7 +224,7 @@ class StockReconciliation(StockController):
|
|||||||
|
|
||||||
|
|
||||||
if change_in_qty:
|
if change_in_qty:
|
||||||
if row.valuation_rate == "":
|
if row.valuation_rate in ["", None]:
|
||||||
# dont want change in valuation
|
# dont want change in valuation
|
||||||
if previous_stock_qty > 0:
|
if previous_stock_qty > 0:
|
||||||
# set valuation_rate as previous valuation_rate
|
# set valuation_rate as previous valuation_rate
|
||||||
|
|||||||
Reference in New Issue
Block a user