mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-21 05:59:18 +00:00
fix: Added Inactive serial no status (#21849)
This commit is contained in:
@@ -665,5 +665,5 @@ erpnext.patches.v13_0.move_tax_slabs_from_payroll_period_to_income_tax_slab #123
|
|||||||
erpnext.patches.v12_0.remove_duplicate_leave_ledger_entries
|
erpnext.patches.v12_0.remove_duplicate_leave_ledger_entries
|
||||||
execute:frappe.delete_doc_if_exists("Page", "appointment-analytic")
|
execute:frappe.delete_doc_if_exists("Page", "appointment-analytic")
|
||||||
erpnext.patches.v12_0.unset_customer_supplier_based_on_type_of_item_price
|
erpnext.patches.v12_0.unset_customer_supplier_based_on_type_of_item_price
|
||||||
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
|
erpnext.patches.v12_0.update_price_list_currency_in_bom
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ from frappe.utils import getdate, nowdate
|
|||||||
def execute():
|
def execute():
|
||||||
frappe.reload_doc('stock', 'doctype', 'serial_no')
|
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)
|
where (status is NULL OR status='')""", as_dict = 1)
|
||||||
if len(serial_no_list) > 20000:
|
if len(serial_no_list) > 20000:
|
||||||
frappe.db.auto_commit_on_many_writes = True
|
frappe.db.auto_commit_on_many_writes = True
|
||||||
@@ -15,6 +15,8 @@ def execute():
|
|||||||
status = "Delivered"
|
status = "Delivered"
|
||||||
elif serial_no.get("warranty_expiry_date") and getdate(serial_no.get("warranty_expiry_date")) <= getdate(nowdate()):
|
elif serial_no.get("warranty_expiry_date") and getdate(serial_no.get("warranty_expiry_date")) <= getdate(nowdate()):
|
||||||
status = "Expired"
|
status = "Expired"
|
||||||
|
elif not serial_no.get("warehouse"):
|
||||||
|
status = "Inactive"
|
||||||
else:
|
else:
|
||||||
status = "Active"
|
status = "Active"
|
||||||
|
|
||||||
|
|||||||
@@ -420,14 +420,14 @@
|
|||||||
"fieldtype": "Select",
|
"fieldtype": "Select",
|
||||||
"in_standard_filter": 1,
|
"in_standard_filter": 1,
|
||||||
"label": "Status",
|
"label": "Status",
|
||||||
"options": "\nActive\nDelivered\nExpired",
|
"options": "\nActive\nInactive\nDelivered\nExpired",
|
||||||
"read_only": 1
|
"read_only": 1
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"icon": "fa fa-barcode",
|
"icon": "fa fa-barcode",
|
||||||
"idx": 1,
|
"idx": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2020-04-08 13:29:58.517772",
|
"modified": "2020-05-21 19:29:58.517772",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Stock",
|
"module": "Stock",
|
||||||
"name": "Serial No",
|
"name": "Serial No",
|
||||||
|
|||||||
@@ -42,6 +42,8 @@ class SerialNo(StockController):
|
|||||||
self.status = "Delivered"
|
self.status = "Delivered"
|
||||||
elif self.warranty_expiry_date and getdate(self.warranty_expiry_date) <= getdate(nowdate()):
|
elif self.warranty_expiry_date and getdate(self.warranty_expiry_date) <= getdate(nowdate()):
|
||||||
self.status = "Expired"
|
self.status = "Expired"
|
||||||
|
elif not self.warehouse:
|
||||||
|
self.status = "Inactive"
|
||||||
else:
|
else:
|
||||||
self.status = "Active"
|
self.status = "Active"
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ frappe.listview_settings['Serial No'] = {
|
|||||||
return [__("Delivered"), "green", "delivery_document_type,is,set"];
|
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) {
|
} 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"];
|
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 {
|
} else {
|
||||||
return [__("Active"), "green", "delivery_document_type,is,not set"];
|
return [__("Active"), "green", "delivery_document_type,is,not set"];
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user