Skip to content

fix(spp_programs): fix in-kind entitlement item form layout and product domain#24

Open
emjay0921 wants to merge 5 commits into19.0from
fix/inkind-entitlement-item-form-layout
Open

fix(spp_programs): fix in-kind entitlement item form layout and product domain#24
emjay0921 wants to merge 5 commits into19.0from
fix/inkind-entitlement-item-form-layout

Conversation

@emjay0921
Copy link
Contributor

Why is this change needed?

The in-kind entitlement manager's item form had several UI issues:

  • The form layout did not match the wizard's layout (flat structure vs organized groups)
  • Product selection showed no products because the domain filter used type=product (removed in Odoo 19, renamed to consu)
  • The Condition section was visually skewed — the CEL expression widget rendered above the radio buttons instead of below

How was the change implemented?

  • Form layout: Restructured the inline <form> in entitlement_manager_inkind_view.xml to use properly organized <group> elements matching the wizard's layout
  • Product domain: Changed domain=[("type", "=", "product")] to domain=[("type", "=", "consu")] in both entitlement_manager_inkind.py and entitlement.py to match Odoo 19's product type naming
  • Condition section: Wrapped the condition fields in <group name="condition_section" col="1"> so Odoo's form renderer enforces proper vertical ordering; added nolabel="1" to CEL-inserted fields in entitlement_inkind_cel_views.xml for full-width rendering

New unit tests

Unit tests executed by the author

How to test manually

  1. Go to Programs > Configuration > In-Kind Entitlement Managers
  2. Open a manager and click "Add a line" on the Items table
  3. Verify the Product field shows products (storable/consumable)
  4. Verify the form layout matches the wizard (Product on top, Quantity/UoM side-by-side, Condition below)
  5. Switch Condition to "CEL Expression" — verify the expression field appears below the radio buttons

Related links

@gemini-code-assist
Copy link

Summary of Changes

Hello @emjay0921, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses several UI and compatibility issues within the in-kind entitlement manager's item form. It updates the product domain filter to align with Odoo 19, restructures the form layout for better organization, and resolves visual alignment problems in the condition section. These changes collectively enhance the form's functionality and user interface.

Highlights

  • Product Domain Update: The product selection domain filter has been updated from type=product to type=consu to ensure compatibility with Odoo 19's product type naming conventions, resolving an issue where no products were displayed.
  • Form Layout Restructuring: The in-kind entitlement item form layout has been reorganized using <group> elements to match the wizard's structure, improving visual consistency and user experience.
  • Condition Section Visual Fix: The Condition section's visual skew has been corrected by wrapping condition fields in a dedicated <group> and adding nolabel='1' to CEL-inserted fields, ensuring proper vertical ordering and full-width rendering.
Changelog
  • spp_programs/models/entitlement.py
    • Updated product domain filter from 'product' to 'consu' for Odoo 19 compatibility.
  • spp_programs/models/managers/entitlement_manager_inkind.py
    • Adjusted product domain filter from 'product' to 'consu' to align with Odoo 19 product types.
  • spp_programs/views/cel/entitlement_inkind_cel_views.xml
    • Added nolabel='1' attribute to condition_mode and condition_cel_expression fields for proper rendering.
    • Applied XML formatting adjustments for readability.
  • spp_programs/views/managers/entitlement_manager_inkind_view.xml
    • Restructured the in-kind entitlement item form layout using <group> elements for better organization.
    • Introduced a separator for the 'Condition (Optional)' section.
    • Wrapped the condition field in a dedicated group and added nolabel='1' for visual alignment.
    • Applied XML formatting adjustments for readability.
Activity
  • No human activity has occurred on this pull request yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot 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

This pull request effectively addresses the UI layout issues in the in-kind entitlement item form and corrects the product domain filter for Odoo 19 compatibility. The XML view has been well-restructured using standard Odoo practices to improve the form's organization and fix rendering problems with the CEL widget. The Python changes are correct and necessary. Overall, these are solid fixes that improve both the user experience and maintainability of the code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant