chore: batch flag and consumption rate in invariant report

This commit is contained in:
Ankush Menat 2022-02-19 21:21:39 +05:30 committed by Ankush Menat
parent b534fee2c7
commit b1555fd477

View File

@ -60,6 +60,9 @@ def add_invariant_check_fields(sles):
fifo_qty += qty
fifo_value += qty * rate
if sle.actual_qty < 0:
sle.consumption_rate = sle.stock_value_difference / sle.actual_qty
balance_qty += sle.actual_qty
balance_stock_value += sle.stock_value_difference
if sle.voucher_type == "Stock Reconciliation" and not sle.batch_no:
@ -90,6 +93,9 @@ def add_invariant_check_fields(sles):
sle.fifo_stock_diff = sle.fifo_stock_value - sles[idx - 1].fifo_stock_value
sle.fifo_difference_diff = sle.fifo_stock_diff - sle.stock_value_difference
if sle.batch_no:
sle.use_batchwise_valuation = frappe.db.get_value("Batch", sle.batch_no, "use_batchwise_valuation", cache=True)
return sles
@ -134,6 +140,11 @@ def get_columns():
"label": "Batch",
"options": "Batch",
},
{
"fieldname": "use_batchwise_valuation",
"fieldtype": "Check",
"label": "Batchwise Valuation",
},
{
"fieldname": "actual_qty",
"fieldtype": "Float",
@ -145,9 +156,9 @@ def get_columns():
"label": "Incoming Rate",
},
{
"fieldname": "outgoing_rate",
"fieldname": "consumption_rate",
"fieldtype": "Float",
"label": "Outgoing Rate",
"label": "Consumption Rate",
},
{
"fieldname": "qty_after_transaction",