Repository navigation
Fork Sync Branch 18.0 - #15
Merged
Merged
Conversation
_compute_invoice_status() calls super(), which honours order_id.force_invoiced_status, and then recomputes every line without that guard, overwriting it: a line with something left to invoice always ends up as 'to invoice' and one with nothing received as 'no', even when the order was manually set as fully invoiced. Skip the lines of a forced order and keep what super() resolved. Setting the status on an order is the documented way to close it for billing, so this makes the whole feature unreliable on any database with this module installed: the lines keep showing up as pending everywhere they are filtered by invoice_status. Recomputing the field does not help, the compute overwrites the value again. closes #361 Signed-off-by: Luciano Esperlazza <les@adhoc.inc>
Two cases were still wrong in the lines offered by the 'Match purchase lines' button: * Over receipt: when the vendor delivers more than ordered, the line ends up fully ordered but not fully billed (ordered 40, received 41, billed 40). The bill criterion product_qty > qty_invoiced gives False and the quantity left to bill was hidden. Add qty_to_invoice > 0 as a second term, the same criterion the native view uses. The first term is still needed for a confirmed purchase order with no receipt yet, where qty_to_invoice is 0 on products controlled on received quantities. * Forced invoice status: a purchase order set as 'No Bill to Receive' / 'Nothing to Bill' kept offering its lines, because neither the filter nor the native view look at force_invoiced_status. Exclude them, on bills and on credit notes: the user already declared that order as nothing left to bill. Add tests for the bill criterion (no receipt, partial receipt, over receipt, fully billed, forced status) and for the credit note one (pending refund from a return, return already credited). * Orders closed with the 'Set Invoiced' button: the button stamped invoice_status on the order and zeroed qty_to_invoice on the lines, both stored computed fields, so the next recompute undid it and neither the matcher nor the lines ever saw the order as closed for billing. Write force_invoiced_status instead, which is what everything else reads. closes #359 Signed-off-by: Luciano Esperlazza <les@adhoc.inc>
sireko
approved these changes
Sep 3, 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.