Draft
Add alpha_numeric widget for nullable numeric fields with special code support#96
alpha_numeric widget for nullable numeric fields with special code support#96Conversation
…ews, migration Agent-Logs-Url: https://github.com/agrogers/aps_sis/sessions/82516a2f-7fc6-4250-873b-170fd375d89c Co-authored-by: agrogers <13920678+agrogers@users.noreply.github.com>
…on, add JSDoc Agent-Logs-Url: https://github.com/agrogers/aps_sis/sessions/82516a2f-7fc6-4250-873b-170fd375d89c Co-authored-by: agrogers <13920678+agrogers@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Create numeric widget that handles null values and formatting
Add May 3, 2026
alpha_numeric widget for nullable numeric fields with special code support
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Odoo float fields cannot hold
NULL— the sentinel hack (-0.01) works for blank display but breaks down when scores need to carry semantic meaning like "Absent" or "Cheating". This adds a proper solution: a paired Char field (score_alpha) that holds either a formatted number or a configurable special code, keeping the underlying float field in sync automatically.Widget (
alpha_numeric)New OWL field widget registered as
"alpha_numeric"forcharfields:["-", "A", "C"])decimal_places+use_separatoroptions_alphasuffix convention (score_alpha→score); overridable vianumeric_fieldoptionsentinelto the float, numbers write the parsed valuePython model (
aps.resource.submission)score_alphaandout_of_marks_alphaChar fields added (bothtracking=True)alpha_to_float(val, sentinel)helper — parses number strings, returnssentinelfor empty/special codes@api.onchangehandlers keep the numeric fields live during UI editswrite()override syncs alpha → numeric on programmatic saves (runs before theauto_scoreflag check so the flag is correctly set toFalse)Migration (
18.0.1.0.45)Post-migration back-fills
score_alpha/out_of_marks_alphafrom existing float values usingFMformat with 6 decimal places to preserve precision.