[FIX] purchase_ux: complete the pending criterion in purchase matching - #360
Closed
mav-adhoc wants to merge 1 commit into
Closed
[FIX] purchase_ux: complete the pending criterion in purchase matching#360mav-adhoc wants to merge 1 commit into
mav-adhoc wants to merge 1 commit into
Conversation
Contributor
mav-adhoc
force-pushed
the
19.0-t-72358-mav
branch
from
August 12, 2026 20:01
4a4daee to
c4b6f1e
Compare
mav-adhoc
force-pushed
the
19.0-t-72358-mav
branch
2 times, most recently
from
August 18, 2026 17:44
562c945 to
0ee451b
Compare
mav-adhoc
force-pushed
the
19.0-t-72358-mav
branch
from
September 1, 2026 13:36
0ee451b to
8f927fc
Compare
Contributor
|
@roboadhoc r+ bump |
roboadhoc
pushed a commit
that referenced
this pull request
Sep 2, 2026
The lines offered by the 'Match purchase lines' button still hide one case, and the button that closes an order for billing did not stick. * Over receipt on bills: when the vendor delivers more than ordered the line ends up fully ordered but not fully billed (ordered 40, received 41, billed 40), 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. * Orders set as 'Nothing to Bill': the matching view already excludes orders forced as 'No Bill to Receive', but not the other forced status, even though both mean the order is closed for billing. Exclude any forced invoice status. * 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. Its domain in the form also never matched on 19.0, where purchase orders no longer have the 'done' state, so the button was unreachable: use locked. Add tests for the bill criterion (no receipt, partial receipt, over receipt, fully billed, forced status), for the credit note one merged in with the per document type criterion (pending refund from a return, return already credited) and for the button. closes #360 Signed-off-by: Luciano Esperlazza <les@adhoc.inc>
roboadhoc
pushed a commit
that referenced
this pull request
Sep 2, 2026
The lines offered by the 'Match purchase lines' button still hide one case, and the button that closes an order for billing did not stick. * Over receipt on bills: when the vendor delivers more than ordered the line ends up fully ordered but not fully billed (ordered 40, received 41, billed 40), 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. * Orders set as 'Nothing to Bill': the matching view already excludes orders forced as 'No Bill to Receive', but not the other forced status, even though both mean the order is closed for billing. Exclude any forced invoice status. * 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. Its domain in the form also never matched on 19.0, where purchase orders no longer have the 'done' state, so the button was unreachable: use locked. Add tests for the bill criterion (no receipt, partial receipt, over receipt, fully billed, forced status), for the credit note one merged in with the per document type criterion (pending refund from a return, return already credited) and for the button. closes #360 Signed-off-by: Luciano Esperlazza <les@adhoc.inc>
les-adhoc
force-pushed
the
19.0-t-72358-mav
branch
from
September 2, 2026 14:29
8f927fc to
6d521b4
Compare
roboadhoc
pushed a commit
that referenced
this pull request
Sep 2, 2026
The lines offered by the 'Match purchase lines' button still hide one case, and the button that closes an order for billing did not stick. * Over receipt on bills: when the vendor delivers more than ordered the line ends up fully ordered but not fully billed (ordered 40, received 41, billed 40), 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. * Orders set as 'Nothing to Bill': the matching view already excludes orders forced as 'No Bill to Receive', but not the other forced status, even though both mean the order is closed for billing. Exclude any forced invoice status. * 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. Its domain in the form also never matched on 19.0, where purchase orders no longer have the 'done' state, so the button was unreachable: use locked. Add tests for the bill criterion (no receipt, partial receipt, over receipt, fully billed, forced status), for the credit note one merged in with the per document type criterion (pending refund from a return, return already credited) and for the button. closes #360 Signed-off-by: Luciano Esperlazza <les@adhoc.inc>
mav-adhoc
force-pushed
the
19.0-t-72358-mav
branch
from
September 2, 2026 15:31
6d521b4 to
68f2016
Compare
mav-adhoc
force-pushed
the
19.0-t-72358-mav
branch
2 times, most recently
from
September 2, 2026 16:31
8c6bfa4 to
9578b86
Compare
The lines offered by the 'Match purchase lines' button still hide one case, and the button that closes an order for billing did not stick. * Over receipt on bills: when the vendor delivers more than ordered the line ends up fully ordered but not fully billed (ordered 40, received 41, billed 40), 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. * Orders set as 'Nothing to Bill': the matching view already excludes orders forced as 'No Bill to Receive', but not the other forced status, even though both mean the order is closed for billing. Exclude any forced invoice status. * 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. Its domain in the form also never matched on 19.0, where purchase orders no longer have the 'done' state, so the button was unreachable: use locked. Add tests for the bill criterion (no receipt, partial receipt, over receipt, fully billed, forced status), for the credit note one merged in with the per document type criterion (pending refund from a return, return already credited) and for the button.
mav-adhoc
force-pushed
the
19.0-t-72358-mav
branch
from
September 2, 2026 16:44
9578b86 to
381d607
Compare
Contributor
Author
|
@roboadhoc retry |
Contributor
|
@mav-adhoc retry makes no sense when the PR is not in error. |
Contributor
|
@roboadhoc check |
Contributor
|
Updated message. No update to pr head. |
Contributor
Author
|
@jcadhoc se hace el loco roboadhoc |
Contributor
|
@roboadhoc r+ bump |
roboadhoc
pushed a commit
that referenced
this pull request
Sep 2, 2026
The lines offered by the 'Match purchase lines' button still hide one case, and the button that closes an order for billing did not stick. * Over receipt on bills: when the vendor delivers more than ordered the line ends up fully ordered but not fully billed (ordered 40, received 41, billed 40), 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. * Orders set as 'Nothing to Bill': the matching view already excludes orders forced as 'No Bill to Receive', but not the other forced status, even though both mean the order is closed for billing. Exclude any forced invoice status. * 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. Its domain in the form also never matched on 19.0, where purchase orders no longer have the 'done' state, so the button was unreachable: use locked. Add tests for the bill criterion (no receipt, partial receipt, over receipt, fully billed, forced status), for the credit note one merged in with the per document type criterion (pending refund from a return, return already credited) and for the button. closes #360 Signed-off-by: Juan Carreras <jc@adhoc.com.ar>
roboadhoc
added a commit
that referenced
this pull request
Sep 2, 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.

