Skip to content

Fork Sync Branch 18.0 - #16

Merged
btl-bot merged 1 commit into
BTLzdravtech:18.0from
ingadhoc:18.0
Sep 10, 2026
Merged

btl-bot merged 1 commit into
BTLzdravtech:18.0from
ingadhoc:18.0

Conversation

@btl-bot

@btl-bot btl-bot commented Sep 10, 2026

Copy link
Copy Markdown

No description provided.

…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 sireko left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Auto approved

@btl-bot
btl-bot merged commit 1245270 into BTLzdravtech:18.0 Sep 10, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants