[19.0] [MIG] partner_rank_single : Migration to 19.0.#2369
Open
uncannycs wants to merge 8 commits into
Open
Conversation
Currently translated at 100.0% (2 of 2 strings) Translation: partner-contact-18.0/partner-contact-18.0-partner_rank_single Translate-URL: https://translation.odoo-community.org/projects/partner-contact-18-0/partner-contact-18-0-partner_rank_single/it/
Instead of running the constraint check on `_increase_rank`, we now avoid
increasing it if the partner is already ranked in the opposite field.
This fixes an error that occurs when installing demo data of core modules:
```python-traceback
2025-12-11 11:44:05,845 35 ERROR testdb odoo.addons.account.demo.account_demo: Error while posting demo data
Traceback (most recent call last):
File ".../odoo/addons/account/demo/account_demo.py", line 90, in _post_load_demo_data
move.action_post()
File ".../odoo/addons/account/models/account_move.py", line 5426, in action_post
self._post(soft=False)
File ".../odoo/addons/account/models/account_move.py", line 5154, in _post
(partner | partner.commercial_partner_id)._increase_rank('supplier_rank', count)
File ".../partner-contact/partner_rank_single/models/res_partner.py", line 23, in _increase_rank
"supplier_rank": "customer_rank",
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File ".../partner-contact/partner_rank_single/models/res_partner.py", line 15, in _constrains_single_rank
raise ValidationError(
odoo.exceptions.ValidationError: A contact cannot be both a customer and a supplier.
```
BhaveshHeliconia
suggested changes
Jun 1, 2026
Contributor
BhaveshHeliconia
left a comment
There was a problem hiding this comment.
Consider using BaseCommon instead of TransactionCase. In this case, there’s no need to redefine DISABLED_MAIL_CONTEXT.
| { | ||
| "name": "Partner Rank Single", | ||
| "summary": "Introduce single rank for partners.", | ||
| "version": "19.0.2.0.0", |
Contributor
There was a problem hiding this comment.
Suggested change
| "version": "19.0.2.0.0", | |
| "version": "19.0.1.0.0", |
1f4efaf to
3a6cba3
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.