Skip to content

[IMP] base_tier_validation: clearer, self-checking tier definitions#48

Open
bosd wants to merge 1 commit into
OCA:19.0from
bosd:19.0-imp-base_tier_validation-authoring-ux
Open

[IMP] base_tier_validation: clearer, self-checking tier definitions#48
bosd wants to merge 1 commit into
OCA:19.0from
bosd:19.0-imp-base_tier_validation-authoring-ux

Conversation

@bosd
Copy link
Copy Markdown
Contributor

@bosd bosd commented May 19, 2026

Why

Creating a tier.definition is hard for non-technical users: a raw
Odoo domain ([('amount_total','>',1000)]), technical model/field
names, and three interacting knobs (sequence, approve_sequence,
approve_sequence_bypass) with nothing showing how multiple rules
combine into an ordered chain. There is also no human-readable summary
anywhere, and a bad domain only blows up later at
request_validation.

What

  • Plain-language Summary (tier_summary, computed): a one-sentence
    description of the rule shown as an info banner on the form and as a
    list column, e.g. "Tier 30 — Journal Entry where amount_total >
    1000: validated by Specific user John Doe (in sequence)"
    . Domain
    rendering is best-effort and never raises (falls back to the raw
    string).
  • Inline help on the model, filter, reviewer-field, sequence and
    approval fields, including a concrete domain example.
  • Per-model overview: the Tier Definition list now opens grouped
    by document type, in sequence order (_order = "sequence, id"), so
    the full ordered tier chain per model is visible at a glance.
  • Self-check: a malformed filter is rejected at save time with a
    clear ValidationError (consistent with the existing literal_eval
    in evaluate_tier). Non-blocking onchange warnings fire when a rule
    has no filter, or no reviewer set for the chosen Validated by.

Design note

The "reviewer not set" check is an onchange warning, not a
constraint
, on purpose: definitions are legitimately created
incomplete -- programmatically and by bridge modules (e.g.
account_move_tier_validation creates a definition then sets the
reviewer later). A hard constraint would regress those flows and
existing tests. Only the domain-parse check is hard, because the
runtime already requires the domain to be literal_eval-able.

Tests

test_36test_39: summary is human-readable (names model, condition,
reviewer); malformed domain blocked at create; empty-domain and
missing-reviewer onchanges return warnings.

Scope

19.0 only. No __manifest__.py bump (ocabot bumps on merge).

@OCA-git-bot
Copy link
Copy Markdown
Contributor

Hi @LoisRForgeFlow,
some modules you are maintaining are being modified, check this out!

@OCA-git-bot OCA-git-bot added mod:base_tier_validation Module base_tier_validation series:19.0 labels May 19, 2026
@bosd bosd force-pushed the 19.0-imp-base_tier_validation-authoring-ux branch 4 times, most recently from cd6630a to 07aade2 Compare May 19, 2026 20:01
Authoring a tier definition is hard for non-technical users: a raw
domain, technical model/field names, and opaque sequence/approve knobs
with no indication of how rules combine -- and the only way to verify a
rule is the full live request/approve loop.

- Add a computed plain-language Summary (form banner + list column)
  describing in one sentence which documents the rule covers and who
  must validate it.
- Add inline help to the model, filter, reviewer-field, sequence and
  approval fields, with a concrete domain example.
- Open the Tier Definition list grouped by document type in sequence
  order, so the full ordered tier chain per model is visible at a
  glance (and add _order = "sequence, id").
- Block a malformed filter at save time with a clear error (the engine
  already literal_eval's it at request time), and warn -- without
  blocking -- when a rule has no filter or no reviewer set yet. The
  reviewer check is an onchange, not a constraint, so programmatic /
  bridge-module creation of not-yet-complete definitions still works.
@bosd bosd force-pushed the 19.0-imp-base_tier_validation-authoring-ux branch from 07aade2 to 6b431b2 Compare May 19, 2026 20:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mod:base_tier_validation Module base_tier_validation series:19.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants