fix: Added Inactive serial no status (#21848)
This commit is contained in:
parent
f131260895
commit
dd3e52184c
@ -684,7 +684,7 @@ execute:frappe.delete_doc_if_exists("Page", "appointment-analytic")
|
||||
execute:frappe.rename_doc("Desk Page", "Getting Started", "Home", force=True)
|
||||
erpnext.patches.v12_0.unset_customer_supplier_based_on_type_of_item_price
|
||||
erpnext.patches.v12_0.set_valid_till_date_in_supplier_quotation
|
||||
erpnext.patches.v12_0.set_serial_no_status
|
||||
erpnext.patches.v12_0.set_serial_no_status #2020-05-21
|
||||
erpnext.patches.v12_0.update_price_list_currency_in_bom
|
||||
execute:frappe.delete_doc_if_exists('Dashboard', 'Accounts')
|
||||
erpnext.patches.v13_0.update_actual_start_and_end_date_in_wo
|
||||
|
@ -5,7 +5,7 @@ from frappe.utils import getdate, nowdate
|
||||
def execute():
|
||||
frappe.reload_doc('stock', 'doctype', 'serial_no')
|
||||
|
||||
serial_no_list = frappe.db.sql("""select name, delivery_document_type, warranty_expiry_date from `tabSerial No`
|
||||
serial_no_list = frappe.db.sql("""select name, delivery_document_type, warranty_expiry_date, warehouse from `tabSerial No`
|
||||
where (status is NULL OR status='')""", as_dict = 1)
|
||||
if len(serial_no_list) > 20000:
|
||||
frappe.db.auto_commit_on_many_writes = True
|
||||
@ -15,6 +15,8 @@ def execute():
|
||||
status = "Delivered"
|
||||
elif serial_no.get("warranty_expiry_date") and getdate(serial_no.get("warranty_expiry_date")) <= getdate(nowdate()):
|
||||
status = "Expired"
|
||||
elif not serial_no.get("warehouse"):
|
||||
status = "Inactive"
|
||||
else:
|
||||
status = "Active"
|
||||
|
||||
|
@ -420,14 +420,14 @@
|
||||
"fieldtype": "Select",
|
||||
"in_standard_filter": 1,
|
||||
"label": "Status",
|
||||
"options": "\nActive\nDelivered\nExpired",
|
||||
"options": "\nActive\nInactive\nDelivered\nExpired",
|
||||
"read_only": 1
|
||||
}
|
||||
],
|
||||
"icon": "fa fa-barcode",
|
||||
"idx": 1,
|
||||
"links": [],
|
||||
"modified": "2020-04-08 13:29:58.517772",
|
||||
"modified": "2020-05-21 19:29:58.517772",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Stock",
|
||||
"name": "Serial No",
|
||||
|
@ -42,6 +42,8 @@ class SerialNo(StockController):
|
||||
self.status = "Delivered"
|
||||
elif self.warranty_expiry_date and getdate(self.warranty_expiry_date) <= getdate(nowdate()):
|
||||
self.status = "Expired"
|
||||
elif not self.warehouse:
|
||||
self.status = "Inactive"
|
||||
else:
|
||||
self.status = "Active"
|
||||
|
||||
|
@ -5,6 +5,8 @@ frappe.listview_settings['Serial No'] = {
|
||||
return [__("Delivered"), "green", "delivery_document_type,is,set"];
|
||||
} 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"];
|
||||
} else if (!doc.warehouse) {
|
||||
return [__("Inactive"), "grey", "warehouse,is,not set"];
|
||||
} else {
|
||||
return [__("Active"), "green", "delivery_document_type,is,not set"];
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user