[FIX] account, sale_stock: protect moves on line create#234567
Closed
fw-bot wants to merge 1 commit into
Closed
Conversation
Versions -------- - 17.0+ Steps ----- 1. Enable anglo-saxon accounting; 2. have a product category with automated AVCO; 3. assign category to a deliverable product; 4. set product to invoice on delivery; 5. add product to a sales order; 6. confirm order & delivery; 7. create invoice; 8. change the delivery on the invoice; 7. confirm the invoice. Issue ----- The delivery date gets reset. Cause ----- Commit 818cf04 added `delivery_date` as a permanently protected field when modifying moves or move lines, protecting the records on `write`. With anglo-saxon accounting however, new move lines are created when confirming an invoice, which in turn recalculate the delivery date, as `_get_protected_vals` isn't used for their move on `create`. Solution -------- Add `self.env['account.move'].protecting(_get_protected_vals({}, moves))` when creating new lines for a move, to avoid recomputing fields that should always be protected. opw-4965036 X-original-commit: 84828f1
Contributor
Contributor
Author
|
This PR targets 19.0 and is part of the forward-port chain. Further PRs will be created up to master. More info at https://github.com/odoo/odoo/wiki/Mergebot#forward-port |
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.

Versions
Steps
Issue
The delivery date gets reset.
Cause
Commit 818cf04 added
delivery_dateas a permanently protected field when modifying moves or move lines, protecting the records onwrite. With anglo-saxon accounting however, new move lines are created when confirming an invoice, which in turn recalculate the delivery date, as_get_protected_valsisn't used for their move oncreate.Solution
Add
self.env['account.move'].protecting(_get_protected_vals({}, moves))when creating new lines for a move, to avoid recomputing fields that should always be protected.opw-4965036
Forward-Port-Of: #231186