← Back to Pull requests

[18.0][MIG] hr_contract_rate: Migration to 18.0 #1629

Open
nimarosa opened this pull request with 1820 lines diff across 21 files
View on GitHub
nimarosa nimarosa commented on Oct 06, 2026 02:26 UTC
Author

Migration of hr_contract_rate to 18.0 from 14.0 (it was not ported to 15.0-17.0, and #1401 for 16.0 was closed).

Standard migration, module history preserved. Main changes:

  • Hooks adapted to env. post_init_hook removed, the ORM already computes the stored fields on install.

  • Contract form adapted to the 18.0 layout (amount and period on one line, in place of the wage box).

  • track_visibility -> tracking.

  • AMOUNT_PERIOD_SELECTION exported so other modules can reuse the keys.

  • Separate [FIX] commit: writing wage on an hourly/daily/weekly contract left approximate_wage outdated.
  • I'm using it in production.

    @OCA/hr-maintainers

    Diff: 1820 lines (+1820 / -0) across 21 files Reviewer: dreispt Review duration: 74069m
    All Vouch review confidence checks passed
    Residual risk 0.29 = Change Risk (0.96) × (1 − Review Confidence (0.70)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.96 · 1820 lines diff across 21 files
    0.96
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.59 · 5 substantive comment(s)
    0.59
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 50%
    69%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.400
    Sensitive Paths sensitive_paths
    0.096
    Mass File Touch mass_file_touch
    0.080
    Real PR Conversation Timeline
    10 items
    BhaveshHeliconia BhaveshHeliconia commented on code on Nov 06, 2026 03:16 UTC
    Code Review
    hr_contract_rate/views/hr_contract_views.xml:1
    @@ -0,0 +1,57 @@
    +<?xml version="1.0" encoding="UTF-8" ?>
    +<!--
    +    Copyright 2020 Brainbean Apps (https://brainbeanapps.com)
    +    License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
    +-->
    +<odoo>
    +    <record id="hr_contract_view_form" model="ir.ui.view">
    +        <field name="name">hr.contract.view.form</field>
    +        <field name="model">hr.contract</field>
    +        <field name="inherit_id" ref="hr_contract.hr_contract_view_form" />
    +        <!-- Replacing a node has to run after the plain extensions. -->
    +        <field name="priority">99</field>
    +        <field name="arch" type="xml">
    +            <!-- The wage is derived now, so the salary box asks for the rate. -->
    +            <xpath expr="//label[@for='wage']" position="attributes">
    +                <attribute name="for">amount</attribute>
    +                <attribute name="string">Rate</attribute>
    +            </xpath>
    +            <!--
    +                Amount and period on one line. A plain flex row instead of
    +                core's `o_row mw-50`: `o_row` gives every child an equal share
    +                and `mw-50` caps the row at half the cell, which squeezes the
    +                amount under the period dropdown. The widths are set in
    +                static/src/scss/hr_contract_rate.scss.
    +            -->
    +            <xpath expr="//div[@name='wage']" position="replace">
    +                <div
    +                    class="o_hr_contract_rate d-flex align-items-baseline gap-2"
    +                    name="wage"
    +                >
    +                    <field name="amount" nolabel="1" />
    +                    <span>/</span>
    +                    <field name="amount_period" class="w-auto" nolabel="1" />

                        <field name="amount" nolabel="1" required="1" />
                        <span>/</span>
                        <field name="amount_period" class="w-auto" nolabel="1" required="1" />
    

    In 14.0, both amount and amount_period had required="1" in the form view. Since neither field is required=True on the Python model (to allow creating contracts via wage), dropping required="1" lets users in the UI save contracts with an empty amount or period. Restoring required="1" keeps the 14.0 behavior and prevents saving contracts without a rate.

    oca-cla-bot[bot] oca-cla-bot[bot] commented on Nov 11, 2026 13:47 UTC
    Bot

    All commit authors signed the Contributor License Agreement.

    ![CLA signed](https://clabot.odoo-community.org/)<!-- CLA BOT SIGNING COMMENT DO NOT EDIT -->

    nimarosa nimarosa commented on Nov 11, 2026 14:01 UTC
    Author

    Good catch, applied. Thanks @BhaveshHeliconia.

    @OCA/human-resources-maintainers could someone review this one?

    dreispt dreispt approved these changes on Nov 11, 2026 15:08 UTC
    Approved Reviewer

    Approved these changes.

    BhaveshHeliconia BhaveshHeliconia approved these changes on Nov 18, 2026 09:35 UTC
    Approved Reviewer

    LGTM!

    OCA-git-bot OCA-git-bot commented on Nov 18, 2026 09:43 UTC
    Bot

    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). 🤖

    dreispt dreispt commented on Nov 18, 2026 12:23 UTC
    Contributor

    /ocabot migration hr_contract_rate
    /ocabot merge nobump

    OCA-git-bot OCA-git-bot commented on Nov 18, 2026 12:23 UTC
    Bot

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

    OCA-git-bot OCA-git-bot commented on Nov 18, 2026 12:44 UTC
    Bot

    @dreispt The merge process could not be finalized, because command twine upload --disable-progress-bar --non-interactive --repository-url https://upload.pypi.org/legacy/ -u __token__ odoo_addon_hr_contract_rate-18.0.1.0.0.4-py3-none-any.whl failed with output:

    Uploading distributions to https://upload.pypi.org/legacy/
    Uploading odoo_addon_hr_contract_rate-18.0.1.0.0.4-py3-none-any.whl
    WARNING  Error during upload. Retry with the --verbose option for more details. 
    ERROR    HTTPError: 429 Too Many Requests from https://upload.pypi.org/legacy/  
             Too Many Requests                                                      
    
    

    Reviewers
    Assignees
    nimarosa nimarosa
    Labels
    risk: low confidence: 69.5% reviewed sensitive_module
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 96% (HIGH) · Higher = larger blast radius
    96%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 69.5% · Lower = rushed or shallow review
    69.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 29.2% · Safe to merge
    29.2%
    Repository