[FIX] purchase_stock_ux: keep the forced invoice status on PO lines - #368
Closed
fw-bot-adhoc wants to merge 1 commit into
Closed
[FIX] purchase_stock_ux: keep the forced invoice status on PO lines#368fw-bot-adhoc wants to merge 1 commit into
fw-bot-adhoc wants to merge 1 commit into
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. X-original-commit: c12cfa8
Contributor
Author
|
@mav-adhoc @les-adhoc cherrypicking of pull request #361 failed. stdout: Either perform the forward-port manually (and push to this branch, proceeding as usual) or close this PR (maybe?).
More info at https://github.com/odoo/odoo/wiki/Mergebot#forward-port |
Contributor
|
Superseded by #362, the port of #361 to 19.0 that was written by hand before this automatic forward-port existed. The conflict is in Closing so the fix does not land twice. #362 carries it with its test. |
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.

purchase_stock_ux._compute_invoice_status()callssuper()— which honoursorder_id.force_invoiced_status— and then recomputes every line without that guard, overwriting the result:So on an order manually set as fully invoiced, a line with something left to invoice ends up as
to invoiceand a line with nothing received asno. The order itself keeps the forced status, only its lines lose it, and recomputing the field does not help because the compute overwrites the value again — there is no data fix, it needs the guard.Setting the invoice status by hand is the documented way to close an order for billing, so the feature of
purchase_uxis unreliable at line level on any database with this module installed: the lines keep showing as pending wherever they are filtered byinvoice_status. On one customer database this accounts for 2,756 lines that readto invoiceon orders that were forced months ago. The code is the same on 16.0, 18.0 and 19.0, so this is not a recent regression.Test plan
test_forced_invoiced_status_on_linesinpurchase_stock_ux/tests/test_purchase_order.py: a confirmed order forced as invoiced keepsinvoicedon its lines. Verified locally on 18.0: 0 failed, 0 errors of 3 tests; without the fix it fails with'no' != 'invoiced'.Same task as #359, different module and defect.
https://www.adhoc.inc/odoo/project.task/72358
Forward-Port-Of: #361