Tryton - Issues

 

Issue9032

Title Empty stock moves in account invoice lines when Handle Invoice Exception
Priority bug Status resolved
Superseder Nosy List ced, pokoli, resteve, reviewbot, roundup-bot
Type behavior Components account_invoice_stock
Assigned To ced Keywords review
Reviews 260911002,258971002
View: 260911002, 258971002

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

Messages
New changeset f13c08053541 by Cédric Krier in branch 'default':
Skip canceled move and invoice when computing quantity
https://hg.tryton.org/tryton-env/rev/f13c08053541
New changeset 4539f4758d35 by Cédric Krier in branch 'default':
Skip canceled move and invoice when computing quantity
https://hg.tryton.org/modules/account_invoice_stock/rev/4539f4758d35
review258971002 updated at https://codereview.tryton.org/258971002/#ps293251002
msg56265 (view) 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.
msg55202 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2020-02-04.13:47:50
Also the same issue exists for moved_quantity.
msg55201 (view) 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.
review260911002 updated at https://codereview.tryton.org/260911002/#ps268841002
msg55198 (view) 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)
msg55197 (view) 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.
msg55185 (view) 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.
msg55183 (view) 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:

https://hg.tryton.org/modules/sale/file/702bf7fc4e03/tests/scenario_sale.rst#l251
msg55182 (view) Author: [hidden] (resteve) Date: 2020-02-03.14:21:51
IMHO create a new scenario tests in account_invoice_stock is new task.
msg55181 (view) 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.
review254971002 updated at https://codereview.tryton.org/254971002/#ps276831002
msg55179 (view) Author: [hidden] (resteve) Date: 2020-02-03.12:54:20
Scenario:

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')
>>> 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
(Pool().get('stock.move')(3),)
>>> inv_line2.stock_moves
()
History
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
2020-02-03 15:21:24cedsetnosy: + ced
messages: + msg55185
2020-02-03 14:33:02pokolisetmessages: + msg55183
2020-02-03 14:21:52restevesetmessages: + msg55182
2020-02-03 13:56:54pokolisetstatus: chatting -> in-progress
type: feature request -> behavior
messages: + msg55181
nosy: + pokoli
2020-02-03 13:54:00reviewbotsetnosy: + reviewbot
messages: + msg55180
2020-02-03 13:50:33restevesetreviews: 254971002
keyword: + review
2020-02-03 13:34:11restevesetcomponent: + account_invoice_stock, - sale
2020-02-03 12:54:21restevecreate