Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

AungKoKoLin1997
Copy link
Contributor

Based on #3305

The module adds configurable banners for backend form views. Define rules per model
(and optionally per view) to show context-aware alerts with a chosen severity (info/warning/danger).

Messages can be plain text with ${placeholders} or fully custom HTML; visibility,
severity, and values are computed server-side via a safe Python expression.

Banners are injected just before or after a target node (default: //sheet) and refresh
on form load/save/reload.

@qrtl QT5747

yostashiro and others added 9 commits October 8, 2025 02:09
Refactor JS:
- Switch to the ESM style
- Change var to const/let
- Remove unused parts (diff, el.dataset.wfbTriggerFields)

Miscellaneous improvements:
- list view optional
- Switch archive box icon to banner

Co-authored-by: Yoshi Tashiro <[email protected]>
- Add (partial) support for elements inside groups to be a target
  XPath without distorting the presentation
- Remove obsolete bits
@AungKoKoLin1997 AungKoKoLin1997 force-pushed the 18.0-mig-web_form_banner branch from 377f7fb to 0ed0be9 Compare October 8, 2025 02:53
Copy link
Member

@yostashiro yostashiro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to demonstrate the possibility of showing a message inside a group.

Copy link
Member

@bealdav bealdav left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested functionnally.
really thanks

@AungKoKoLin1997 AungKoKoLin1997 force-pushed the 18.0-mig-web_form_banner branch from bf36f5d to 1104c6a Compare October 9, 2025 07:38
Copy link
Member

@yostashiro yostashiro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code review. LGTM.

model_id = fields.Many2one("ir.model", ondelete="cascade", required=True)
model_name = fields.Char(related="model_id.model", store=True, readonly=True)
model_name = fields.Char(
related="model_id.model", string="Model Name", store=True, readonly=True
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need to add string?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found the default label of this field is Model and same with label of model_id.
So, that causes the pre-commit issue and added string to fix.

Copy link
Member

@yostashiro yostashiro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just noticed an issue. The banner doesn't seem to reload when records are switched with previous/next button.

image

This issue seems to be present in the current 17.0 and 18.0 PRs. It's not the case with 16.0 (the banner reloads fine).

@AungKoKoLin1997 Can you please look into this?

@AungKoKoLin1997 AungKoKoLin1997 force-pushed the 18.0-mig-web_form_banner branch 4 times, most recently from e95b866 to 4bc329e Compare October 15, 2025 03:36
Copy link
Member

@yostashiro yostashiro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code review and functional test. LGTM.

Should be used instead of <code
>record</code> when your rule is triggered dynamically by an
update to a trigger field. It doesn't include any values from complex fields
(x2many/reference, etc).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
(x2many/reference, etc).
(one2many/reference, etc).

- Fix not updating banner when pager is update or duplicate or create
- Fix presentation of help in web form banner rule
Copy link

@kanda999 kanda999 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Functioanl review: it works as expected

@sebastienbeau
Copy link
Member

/ocabot merge nobump

@OCA-git-bot
Copy link
Contributor

This PR looks fantastic, let's merge it!
Prepared branch 18.0-ocabot-merge-pr-3308-by-sebastienbeau-bump-nobump, awaiting test results.

@OCA-git-bot
Copy link
Contributor

Congratulations, your PR was merged at 0762d94. Thanks a lot for contributing to OCA. ❤️

@OCA-git-bot OCA-git-bot merged commit fb75847 into OCA:18.0 Oct 23, 2025
7 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants