Browse Source

Circular fixes for valid till, description count 500,valid till message

master
venkataakhil 1 year ago
parent
commit
7074d77546
  1. 6
      smart_service/add_ons/doctype/circular/circular.js
  2. 4
      smart_service/add_ons/doctype/circular/circular.json
  3. 2
      smart_service/add_ons/doctype/circular/circular.py

6
smart_service/add_ons/doctype/circular/circular.js

@ -4,7 +4,11 @@
frappe.ui.form.on('Circular', { frappe.ui.form.on('Circular', {
validate(frm) { validate(frm) {
if (frm.doc.valid_till < frappe.datetime.nowdate()) { if (frm.doc.valid_till < frappe.datetime.nowdate()) {
msgprint('Valid Till date should be greater than today!'); msgprint('Valid Till date should be equal or greater than today!');
validated = false;
}
if (frm.doc.description.length > 500) {
frappe.msgprint("<b>Description:</b> Only <b> 500 </b> character's are allowed")
validated = false; validated = false;
} }
} }

4
smart_service/add_ons/doctype/circular/circular.json

@ -25,6 +25,7 @@
"reqd": 1 "reqd": 1
}, },
{ {
"description": "Max count (500 character's)",
"fieldname": "description", "fieldname": "description",
"fieldtype": "Small Text", "fieldtype": "Small Text",
"in_list_view": 1, "in_list_view": 1,
@ -65,6 +66,7 @@
"label": "Valid Till" "label": "Valid Till"
}, },
{ {
"description": "Upload *.png,*.jpg",
"fieldname": "circular_image", "fieldname": "circular_image",
"fieldtype": "Attach Image", "fieldtype": "Attach Image",
"label": "Circular Image" "label": "Circular Image"
@ -72,7 +74,7 @@
], ],
"index_web_pages_for_search": 1, "index_web_pages_for_search": 1,
"links": [], "links": [],
"modified": "2023-06-24 10:44:00.723062", "modified": "2023-06-28 13:20:10.845730",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Add Ons", "module": "Add Ons",
"name": "Circular", "name": "Circular",

2
smart_service/add_ons/doctype/circular/circular.py

@ -6,5 +6,5 @@ from frappe.model.document import Document
class Circular(Document): class Circular(Document):
def validate(self): 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 ") frappe.throw("Description should be less than or equal to 850 characters ")
Loading…
Cancel
Save