Port of #359 to 19.0. Rebased on 19.0 after #354 was merged, which brought the per document type criterion this branch was missing, so that part is no longer in the diff — only its tests are kept, see 1. What is left are three defects that 19.0 still has.
1. Credit notes (#351, #353, #354) — already merged, tests only
product_qtydoes not drop with a return, so a line that is already fully billed but has a pending credit (qty_to_invoice < 0) was hidden from the matcher of a credit note. Fixed on this branch by #354 (bed8052); this PR only adds the two regression tests it never got.2. Over receipt on bills (#359)
When the vendor delivers more than ordered, the line ends up ordered = billed but received > billed, so there is a legitimate quantity left to bill and the line disappeared from the matcher (ordered 40, received 41, billed 40 → 1 pending). Fixed by adding
qty_to_invoice > 0as a second term to thein_invoicecriterion, the same one the native view uses (purchase/models/purchase_bill_line_match.py,_select_po_line()). The first term is still needed: on products controlled on received quantitiesqty_to_invoiceisqty_received - qty_invoiced, so a confirmed purchase order with no receipt yet gives 0 and every line would be hidden — that is exactly the regression #354 fixed, so both terms have to stay.3. Orders set as Nothing to Bill
The view already excludes orders forced as No Bill to Receive, but not the other value of
force_invoiced_status, even though both mean the order is closed for billing. The exclusion now covers any forced status. Unlike #359, this branch does not need it in the action: the filter lives in the view, which is the better place, so the action only carries the quantity criterion.4. Orders closed with the Set Invoiced button
button_set_invoiced()stampedinvoice_statuson the order and zeroedqty_to_invoiceon its lines. Both are stored computed fields, so the next recompute undid it. Verified on 19.0: right after pressing the button the order reads Nothing to Bill instead of No Bill to Receive, and any later recompute — writing on a line is enough — brings it back to Waiting Bills with the full quantity pending. Neither the matcher nor the line status ever treated those orders as closed, since both readforce_invoiced_status, which the button never set. It now writes that field, which is durable and is what the rest of the module reads.Its
invisibledomain never matched on this branch either: purchase orders no longer have thedonestate on 19.0 (it is thelockedboolean now), so the button was unreachable in the form. It is gated onlockednow.Test plan
purchase_ux/tests/test_purchase_matching.py, 8 cases. Bill criterion: confirmed order with no receipt (offered), partial receipt not billed (offered), over receipt 40/41/40 (offered), fully received and billed (not offered), forced invoice status, both values (not offered). Set Invoiced button: order closed, matcher does not offer its lines, and a later change of the received quantity does not bring it back. Credit note criterion: pending refund from a return 600/500/600 (offered), return already credited 600/500/500 (not offered).Verified locally on 19.0 over the rebased branch: 0 failed, 0 errors of 12 tests. Reverting
purchase_ux/models/andpurchase_ux/views/to 19.0 fails exactly the three that cover what is left in the diff —test_bill_over_receipt,test_bill_set_invoiced_buttonand the'no'subtest oftest_bill_forced_invoiced_status— and leaves the rest green, the two credit note ones included, since that criterion is already in the branch.Known limitation, out of scope
A line returned and already credited (ordered 150, net billed 0) still shows as 150 pending on bills. It happens with the previous criterion and with the native one too; whether it is tolerated is a product decision.
Note for the merge: this touches a view, so it needs
bump, notnobump. The line level status of those orders only becomes correct together with #362.https://www.adhoc.inc/odoo/project.task/72358