Tryton - Issues

 

Issue8118

Title fails to split a stock.shipment.internal record
Priority bug Status resolved
Superseder Nosy List oqueralto, pokoli, roundup-bot
Type crash Components stock, stock_split
Assigned To oqueralto Keywords easy, review
Reviews 74461002
View: 74461002

Created on 2019-02-15.11:07:18 by oqueralto, last changed by roundup-bot.

Messages
New changeset e61abccf6136 by Òscar Queraltó in branch '5.0':
Call the copy method with a list of instances instead of ids
https://hg.tryton.org/modules/stock_split/rev/e61abccf6136

New changeset ebb7a431928a by Òscar Queraltó in branch '4.8':
Call the copy method with a list of instances instead of ids
https://hg.tryton.org/modules/stock_split/rev/ebb7a431928a

New changeset 4d3c88697079 by Òscar Queraltó in branch '4.6':
Call the copy method with a list of instances instead of ids
https://hg.tryton.org/modules/stock_split/rev/4d3c88697079
msg47372 (view) Author: [hidden] (oqueralto) Date: 2019-03-04.10:16:25
As Sergi said, it should be backported to supported versions.
New changeset f740c0545dd3 by Cédric Krier in branch 'default':
Call the copy method with a list of instances instead of ids
https://hg.tryton.org/tryton-env/rev/f740c0545dd3
New changeset 45fe4b3d9e2a by Òscar Queraltó in branch 'default':
Call the copy method with a list of instances instead of ids
https://hg.tryton.org/modules/stock_split/rev/45fe4b3d9e2a
msg47184 (view) Author: [hidden] (oqueralto) Date: 2019-02-25.10:28:43
Should I do something else or just wait for a core developer who publish it?
msg47107 (view) Author: [hidden] (oqueralto) Date: 2019-02-19.07:24:10
Here is the review https://codereview.tryton.org/74461002/ that fixes it.
msg47056 (view) Author: [hidden] (pokoli) (Tryton committer) Date: 2019-02-15.12:27:19
Great but please provide a patch that applies to trunk version and it will be backported to supported versions after including them to trunk
msg47055 (view) Author: [hidden] (oqueralto) Date: 2019-02-15.12:15:04
I'm using the 4.8 version, but I think that in 5.0 branch it's getting the same error because of line 2124 (id2shipments = {s.id: s for s in shipments}) assuming that the 'shipments' variable is still an ids list so anyway, I'm going to provide a patch to fix it.
msg47054 (view) Author: [hidden] (pokoli) (Tryton committer) Date: 2019-02-15.11:29:47
Which version are you using? Probably it does not affect 5.0 nor trunk because of changeset 571dfcf9f399

But I agree that copy should be called with the shipment instance instead of its id. Could you provide a patch following http://www.tryton.org/develop ?
msg47053 (view) Author: [hidden] (oqueralto) Date: 2019-02-15.11:07:17
It happens because the 'transaction_split' function in the model 'stock.shipment.split' is calling the 'copy' method with a list of ids as argument instead a list of objects and the definition of the 'copy' method for the model 'stock.shipment.internal' in the 'stock' module is trying to get the fields information from the id.


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 167, in _dispatch
    result = rpc.result(meth(*c_args, **c_kwargs))
  File "/trytond/wizard/wizard.py", line 287, in execute
    return wizard._execute(state_name)
  File "/trytond/wizard/wizard.py", line 318, in _execute
    result = self._execute(transition())
  File "/trytond/modules/stock_split/stock.py", line 221, in transition_split
    shipment, = Shipment.copy([shipment.id], default={'moves': None})
  File "/trytond/modules/stock/shipment.py", line 2333, in copy
    Move.copy(shipment.outgoing_moves, default={
AttributeError: 'int' object has no attribute 'outgoing_moves'
History
Date User Action Args
2019-03-07 00:06:03roundup-botsetmessages: + msg47454
2019-03-04 10:17:59cedsetstatus: chatting -> resolved
2019-03-04 10:16:26oqueraltosetstatus: resolved -> chatting
messages: + msg47372
2019-02-25 19:31:11roundup-botsetmessages: + msg47196
2019-02-25 19:31:02roundup-botsetstatus: in-progress -> resolved
nosy: + roundup-bot
messages: + msg47193
2019-02-25 10:28:43oqueraltosetmessages: + msg47184
2019-02-19 07:24:11oqueraltosetreviews: 74461002
messages: + msg47107
keyword: + review
2019-02-15 12:27:19pokolisetmessages: + msg47056
2019-02-15 12:15:04oqueraltosetstatus: chatting -> in-progress
assignedto: oqueralto
messages: + msg47055
2019-02-15 11:29:47pokolisetstatus: unread -> chatting
nosy: + pokoli
messages: + msg47054
keyword: + easy
2019-02-15 11:07:18oqueraltocreate