Skip to content

[18.0][MIG] contract_payment_mode_partner: Migration to 18.0#722

Open
deeniiz wants to merge 3 commits into18.0from
18.0-mig-contract_payment_mode_partner
Open

[18.0][MIG] contract_payment_mode_partner: Migration to 18.0#722
deeniiz wants to merge 3 commits into18.0from
18.0-mig-contract_payment_mode_partner

Conversation

@deeniiz
Copy link
Copy Markdown
Collaborator

@deeniiz deeniiz commented Sep 25, 2025

No description provided.

Copilot AI review requested due to automatic review settings September 25, 2025 16:25
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR migrates the contract_payment_mode_partner module from a previous version to Odoo 18.0. The module automatically assigns partner payment modes to contracts based on the partner's configured payment modes.

Key changes:

  • Complete module structure creation for 18.0 compatibility
  • Implementation of computed payment mode field with dependency tracking
  • Addition of post-installation hook to update existing contracts

Reviewed Changes

Copilot reviewed 11 out of 12 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
__manifest__.py Module manifest with dependencies and metadata for 18.0
models/contract.py Core logic for computing payment mode from partner settings
hooks.py Post-installation hook to update existing contract records
views/contract_view.xml UI modifications to make payment mode field readonly
README.rst Module documentation and description
Various readme/ files Documentation components for auto-generated README

Comment on lines +7 to +8
"summary": "This module assigns the partner payment mode to the "
"contract if it remains valid.",
Copy link

Copilot AI Sep 25, 2025

Choose a reason for hiding this comment

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

The summary string is split across two lines unnecessarily. Consider combining it into a single line for better readability: \"This module assigns the partner payment mode to the contract if it remains valid.\"

Suggested change
"summary": "This module assigns the partner payment mode to the "
"contract if it remains valid.",
"summary": "This module assigns the partner payment mode to the contract if it remains valid.",

Copilot uses AI. Check for mistakes.
Comment on lines +29 to +31
rec.payment_mode_id = partner.supplier_payment_mode_id.id
else:
rec.payment_mode_id = partner.customer_payment_mode_id.id
Copy link

Copilot AI Sep 25, 2025

Choose a reason for hiding this comment

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

Directly accessing .id on Many2one fields can cause issues if the field is empty (False). Consider using the field directly without .id since Odoo handles Many2one assignments automatically: rec.payment_mode_id = partner.supplier_payment_mode_id and rec.payment_mode_id = partner.customer_payment_mode_id

Suggested change
rec.payment_mode_id = partner.supplier_payment_mode_id.id
else:
rec.payment_mode_id = partner.customer_payment_mode_id.id
rec.payment_mode_id = partner.supplier_payment_mode_id
else:
rec.payment_mode_id = partner.customer_payment_mode_id

Copilot uses AI. Check for mistakes.
@deeniiz deeniiz force-pushed the 18.0-mig-contract_payment_mode_partner branch from 1c9e251 to 4b45294 Compare September 29, 2025 14:28
@deeniiz deeniiz requested a review from eantones September 29, 2025 14:31
@deeniiz deeniiz force-pushed the 18.0-mig-contract_payment_mode_partner branch from 4b45294 to c261c79 Compare September 29, 2025 15:21
@deeniiz deeniiz force-pushed the 18.0-mig-contract_payment_mode_partner branch from c261c79 to 1b055c9 Compare March 12, 2026 11:43
@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 12, 2026

Codecov Report

❌ Patch coverage is 68.42105% with 6 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (18.0@4b294fd). Learn more about missing BASE report.

Files with missing lines Patch % Lines
contract_payment_mode_partner/models/contract.py 50.00% 5 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             18.0     #722   +/-   ##
=======================================
  Coverage        ?   68.42%           
=======================================
  Files           ?        4           
  Lines           ?       19           
  Branches        ?        3           
=======================================
  Hits            ?       13           
  Misses          ?        5           
  Partials        ?        1           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

2 participants