Tryton - Issues

 

Issue6234

Title Handling shipment exception on Purchase Order results in KeyError
Priority bug Status resolved
Superseder Nosy List ced, pokoli, reviewbot, riteshshrv, roundup-bot
Type crash Components sale_supply_drop_shipment
Assigned To ced Keywords review
Reviews 28021002, 33861003, 33121002
View: 28021002, 33861003, 33121002

Created on 2017-02-02.11:16:13 by riteshshrv, last changed by roundup-bot.

Messages
New changeset 0d3fdcad3a3c by C?dric Krier in branch '4.0':
Handle shipment exception also for lines not linked to request nor sale line
http://hg.tryton.org/modules/sale_supply_drop_shipment/rev/0d3fdcad3a3c

New changeset 1e69bca47c90 by C?dric Krier in branch '3.8':
Handle shipment exception also for lines not linked to request nor sale line
http://hg.tryton.org/modules/sale_supply_drop_shipment/rev/1e69bca47c90
New changeset a002b57de59e by C?dric Krier in branch '4.2':
Handle shipment exception also for lines not linked to request nor sale line
http://hg.tryton.org/modules/sale_supply_drop_shipment/rev/a002b57de59e
New changeset 92cf1ea15a1b by C?dric Krier in branch 'default':
Use One2Many fields instead of complex search to handle shipment exception
http://hg.tryton.org/modules/sale_supply_drop_shipment/rev/92cf1ea15a1b
New changeset e2fc1d205c8d by C?dric Krier in branch 'default':
Add sale_lines on request to avoid complicated search
http://hg.tryton.org/modules/sale_supply/rev/e2fc1d205c8d
New review33121002 at https://codereview.tryton.org/33121002/#ps1
New review33861003 at https://codereview.tryton.org/33861003/#ps1
New review28021002 at https://codereview.tryton.org/28021002/#ps1
msg32092 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2017-02-21.10:43:55
And here is review33121002 and review33861003 which simplify the code.
msg32091 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2017-02-21.10:40:39
Here is review28021002 for 4.2
msg31732 (view) Author: [hidden] (pokoli) (Tryton committer) Date: 2017-02-06.17:25:42
Indeed this code seems to fix it:

https://github.com/fulfilio/sale_supply_drop_shipment/commit/731c4d2dd0ee81478d80758d1ce59e9016d4c76a

If you want to contribute it to tryton you must follow the procedure described in: 

http://www.tryton.org/how-to-contribute.html
msg31673 (view) Author: [hidden] (riteshshrv) Date: 2017-02-02.12:08:00
56618 123145573666816 [2017-02-02 11:07:30,781] INFO trytond.protocols.dispatcher <class 'trytond.pool.purchase.handle.shipment.exception'>.execute(*(34, {u'ask': {u'recreate_moves': [], u'id': -66, u'domain_moves': [13]}}, u'handle', {u'date_format': u'%x', u'language': None, u'active_model': u'purchase.purchase', u'language_direction': u'ltr', u'company.rec_name': u'Tryton Inc.', u'groups': [5, 6, 1, 3, 4, 2, 11, 10, 14, 12, 13, 8, 7, 9], u'action_id': 175, u'employee': None, u'active_ids': [2], u'company': 1, u'active_id': 2}), **{}) from admin@127.0.0.1//tryton/
56618 123145573666816 [2017-02-02 11:07:30,931] ERROR trytond.protocols.dispatcher <class 'trytond.pool.purchase.handle.shipment.exception'>.execute(*(34, {u'ask': {u'recreate_moves': [], u'id': -66, u'domain_moves': [13]}}, u'handle', {u'date_format': u'%x', u'language': None, u'active_model': u'purchase.purchase', u'language_direction': u'ltr', u'company.rec_name': u'Tryton Inc.', u'groups': [5, 6, 1, 3, 4, 2, 11, 10, 14, 12, 13, 8, 7, 9], u'action_id': 175, u'employee': None, u'active_ids': [2], u'company': 1, u'active_id': 2}), **{}) from admin@127.0.0.1//tryton/
Traceback (most recent call last):
  File "/Users/ritesh/.virtualenvs/tryton/lib/python2.7/site-packages/trytond-4.0.6-py2.7.egg/trytond/protocols/dispatcher.py", line 201, in _dispatch
    result = rpc.result(meth(*c_args, **c_kwargs))
  File "/Users/ritesh/.virtualenvs/tryton/lib/python2.7/site-packages/trytond-4.0.6-py2.7.egg/trytond/wizard/wizard.py", line 275, in execute
    return wizard._execute(state_name)
  File "/Users/ritesh/.virtualenvs/tryton/lib/python2.7/site-packages/trytond-4.0.6-py2.7.egg/trytond/wizard/wizard.py", line 306, in _execute
    result = self._execute(transition())
  File "/Users/ritesh/.virtualenvs/tryton/lib/python2.7/site-packages/trytond_sale_supply_drop_shipment-4.0.3-py2.7.egg/trytond/modules/sale_supply_drop_shipment/purchase.py", line 210, in transition_handle
    sale_line = request2sline[pline2request[line]]
KeyError: Pool().get('purchase.line')(2)
msg31666 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2017-02-02.11:53:40
Please provide the full traceback.
msg31664 (view) Author: [hidden] (riteshshrv) Date: 2017-02-02.11:22:06
On steps to reproduce, there's one more point to consider: After the supplier shipment is marked as "Done" for partial quantity we need to cancel the move with remaining quantity. (this step goes in between step-5 and step-6)
msg31663 (view) Author: [hidden] (riteshshrv) Date: 2017-02-02.11:16:12
When trying to use "HandleShipmentException" wizard on Purchase, the "transition_handle" method results in KeyError.
How to reproduce:
1. Create a Purchase Order (with one purchase line to follow)
2. Process the purchase order
3. Create a ShipmentIn with moves created by purchase order
4. Receive the shipment partially (Important: Do not receive the entire quantity of purchase order line)
5. Mark the shipment as "done"
6. Now, the "shipment_state" on Purchase Order will be "exception".
7. Goto HandleShipmentException Wizard and do not select any moves to recreate (this step is important).
8. Clicking "Ok" on the wizard will result in KeyError

Crashes at: https://github.com/tryton/sale_supply_drop_shipment/blob/develop/purchase.py#L210
History
Date User Action Args
2017-02-25 19:19:49roundup-botsetmessages: + msg32209
2017-02-25 18:46:57roundup-botsetmessages: + msg32200
2017-02-25 18:44:52roundup-botsetmessages: + msg32199
2017-02-25 18:44:05roundup-botsetstatus: testing -> resolved
nosy: + roundup-bot
messages: + msg32198
2017-02-21 11:00:16reviewbotsetmessages: + msg32095
2017-02-21 11:00:15reviewbotsetreviews: 28021002, 33861003 -> 28021002, 33861003, 33121002
2017-02-21 11:00:14reviewbotsetmessages: + msg32094
2017-02-21 11:00:13reviewbotsetreviews: 28021002 -> 28021002, 33861003
2017-02-21 11:00:10reviewbotsetnosy: + reviewbot
messages: + msg32093
2017-02-21 11:00:09reviewbotsetreviews: 28021002
keyword: + review

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