Skip to content

[19.0][IMP] base_tier_validation: smart-button on validated documents#33

Open
bosd wants to merge 2 commits into
OCA:19.0from
bosd:19.0-imp-base_tier_validation-smart-button
Open

[19.0][IMP] base_tier_validation: smart-button on validated documents#33
bosd wants to merge 2 commits into
OCA:19.0from
bosd:19.0-imp-base_tier_validation-smart-button

Conversation

@bosd
Copy link
Copy Markdown
Contributor

@bosd bosd commented May 13, 2026

Summary

Add a Reviews smart-button to every validated record (account.move, sale.order, ...) showing the number of tier.review rows attached to that document and opening a filtered list when clicked.

How it works

  • New tier_review_count computed integer on the tier.validation abstract mixin (depends on review_ids; simple len).
  • New action_view_tier_reviews() helper returning an ir.actions.act_window scoped to the current record's reviews (domain on model + res_id). Reusable by bridge modules that want to surface their own jump links.
  • New tier_validation_smart_button QWeb template with the <button class="oe_stat_button"> markup + statinfo counter widget.
  • Hooked into the existing get_view auto-injection used for buttons/label/reviews: when a form view already has <div name="button_box">, the smart-button is appended. Only fires for _tier_validation_manual_config = False (which is the standard bridge setup, including account.move). Bridge modules with manual config can xpath the template in themselves.

Also ships a minimal form view for tier.review so clicking through drills into individual reviews instead of Odoo's autogenerated form.

Why auto-inject rather than per-bridge XML

Symmetric with what already happens for buttons/label/reviews. account.move, sale.order, and other bridges pick it up automatically (zero XML changes in account_move_tier_validation). For custom validated models that want manual control, the template is still public and xpath-able.

Test plan

  • New test_action_view_tier_reviews: create a record, request validation, assert tier_review_count > 0, assert action_view_tier_reviews() returns an action with res_model='tier.review' and a domain pinned to the record's model + res_id.
  • Manual: open any account.move under validation in a fresh DB; Reviews smart-button appears in the button_box with the count; clicking opens the filtered list.

Companion follow-ups

  • Progressbar progress indicator on the same docs (separate PR).
  • tier.correction.item.resource_ref domain fix (separate PR).
  • Bulk approve/reject in the systray-opened list view (separate PR, AND semantics).

Add a "Reviews" smart-button to every validated record (account.move,
sale.order, ...) showing the number of tier.review rows attached to
the record and opening a filtered list when clicked.

How it works:

- New `tier_review_count` computed integer on the tier.validation
  abstract mixin (depends on review_ids; simple len, no query gymnastics).
- New `action_view_tier_reviews` method on the mixin returning an
  ir.actions.act_window scoped to the current record's reviews
  (domain on model + res_id). Reusable by bridge modules that want to
  add their own jump links.
- New `tier_validation_smart_button` QWeb template emitting the
  `<button class="oe_stat_button">` markup with the counter widget.
- Hooked into the existing `get_view` auto-injection machinery: when
  a form view already has `<div name="button_box">`, the smart-button
  is appended (only for models with `_tier_validation_manual_config =
  False`, which is the typical bridge-module setup, including
  account.move). Bridge modules without auto-injection can xpath the
  template in manually.

Also ships:

- Minimal form view for `tier.review` so clicking through from the
  smart-button drills into individual reviews instead of falling back
  to Odoo's autogenerated form.
- `action_tier_review` window action referenced by the helper method.

Test exercises the helper end-to-end: create a record, request
validation, check the counter is non-zero and the returned action's
domain points at the expected record.
@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 13, 2026
…is appended, not its fields

`get_view` iterates `for new_element in new_node` and appends each
child of the rendered template to the matched node. With a bare
`<button>` at the template root, that loop iterated the *button's*
children (the `<field widget="statinfo">`) and appended the field to
`button_box` -- not the button itself. The result on screen was
"1Reviews" as raw text, no icon, no styling.

Wrap the button in a `<div>` (same pattern as the existing
`tier_validation_buttons` template). The div is the discarded
wrapper; its single child -- the actual `<button class="oe_stat_button">`
-- gets appended into `button_box` with its label/icon/click handler
intact.
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