fix(stock): batch list view statuses
This commit is contained in:
parent
4a50c99867
commit
92669eae66
@ -1,18 +1,14 @@
|
|||||||
frappe.listview_settings['Batch'] = {
|
frappe.listview_settings['Batch'] = {
|
||||||
add_fields: ["item", "expiry_date", "batch_qty"],
|
add_fields: ["item", "expiry_date", "batch_qty", "disabled"],
|
||||||
get_indicator: function (doc) {
|
get_indicator: (doc) => {
|
||||||
if (!doc.batch_qty) {
|
if (doc.disabled) {
|
||||||
return ["Empty", "darkgrey", "batch_qty,=,0"];
|
return [__("Disabled"), "darkgrey", "disabled,=,1"];
|
||||||
|
} else if (doc.expiry_date && frappe.datetime.get_diff(doc.expiry_date, frappe.datetime.nowdate()) <= 0) {
|
||||||
|
return [__("Expired"), "red", "expiry_date,not in,|expiry_date,<=,Today|batch_qty,>,0|disabled,=,0"]
|
||||||
|
} else if (!doc.batch_qty) {
|
||||||
|
return [__("Empty"), "darkgrey", "batch_qty,=,0|disabled,=,0"];
|
||||||
} else {
|
} else {
|
||||||
if (doc.expiry_date) {
|
return [__("Active"), "green", "batch_qty,>,0|disabled,=,0"];
|
||||||
if (frappe.datetime.get_diff(doc.expiry_date, frappe.datetime.nowdate()) <= 0) {
|
|
||||||
return [__("Expired"), "red", "expiry_date,>=,Today|batch_qty,>,0"]
|
|
||||||
} else {
|
|
||||||
return [__("Not Expired"), "green", "expiry_date,<,Today|batch_qty,>,0"]
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return ["Active", "green", "batch_qty,>,0"];
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user