Repository navigation
Fork Sync Branch 18.0 - #16
Merged
Merged
Conversation
…y_returned
_compute_qty_returned() iterated over every move of the line, so a
return was counted even when it belonged to a product that is no longer
the one on the line. When a wrong product is received, returned to the
vendor marked to refund, and then corrected on the same purchase order
line, that return was subtracted from what is left to bill for the new
product: qty_to_invoice dropped to 0 and invoice_status became
'invoiced' with nothing actually billed, so the vendor bill could not be
created ("There is no invoiceable line").
Iterate over _get_po_line_moves() instead, which filters the moves by
the product of the line. It is the same helper the core uses in
_compute_qty_received(), so both quantities are now built from the same
set of moves. A return of the product that is on the line keeps being
counted, so the refund case is unchanged.
Add move_ids.to_refund to the depends as well: the flag is what decides
whether a move counts as returned, and without it correcting the flag
left the stored qty_to_invoice and invoice_status untouched.
closes #370
Signed-off-by: les-adhoc <les@adhoc.inc>
Signed-off-by: Matias Velazquez <mav@adhoc.com.ar>
sireko
approved these changes
Sep 10, 2026
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.