Merge pull request #18985 from Alchez/dev-serial-no-statuses

feat: add statuses for Serial No
This commit is contained in:
Deepesh Garg 2019-11-01 14:16:45 +05:30 committed by GitHub
commit ebf46120ba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -0,0 +1,14 @@
frappe.listview_settings['Serial No'] = {
add_fields: ["is_cancelled", "item_code", "warehouse", "warranty_expiry_date", "delivery_document_type"],
get_indicator: (doc) => {
if (doc.is_cancelled) {
return [__("Cancelled"), "red", "is_cancelled,=,Yes"];
} else if (doc.delivery_document_type) {
return [__("Delivered"), "green", "delivery_document_type,is,set|is_cancelled,=,No"];
} else if (doc.warranty_expiry_date && frappe.datetime.get_diff(doc.warranty_expiry_date, frappe.datetime.nowdate()) <= 0) {
return [__("Expired"), "red", "warranty_expiry_date,not in,|warranty_expiry_date,<=,Today|delivery_document_type,is,not set|is_cancelled,=,No"];
} else {
return [__("Active"), "green", "delivery_document_type,is,not set|is_cancelled,=,No"];
}
}
};