Skip to content

Conversation

@emjay0921
Copy link
Contributor

Why is this change needed?

  1. Impact records and incidents remained editable after being closed.
  2. Module was at Alpha status but ready for Beta.
  3. OCA banner in README should be removed.

How was the change implemented?

  • Added readonly="verification_status == 'closed'" to all editable fields in impact form.
  • Added readonly="status == 'closed'" to all editable fields in incident form.
  • Set development_status to Beta, added emjay0921 as maintainer.
  • Removed OCA banner from README/HTML.

New unit tests

Unit tests executed by the author

How to test manually

  • Open a closed incident — all fields should be readonly
  • Open a closed impact record — all fields should be readonly
  • Verify "Reset to Reported" button still works to unlock a closed impact
  • Check README badge shows Beta (yellow) not Alpha (red)

Related links

…iner

- Set development_status to Beta
- Add emjay0921 as maintainer
- Make impact records readonly when verification_status is closed
- Make incident forms readonly when status is closed
- Remove OCA banner from README
@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 significantly enhances the user experience and stability of the spp_hazard module by preventing unintended modifications to closed incident and impact records. It also formally recognizes the module's maturity by promoting its development status to Beta and updates associated documentation and maintainer information.

Highlights

  • UX Improvements for Closed Records: Implemented readonly attributes on various fields within both impact records and incident forms. This prevents editing of these fields once the respective record's status is 'closed' or 'verified closed', addressing a previous issue where records remained editable.
  • Module Promotion to Beta: The spp_hazard module has been promoted from 'Alpha' to 'Beta' development status, reflecting its increased stability and readiness. This change is reflected in the module's manifest file and its README badges.
  • Documentation Updates: The Odoo Community Association (OCA) banner has been removed from the README.rst and index.html description files. The maturity badge in these files has also been updated to display 'Beta' (yellow) instead of 'Alpha' (red).
  • Maintainer Addition: User emjay0921 has been added to the list of maintainers for the spp_hazard module in both the __manifest__.py file and the README.rst.
Changelog
  • spp_hazard/README.rst
    • Removed the Odoo Community Association (OCA) banner.
    • Updated the maturity badge from 'Alpha' (red) to 'Beta' (yellow).
    • Added emjay0921 to the list of current maintainers.
  • spp_hazard/manifest.py
    • Updated the development_status from 'Alpha' to 'Beta'.
    • Added emjay0921 to the list of maintainers.
  • spp_hazard/static/description/index.html
    • Removed the Odoo Community Association (OCA) banner.
    • Updated the maturity badge from 'Alpha' to 'Beta'.
  • spp_hazard/views/hazard_impact_views.xml
    • Added readonly="verification_status == 'closed'" to registrant_id, incident_id, impact_type_id, damage_level, impact_date, and notes fields to prevent editing when an impact record is closed.
  • spp_hazard/views/hazard_incident_views.xml
    • Added readonly="status == 'closed'" to name, code, category_id, severity, start_date, end_date, description, incident_area_ids, and impact_ids fields to prevent editing when an incident record is closed.
    • Made the descriptive paragraph for 'Affected Areas' invisible when the incident status is 'closed'.
Activity
  • No human activity has been recorded 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 successfully promotes the spp_hazard module to Beta status and enhances the user experience by making closed impact records and incidents read-only, as described. The implementation is solid. My review includes a few suggestions to improve the consistency of XML formatting for better code maintainability.

Comment on lines +70 to +71
<field name="impact_type_id" options="{'no_create': True}"
readonly="verification_status == 'closed'"/>

Choose a reason for hiding this comment

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

medium

The formatting of attributes for this field tag is inconsistent with other fields in this file (e.g., registrant_id on line 54). For better readability and maintainability, please adopt a consistent style where attributes other than name and placeholder are on new lines.

Suggested change
<field name="impact_type_id" options="{'no_create': True}"
readonly="verification_status == 'closed'"/>
<field name="impact_type_id"
options="{'no_create': True}"
readonly="verification_status == 'closed'"/>

Comment on lines +74 to +75
<field name="category_id" options="{'no_create': True}"
readonly="status == 'closed'"/>

Choose a reason for hiding this comment

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

medium

The formatting of attributes for this field tag is inconsistent with other fields in this file (e.g., name on line 66). For better readability and maintainability, please adopt a consistent style where attributes other than name and placeholder are on new lines.

Suggested change
<field name="category_id" options="{'no_create': True}"
readonly="status == 'closed'"/>
<field name="category_id"
options="{'no_create': True}"
readonly="status == 'closed'"/>

<p class="text-muted">Add areas affected by this incident. Specify severity and population estimates for each area.</p>
<field name="incident_area_ids">
<p class="text-muted" invisible="status == 'closed'">Add areas affected by this incident. Specify severity and population estimates for each area.</p>
<field name="incident_area_ids" readonly="status == 'closed'">

Choose a reason for hiding this comment

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

medium

For fields that contain child elements, it's better to place attributes on new lines for readability. This also makes it consistent with how other fields are formatted in this file.

                            <field name="incident_area_ids"
                                readonly="status == 'closed'">

</page>
<page string="Impacts" name="impacts">
<field name="impact_ids">
<field name="impact_ids" readonly="status == 'closed'">

Choose a reason for hiding this comment

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

medium

For fields that contain child elements, it's better to place attributes on new lines for readability. This also makes it consistent with how other fields are formatted in this file.

                            <field name="impact_ids"
                                readonly="status == 'closed'">

Add custom tools/readme_template.rst.jinja to avoid OCA banner in
generated READMEs. Add --template-filename to pre-commit config.
Regenerate spp_hazard README with correct template.
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