Issue 9032

Empty stock moves in account invoice lines when Handle Invoice Exception
Nosy list
ced, pokoli, resteve, reviewbot, roundup-bot
Assigned to

Created on 2020-02-03.12:54:21 by resteve, last changed 18 months ago by roundup-bot.


New changeset f13c08053541 by Cédric Krier in branch 'default':
Skip canceled move and invoice when computing quantity
New changeset 4539f4758d35 by Cédric Krier in branch 'default':
Skip canceled move and invoice when computing quantity
Author: [hidden] (ced) Tryton committer Tryton translator
Date: 2020-03-14.17:16:26
Here is review258971002 which fixes both cases.
I decided to not include test scenario because:

* the module is a glue module and testing can not be done without extra modules
* the properties are already tested in purchase and sale scenario
* handling exception should be tested in purchase and sale module and not in account_invoice_stock.

I followed the state test instead of unlink because it will make triggering re-computation for issue7280 more complex indeed.
Author: [hidden] (ced) Tryton committer Tryton translator
Date: 2020-02-04.13:47:50
Also the same issue exists for moved_quantity.
Author: [hidden] (ced) Tryton committer Tryton translator
Date: 2020-02-04.13:29:36
For me, it is not a good design and it is killing performance as the state of the linked invoice needs to be read.
Also it will make implementation of issue7280 much more complicated.
And finally, it is logical to link existing moves with there real invoice only.
Author: [hidden] (resteve)
Date: 2020-02-04.13:04:23
@msg55197 users like to know stock moves (shipments) from invoice lines (ex, show invoice lines grouped by shipment in a report)
Author: [hidden] (ced) Tryton committer Tryton translator
Date: 2020-02-04.11:05:48
Indeed I'm wondering if it will not be better to remove the link between invoice line and stock move when the invoice is canceled or the move.
Author: [hidden] (ced) Tryton committer Tryton translator
Date: 2020-02-03.15:21:24
Please do not extend existing scenario and particularly not the scenario_sale. It is already too long and too difficult to manage.
This fix needs a test to ensure correctness and completeness.
Author: [hidden] (pokoli) Tryton committer Tryton translator
Date: 2020-02-03.14:33:01
You can extend reuse the sale scenario to check the funciontality. For example here:
Author: [hidden] (resteve)
Date: 2020-02-03.14:21:51
IMHO create a new scenario tests in account_invoice_stock is new task.
Author: [hidden] (pokoli) Tryton committer Tryton translator
Date: 2020-02-03.13:56:53
Could you add a test to ensure the behaviour stays?

P.S: If you plan to work on the issue please assign it to yourself and set the proper state.
Author: [hidden] (resteve)
Date: 2020-02-03.12:54:20

1- Create a sale. Invoice order: Shipment. Process
2- Done shipment.
3- Cancel invoice.

Now return the sale, and Handle Invoice Exception.: create new invoice lines without stock moves (empty relate invoice lines to stock moves).

Example data stored:

>>> Sale = pool.get('')
>>> sale = Sale(2)
>>> for line in sale.lines: line.invoice_lines
(Pool().get('account.invoice.line')(4), Pool().get('account.invoice.line')(5))
>>> line, = sale.lines
>>> inv_line1, inv_line2 = line.invoice_lines
>>> inv_line1.stock_moves
>>> inv_line2.stock_moves
Date User Action Args
2020-03-26 00:11:48roundup-botsetmessages: + msg56657
2020-03-26 00:11:36roundup-botsetstatus: testing -> resolved
nosy: + roundup-bot
messages: + msg56656
2020-03-14 17:21:14reviewbotsetmessages: + msg56266
2020-03-14 17:16:27cedsetstatus: in-progress -> testing
reviews: 260911002 -> 260911002,258971002
messages: + msg56265
assignedto: resteve -> ced
2020-02-04 13:47:51cedsetmessages: + msg55202
2020-02-04 13:29:37cedsetmessages: + msg55201
2020-02-04 13:22:08reviewbotsetmessages: + msg55199
2020-02-04 13:13:06restevesetassignedto: resteve
2020-02-04 13:04:23restevesetreviews: 254971002 -> 260911002
messages: + msg55198
2020-02-04 11:05:48cedsetmessages: + msg55197

Showing 10 items. Show all history (warning: this could be VERY long)