Tryton - Issues

 

Issue8038

Title Crash when process a purchase from purchase request created from a sale
Priority bug Status resolved
Superseder Nosy List ced, resteve, reviewbot, roundup-bot
Type crash Components sale_supply_drop_shipment
Assigned To ced Keywords review
Reviews 269181002
View: 269181002

Created on 2019-01-24.13:29:24 by resteve, last changed by roundup-bot.

Messages
New changeset a673b81f01c5 by Cédric Krier in branch '5.0':
Do not fail on purchase line not linked to a request
https://hg.tryton.org/modules/sale_supply_drop_shipment/rev/a673b81f01c5

New changeset 192cede982b9 by Cédric Krier in branch '4.8':
Do not fail on purchase line not linked to a request
https://hg.tryton.org/modules/sale_supply_drop_shipment/rev/192cede982b9

New changeset 8fcbe5611649 by Cédric Krier in branch '4.6':
Do not fail on purchase line not linked to a request
https://hg.tryton.org/modules/sale_supply_drop_shipment/rev/8fcbe5611649

New changeset 7b446ec5c8bd by Cédric Krier in branch '4.4':
Do not fail on purchase line not linked to a request
https://hg.tryton.org/modules/sale_supply_drop_shipment/rev/7b446ec5c8bd

New changeset eb0ad875eb7c by Cédric Krier in branch '4.2':
Do not fail on purchase line not linked to a request
https://hg.tryton.org/modules/sale_supply_drop_shipment/rev/eb0ad875eb7c
New changeset 74f0dca1cc54 by Cédric Krier in branch 'default':
Do not fail on purchase line not linked to a request
https://hg.tryton.org/tryton-env/rev/74f0dca1cc54
New changeset 64126fff63cf by Cédric Krier in branch 'default':
Do not fail on purchase line not linked to a request
https://hg.tryton.org/modules/sale_supply_drop_shipment/rev/64126fff63cf
review269181002 updated at https://codereview.tryton.org/269181002/#ps269191002
msg47694 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2019-03-17.10:03:46
This is an unusual workfow as such added line will not be linked to a sale and so not invoices to the customer.
Any way, here is review269181002 which should avoid the crash.
msg46217 (view) Author: [hidden] (resteve) Date: 2019-01-24.13:29:24
Install sale_supply_drop_shipment

Scenario:

1- Create a purchase request from a sale
2- Create a purchase from the purchase request
3- The purchase created from the purchase request, add new line.
4- Process the purchase -> create shipment drop in wait state and crash


Traceback (most recent call last):
  File "/trytond/wsgi.py", line 71, in dispatch_request
    return endpoint(request, **request.view_args)
  File "/trytond/protocols/dispatcher.py", line 41, in rpc
    request, database_name, *request.rpc_params)
  File "/trytond/wsgi.py", line 42, in auth_required
    return wrapped(*args, **kwargs)
  File "/trytond/protocols/wrappers.py", line 122, in wrapper
    return func(request, pool, *args, **kwargs)
  File "/trytond/protocols/dispatcher.py", line 178, in _dispatch
    result = rpc.result(meth(*c_args, **c_kwargs))
  File "/trytond/model/modelview.py", line 644, in wrapper
    return func(cls, records, *args, **kwargs)
  File "/trytond/modules/sale_supply/purchase.py", line 74, in process
    super(Purchase, cls).process(purchases)
  File "/trytond/model/modelview.py", line 644, in wrapper
    return func(cls, records, *args, **kwargs)
  File "/trytond/modules/purchase/purchase.py", line 887, in process
    purchase.create_move('in')
  File "/trytond/modules/sale_supply_drop_shipment/purchase.py", line 164, in create_move
    DropShipment.wait([drop_shipment])
  File "/trytond/model/modelview.py", line 644, in wrapper
    return func(cls, records, *args, **kwargs)
  File "/trytond/model/workflow.py", line 36, in wrapper
    result = func(cls, filtered, *args, **kwargs)
  File "/trytond/modules/sale_supply_drop_shipment/stock.py", line 560, in wait
    sale_line = request2sline[pline2request[move.origin]]
KeyError: Pool().get('purchase.line')(4995)


Debug data:

(Pdb) pline2request
{Pool().get('purchase.line')(4994): Pool().get('purchase.request')(15192)}
(Pdb) move.origin
Pool().get('purchase.line')(4995)
(Pdb) pline2request.get(move.origin)
History
Date User Action Args
2019-03-28 19:57:49roundup-botsetmessages: + msg48105
2019-03-22 18:22:56roundup-botsetmessages: + msg47923
2019-03-22 18:22:48roundup-botsetstatus: testing -> resolved
nosy: + roundup-bot
messages: + msg47922
2019-03-17 10:17:10reviewbotsetnosy: + reviewbot
messages: + msg47695
2019-03-17 10:03:47cedsetstatus: chatting -> testing
keyword: + review
nosy: + ced
messages: + msg47694
reviews: 269181002
assignedto: ced
2019-01-24 13:29:24restevecreate

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