fix(selling): make commission_rate a Percent field on Sales Person and Sales Team

commission_rate was a free-text Data field on the Sales Person master and the
Sales Team child, storing percentages as strings. Convert both to Percent.

A pre_model_sync patch sanitizes the existing values first (empty / NULL /
non-numeric -> 0, others normalised via flt) so the Data -> Percent column
change casts cleanly under strict SQL mode, where Percent is a NOT NULL
decimal column. The patch is idempotent and avoids db-specific SQL so it works
on both MariaDB and Postgres.
This commit is contained in:
Nabin Hait
2026-06-21 12:59:47 +05:30
parent bcd850c808
commit 2fe0601a2e
4 changed files with 29 additions and 6 deletions

View File

@@ -54,7 +54,7 @@
},
{
"fieldname": "commission_rate",
"fieldtype": "Data",
"fieldtype": "Percent",
"label": "Commission Rate",
"print_hide": 1
},
@@ -145,7 +145,7 @@
"idx": 1,
"is_tree": 1,
"links": [],
"modified": "2024-03-27 13:10:37.891377",
"modified": "2026-06-21 12:52:33.742603",
"modified_by": "Administrator",
"module": "Setup",
"name": "Sales Person",
@@ -184,4 +184,4 @@
"sort_field": "creation",
"sort_order": "ASC",
"states": []
}
}