feat: allow length change for decimal columns

This commit is contained in:
Hussain Nagaria 2025-09-03 15:28:10 +05:30
parent 27469efba3
commit 8f83dedbba
2 changed files with 4 additions and 2 deletions

View file

@ -143,7 +143,7 @@
"print_hide": 1
},
{
"depends_on": "eval:in_list(['Data', 'Link', 'Dynamic Link', 'Password', 'Select', 'Read Only', 'Attach', 'Attach Image', 'Int'], doc.fieldtype)",
"depends_on": "eval:in_list(['Data', 'Link', 'Dynamic Link', 'Password', 'Select', 'Read Only', 'Attach', 'Attach Image', 'Int', 'Float', 'Currency', 'Percent'], doc.fieldtype)",
"fieldname": "length",
"fieldtype": "Int",
"label": "Length"
@ -614,7 +614,7 @@
"index_web_pages_for_search": 1,
"istable": 1,
"links": [],
"modified": "2025-08-26 22:08:20.940308",
"modified": "2025-09-03 14:40:20.813091",
"modified_by": "Administrator",
"module": "Core",
"name": "DocField",

View file

@ -442,6 +442,8 @@ def get_definition(fieldtype, precision=None, length=None, *, options=None):
# NOTE: this will only be applicable for mariadb as frappe implements int
# in postgres as bigint (as seen in type_map)
size = length
elif coltype == "decimal":
size = f"{length},9"
if size is not None:
coltype = f"{coltype}({size})"