From 7074d7754646c7ede48ea1a506de13692c00fc2b Mon Sep 17 00:00:00 2001 From: venkataakhil Date: Wed, 28 Jun 2023 14:30:19 +0530 Subject: [PATCH] Circular fixes for valid till, description count 500,valid till message --- smart_service/add_ons/doctype/circular/circular.js | 12 ++++++++---- smart_service/add_ons/doctype/circular/circular.json | 4 +++- smart_service/add_ons/doctype/circular/circular.py | 2 +- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/smart_service/add_ons/doctype/circular/circular.js b/smart_service/add_ons/doctype/circular/circular.js index 424f725..0941172 100644 --- a/smart_service/add_ons/doctype/circular/circular.js +++ b/smart_service/add_ons/doctype/circular/circular.js @@ -2,10 +2,14 @@ // For license information, please see license.txt frappe.ui.form.on('Circular', { - validate(frm) { - if(frm.doc.valid_till < frappe.datetime.nowdate()) { - msgprint('Valid Till date should be greater than today!'); + validate(frm) { + if (frm.doc.valid_till < frappe.datetime.nowdate()) { + msgprint('Valid Till date should be equal or greater than today!'); validated = false; } - } + if (frm.doc.description.length > 500) { + frappe.msgprint("Description: Only 500 character's are allowed") + validated = false; + } + } }); diff --git a/smart_service/add_ons/doctype/circular/circular.json b/smart_service/add_ons/doctype/circular/circular.json index ab58872..990d095 100644 --- a/smart_service/add_ons/doctype/circular/circular.json +++ b/smart_service/add_ons/doctype/circular/circular.json @@ -25,6 +25,7 @@ "reqd": 1 }, { + "description": "Max count (500 character's)", "fieldname": "description", "fieldtype": "Small Text", "in_list_view": 1, @@ -65,6 +66,7 @@ "label": "Valid Till" }, { + "description": "Upload *.png,*.jpg", "fieldname": "circular_image", "fieldtype": "Attach Image", "label": "Circular Image" @@ -72,7 +74,7 @@ ], "index_web_pages_for_search": 1, "links": [], - "modified": "2023-06-24 10:44:00.723062", + "modified": "2023-06-28 13:20:10.845730", "modified_by": "Administrator", "module": "Add Ons", "name": "Circular", diff --git a/smart_service/add_ons/doctype/circular/circular.py b/smart_service/add_ons/doctype/circular/circular.py index d22c004..f459866 100644 --- a/smart_service/add_ons/doctype/circular/circular.py +++ b/smart_service/add_ons/doctype/circular/circular.py @@ -6,5 +6,5 @@ from frappe.model.document import Document class Circular(Document): def validate(self): - if self.description and len(self.description)>850: + if self.description and len(self.description)>500: frappe.throw("Description should be less than or equal to 850 characters ") \ No newline at end of file