Merge pull request #20454 from marination/stock-ledger-qty-column

fix: 'In Qty' and 'Out Qty' columns in Report Stock Ledger
This commit is contained in:
Deepesh Garg 2020-01-29 09:49:55 +05:30 committed by GitHub
commit 565a810bf7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 3 deletions

View File

@ -83,6 +83,9 @@ frappe.query_reports["Stock Ledger"] = {
if (column.fieldname == "out_qty" && data.out_qty < 0) {
value = "<span style='color:red'>" + value + "</span>";
}
else if (column.fieldname == "in_qty" && data.in_qty > 0) {
value = "<span style='color:green'>" + value + "</span>";
}
return value;
},

View File

@ -38,11 +38,14 @@ def execute(filters=None):
sle.update({
"qty_after_transaction": actual_qty,
"stock_value": stock_value,
"in_qty": max(sle.actual_qty, 0),
"out_qty": min(sle.actual_qty, 0)
"stock_value": stock_value
})
sle.update({
"in_qty": max(sle.actual_qty, 0),
"out_qty": min(sle.actual_qty, 0)
})
# get the name of the item that was produced using this item
if sle.voucher_type == "Stock Entry":
purpose, work_order, fg_completed_qty = frappe.db.get_value(sle.voucher_type, sle.voucher_no, ["purpose", "work_order", "fg_completed_qty"])