[16.0][FIX] purchase_security: Compute field correctly and prevent conflicts with other modules #2533
+1
−1
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.
Before this commit, in a computed field, the assignment was done using the
write
method. However, this caused incompatibilities with other modules, for example,purchase_tier_validation
. For cache consistency, it is better to assign the field directly within the compute method instead of calling write.Steps to reproduce with purchase_tier_validation:
Create a tier definition for purchase.order with any condition.
Create a new purchase.order that satisfies the conditions for the previous rule and request validation.
The message is displayed, and the user cannot open the record. This makes it unusable, as no records can be opened anymore.
This change was introduced during the migration process in PR #1902
Runboat instance
http://oca-purchase-workflow-16-0-db4563538698.runboat.odoo-community.org/web?debug=1#cids=1&menu_id=243&action=399&model=purchase.order&view_type=form&id=50
@HviorForgeFlow @pedrobaeza could you please review this? Thanks in advance!