[17.0][FIX] base_tier_validation - fix 'false positive' raise #1024
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.
base_tier_validation/models/tier_validation.py may raise an exception in the _tier_validation_check_write_allowed() method when there is no change (when vals[fld] == rec[fld]).
I encountered this case while using the account_move_tier_validation module and posting a number of validated supplier invoices via the list view (Action -> Post entries).
In this case the account.move sequence mixin generates a write on the sequence_prefix field but vals["sequence_prefix"] is equal to rec.sequence_prefix hence this is not 'real' write and we should not prevent the posting in such a case (when Confirming these same invoices via the form view no raise is generated).
The solution is to limit raise to writes that do modify the field value.