Browse Source

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

master
venkataakhil 1 year ago
parent
commit
7074d77546
  1. 12
      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

12
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("<b>Description:</b> Only <b> 500 </b> character's are allowed")
validated = false;
}
}
});

4
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",

2
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 ")
Loading…
Cancel
Save