fix(templates): a create-only calculated action no longer renders the field read-only - #6698
Merged
Merged
Conversation
… field read-only isCalculatedProperty drove a hard `disabled` on the generated inputs, which is right for a DERIVED field (Balance recomputes on every write) but wrong for a field whose only calculated aspect is calculatedActionOnCreate - that is a server-side DEFAULT (Due from the customer's terms, Currency from the company, a document's tax event date, its bank account). The documented contract for those is "pre-filled AND editable - a value you pick is respected", and the actions implement exactly that (a non-null incoming value always wins); the REST layer honored a user value the form could no longer produce. Concretely: wiring the currency default (#6687) made the Currency picker un-editable - an invoice in another currency could no longer be created from the form. Read-only now means DERIVED: an expression (create or update) or an update-time recompute action. A field that must stay locked despite a create-only action says readOnly: true explicitly (kept working, and now also enrolls the field in the generated update()'s system-owned preservation). Emission sites: document-view.html.template, manage/form-view.html.template, master/detail-register.js.template. Closes #6696. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Closes #6696.
isCalculatedPropertydrove a harddisabledon the generated inputs. That is right for a DERIVED field (Balance recomputes on every write) but wrong for a field whose only calculated aspect iscalculatedActionOnCreate— that is a server-side DEFAULT (Due from the customer's terms, Currency from the company, a document's tax event date, its bank account). The documented contract for those is "pre-filled AND editable — a value you pick is respected", and the actions implement exactly that (a non-null incoming value always wins); the REST layer honored a user value the form could no longer produce. Concretely: wiring a currency default (#6687) made the Currency picker un-editable — an invoice in another currency could no longer be created from the form.Read-only now means DERIVED: an expression (create or update) or an update-time recompute action. A field that must stay locked despite a create-only action says
readOnly: trueexplicitly — kept working, and it also enrolls the field in the generatedupdate()'s system-owned preservation (#6689).Emission sites:
document/document-view.html.template,manage/form-view.html.template,master/detail-register.js.template.Verified end-to-end on a local instance against the BusinessIntents suite: after regen, the defaulted Currency / Bank Account / Tax Event Date / Due inputs render
:disabled="isPreview"(editable on create/edit), derived fields stay locked, and a REST create with no picks lands the defaults while explicit picks are respected.🤖 Generated with Claude Code