[18.0][MIG] contract_payment_mode_partner: Migration to 18.0#722
[18.0][MIG] contract_payment_mode_partner: Migration to 18.0#722
Conversation
There was a problem hiding this comment.
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 |
| "summary": "This module assigns the partner payment mode to the " | ||
| "contract if it remains valid.", |
There was a problem hiding this comment.
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.\"
| "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.", |
| rec.payment_mode_id = partner.supplier_payment_mode_id.id | ||
| else: | ||
| rec.payment_mode_id = partner.customer_payment_mode_id.id |
There was a problem hiding this comment.
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
| 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 |
1c9e251 to
4b45294
Compare
4b45294 to
c261c79
Compare
c261c79 to
1b055c9
Compare
Codecov Report❌ Patch coverage is
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. 🚀 New features to boost your workflow:
|
No description provided.