Merge pull request #33809 from mihir-kandoi/33758
feat: enable non negative validation for Percent type fields
This commit is contained in:
commit
86c719ec6d
2 changed files with 6 additions and 4 deletions
|
|
@ -499,7 +499,7 @@
|
|||
},
|
||||
{
|
||||
"default": "0",
|
||||
"depends_on": "eval:in_list([\"Int\", \"Float\", \"Currency\"], doc.fieldtype)",
|
||||
"depends_on": "eval:in_list([\"Int\", \"Float\", \"Currency\", \"Percent\"], doc.fieldtype)",
|
||||
"fieldname": "non_negative",
|
||||
"fieldtype": "Check",
|
||||
"label": "Non Negative"
|
||||
|
|
@ -609,18 +609,20 @@
|
|||
"label": "Sticky"
|
||||
}
|
||||
],
|
||||
"grid_page_length": 50,
|
||||
"idx": 1,
|
||||
"index_web_pages_for_search": 1,
|
||||
"istable": 1,
|
||||
"links": [],
|
||||
"modified": "2025-01-30 14:58:19.746600",
|
||||
"modified": "2025-08-26 22:08:20.940308",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Core",
|
||||
"name": "DocField",
|
||||
"naming_rule": "Random",
|
||||
"owner": "Administrator",
|
||||
"permissions": [],
|
||||
"row_format": "Dynamic",
|
||||
"sort_field": "creation",
|
||||
"sort_order": "ASC",
|
||||
"states": []
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -787,7 +787,7 @@ class Document(BaseDocument):
|
|||
)
|
||||
|
||||
for df in self.meta.get(
|
||||
"fields", {"non_negative": ("=", 1), "fieldtype": ("in", ["Int", "Float", "Currency"])}
|
||||
"fields", {"non_negative": ("=", 1), "fieldtype": ("in", ["Int", "Float", "Currency", "Percent"])}
|
||||
):
|
||||
if flt(self.get(df.fieldname)) < 0:
|
||||
msg = get_msg(df)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue