Skip to content

[19.0][ADD] base_tier_validation: tier.definition.allow_reject for sign-off tiers - #42

Open
bosd wants to merge 1 commit into
OCA:19.0from
bosd:19.0-imp-base_tier_validation-allow-reject
Open

[19.0][ADD] base_tier_validation: tier.definition.allow_reject for sign-off tiers#42
bosd wants to merge 1 commit into
OCA:19.0from
bosd:19.0-imp-base_tier_validation-allow-reject

Conversation

@bosd

@bosd bosd commented May 14, 2026

Copy link
Copy Markdown
Contributor

Summary

Add a per-definition Boolean allow_reject so workflows can model sign-off / informational tiers where the reviewer acknowledges the document but cannot reject it.

Definition Reviewer sees
allow_reject = True (default) Validate + Reject (current behaviour)
allow_reject = False Validate only

Requested by a client who wanted certain tiers to act as "seen" stamps rather than veto points.

How it works

  • Per-definition gate (not per-user). Tier author decides; matches existing knob pattern (next to approve_sequence, approve_sequence_bypass).
  • New computed Boolean tier.validation.can_reject drives the Reject button's invisible="not can_reject". True iff the user can act AND at least one of their actionable reviews has allow_reject=True.
  • reject_tier is also filtered: a reviewer assigned to a mix of sign-off and regular tiers can still reject the regular ones; the sign-off reviews stay pending.

Backwards compatibility

allow_reject defaults to True. Existing definitions and behaviour are unchanged. Opt-in.

Tests

  • test_allow_reject_false_hides_reject_buttoncan_review stays True, can_reject flips False.
  • test_reject_tier_skips_definitions_with_allow_reject_false — reject_tier called on a mixed batch only rejects the rejectable tiers.

Future work (deferred)

Optional reject_user_ids Many2many on the definition would let a single tier be rejectable by some reviewers (e.g. seniors) but only sign-off-able by others. Held back until a real client asks; the per-definition gate covers the immediate ask.

@OCA-git-bot

Copy link
Copy Markdown
Contributor

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

… tiers

Model some tier reviews as "informational" / "sign-off" only -- the
reviewer is expected to acknowledge but cannot block the workflow with
a Reject. Implemented as a per-definition Boolean so the tier author
controls the policy, rather than a per-user gate.

- New ``tier.definition.allow_reject`` Boolean (default ``True``,
  i.e. backwards compatible -- nothing changes for existing
  definitions). When unchecked, reviewers of that tier see Validate
  but no Reject on the validation banner.
- New computed ``tier.validation.can_reject`` Boolean that drives the
  Reject button's visibility in the form template. It is True only if
  the user can act on the record *and* at least one of their
  actionable tier reviews has ``allow_reject = True``.
- ``reject_tier`` now filters out reviews whose definition forbids
  rejection. A reviewer assigned to a mix of sign-off and regular
  tiers can still reject the regular ones; the sign-off ones stay
  pending.
- ``allow_reject`` exposed on the tier definition form view under the
  approve-sequence block.

Tests:

- ``test_allow_reject_false_hides_reject_button`` -- a sign-off
  definition leaves ``can_review`` True but flips ``can_reject``
  False, so the template hides the button.
- ``test_reject_tier_skips_definitions_with_allow_reject_false`` --
  the action itself only rejects the reviews whose definition allows
  it; sign-off reviews stay pending.

Future work (deferred): an optional ``reject_user_ids`` Many2many on
the definition would let a single tier be rejectable by some
reviewers (e.g. seniors) but only sign-off-able by others. This PR
ships the simpler per-definition gate first.
@bosd
bosd force-pushed the 19.0-imp-base_tier_validation-allow-reject branch from 0d6eb70 to 82bd62a Compare July 22, 2026 23:08
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