Skip to content

Conversation

@fcayre
Copy link
Member

@fcayre fcayre commented Dec 18, 2025

A div tag with the o_setting_box class is added around the fields and their label.

This seems to be a more standard markup among the OCA. At least the remove_odoo_enterprise module expects it, see issue OCA/server-brand#116

A `div` tag with the `o_setting_box` class is added around the
fields and their label.

This seems to be a more standard markup among the OCA.
At least the remove_odoo_enterprise module expects it, see issue
OCA/server-brand#116
@fcayre
Copy link
Member Author

fcayre commented Dec 19, 2025

This is how it looks like (Configuration > General settings > Invoicing > Contract section) with proposed markup.

Screenshot 2025-12-19 at 09-17-33 Odoo - Settings

Copy link

@Honeyxilia Honeyxilia 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 + visual test OK

Copy link
Contributor

@remi-filament remi-filament left a comment

Choose a reason for hiding this comment

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

It works, though I think you do not need to create 2 separate o_settings_container div, since these are related.
You probably could use the following instead :

        <xpath expr="//div[div[div[field[@name='create_new_line_at_contract_line_renew']]]]" position="after">
                <div class="row mt16 o_settings_container">
                    <div class="col-12 col-lg-6 o_setting_box">
                        <div class="o_setting_left_pane">
                            <field name="enable_contract_forecast"/>
                        </div>
                        <div class="o_setting_right_pane">
                            <label for="enable_contract_forecast"/>
                            <div class="row mt16" attrs="{'invisible': [('enable_contract_forecast', '=', False)]}">
                                <label for="contract_forecast_interval" string="Forecast Interval" class="oe_inline"/>
                                <div>
                                    <field name="contract_forecast_interval" class="oe_inline"/>
                                    <field name="contract_forecast_rule_type" class="oe_inline"/>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </xpath>

(also I find it easier to read xpath using div[xxx] rather than xxx/parent::div so I proposed that change as well in code snippet above)

…gs_container div

This simplifies the markup and reduce useless vertical gaps between them.
@fcayre
Copy link
Member Author

fcayre commented Dec 19, 2025

@remi-filament thanks for the suggestion. While we're at improving the xpath I made a different suggestion though, please review.

cc @Honeyxilia for a new review also please.

…ter the contract's

The new xpath is both:
- more robust as is does not depend on the intermediate tags between
  the targeted container and the field it contains
- more explicit as it selects explicitely a o_settings_container div
  before adding a similar container right after the targeted one.
@fcayre fcayre force-pushed the 16.0-fix-contract_forecast-setting-view-fields-without-o_setting_box branch from 2560b3c to 9cb2cf1 Compare December 19, 2025 17:17
Copy link
Contributor

@remi-filament remi-filament left a comment

Choose a reason for hiding this comment

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

Hi @fcayre thanks for this improvement, my comments below (none are blocking) :

  1. Good catch with /ancestor which is more readable than multiple parents, though IMO it is harder to understand than imbricated div (div[div[div[field[]]]]), but this is my personal pov
  2. I still think that you could have the second part with interval in the same
    than the enable_contract_forecast boolean (which also makes sense since these parameters are related and could therefore be grouped in the same o_setting_box div)

@OCA-git-bot
Copy link
Contributor

This PR has the approved label and has been created more than 5 days ago. It should therefore be ready to merge by a maintainer (or a PSC member if the concerned addon has no declared maintainer). 🤖

@etobella
Copy link
Member

Use a proper commit name please

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.

5 participants