Issue 11217

Title
AttributeError: 'NoneType' object has no attribute 'inventory_moves in when click done in production
Priority
bug
Status
resolved
Nosy list
booraa0a, ced, pokoli, reviewbot, roundup-bot
Assigned to
ced
Keywords
review

Created on 2022-02-04.03:45:59 by booraa0a, last changed 3 weeks ago by roundup-bot.

Messages

New changeset b1d26ec9fc48 by Cédric Krier in branch '6.4':
Check if move has shipment before assigning inventory moves
https://hg.tryton.org/modules/sale_supply/rev/b1d26ec9fc48

New changeset a4d1e02bd780 by Cédric Krier in branch '6.2':
Check if move has shipment before assigning inventory moves
https://hg.tryton.org/modules/sale_supply/rev/a4d1e02bd780

New changeset 86938efe3054 by Cédric Krier in branch '6.0':
Check if move has shipment before assigning inventory moves
https://hg.tryton.org/modules/sale_supply/rev/86938efe3054

New changeset a6a2d87b0ea1 by Cédric Krier in branch '5.0':
Check if move has shipment before assigning inventory moves
https://hg.tryton.org/modules/sale_supply/rev/a6a2d87b0ea1
New changeset e7dca53147be by Cédric Krier in branch 'default':
Check if move has shipment before assigning inventory moves
https://hg.tryton.org/tryton-env/rev/e7dca53147be
New changeset 65c9d5d703c3 by Cédric Krier in branch 'default':
Check if move has shipment before assigning inventory moves
https://hg.tryton.org/modules/sale_supply/rev/65c9d5d703c3
Author: [hidden] (ced) Tryton committer Tryton translator
Date: 2022-08-28.12:28:55

Indeed the sale_supply module was considering that all moves on the sale lines are linked to a shipment. But it is not always the case with for example drop shipment.

Author: [hidden] (booraa0a)
Date: 2022-02-11.16:11:01

I am using only standard modules. I reproduced the same error in the demo6.2 instance.

1- Activate all modules
2- Create product template (Produciable and Salable), go to production tab and select supply on sale
3- Create BOM
4- Create Routing
5- Assign BOM and Routing to the product
6- Create Sales Order with product and confirm the Sales Order
7- Click on Supply Stock Wizard to create production requests automatically.
8- Go to create production request and click on Wait--> then Assign--> then Run --> then Done
9- When you click done, the error will show up.

The error will show only when production request created from sales order.

Author: [hidden] (pokoli) Tryton committer Tryton translator
Date: 2022-02-11.12:06:23

Could you please share some details on how to reproduce it on an empty database?
It seems that you have some code that creates a sale move not linked to any shipment but I do not see how this is possible using standard modules. Did you have some custom code?

Author: [hidden] (booraa0a)
Date: 2022-02-04.03:45:58

I got this error in 6.2 when I click done in production/productions

Traceback (most recent call last):
  File "/usr/local/lib/python39/dist-packages/trytond/wsgipy", line 117, in dispatch_request
    return endpoint(request, **requestview_args)
  File "/usr/local/lib/python39/dist-packages/trytond/protocols/dispatcherpy", line 46, in rpc
    return methodsget(requestrpc_method, _dispatch)(
  File "/usr/local/lib/python39/dist-packages/trytond/wsgipy", line 84, in auth_required
    return wrapped(*args, **kwargs)
  File "/usr/local/lib/python39/dist-packages/trytond/protocols/wrapperspy", line 159, in wrapper
    return func(request, pool, *args, **kwargs)
  File "/usr/local/lib/python39/dist-packages/trytond/protocols/dispatcherpy", line 180, in _dispatch
    result = rpcresult(meth(*c_args, **c_kwargs))
  File "/usr/local/lib/python39/dist-packages/trytond/model/modelviewpy", line 774, in wrapper
    return func(cls, records, *args, **kwargs)
  File "/usr/local/lib/python39/dist-packages/trytond/model/workflowpy", line 37, in wrapper
    result = func(cls, filtered, *args, **kwargs)
  File "/usr/local/lib/python39/dist-packages/trytond/modules/production_work/productionpy", line 135, in done
    super(Production, cls)done(productions)
  File "/usr/local/lib/python39/dist-packages/trytond/model/modelviewpy", line 774, in wrapper
    return func(cls, records, *args, **kwargs)
  File "/usr/local/lib/python39/dist-packages/trytond/model/workflowpy", line 37, in wrapper
    result = func(cls, filtered, *args, **kwargs)
  File "/usr/local/lib/python39/dist-packages/trytond/modules/production_outsourcing/productionpy", line 242, in done
    super(Production, cls)done(productions)
  File "/usr/local/lib/python39/dist-packages/trytond/model/modelviewpy", line 774, in wrapper
    return func(cls, records, *args, **kwargs)
  File "/usr/local/lib/python39/dist-packages/trytond/model/workflowpy", line 37, in wrapper
    result = func(cls, filtered, *args, **kwargs)
  File "/usr/local/lib/python39/dist-packages/trytond/modules/sale_supply_production/productionpy", line 27, in wrapper
    func(cls, productions)
  File "/usr/local/lib/python39/dist-packages/trytond/modules/sale_supply_production/productionpy", line 82, in done
    productionassign_supplied()
  File "/usr/local/lib/python39/dist-packages/trytond/modules/sale_supply_production/productionpy", line 115, in assign_supplied
    sale_lineassign_supplied(pbl[sale_lineproduct], grouping=grouping)
  File "/usr/local/lib/python39/dist-packages/trytond/modules/sale_supply/salepy", line 223, in assign_supplied
    for inv_move in moveshipmentinventory_moves:
AttributeError: 'NoneType' object has no attribute 'inventory_moves'
History
Date User Action Args
2022-09-15 23:28:26roundup-botsetkeyword: - backport
messages: + msg78171
2022-09-08 12:57:04roundup-botsetmessages: + msg77909
2022-09-08 12:56:58roundup-botsetmessages: + msg77908
nosy: + roundup-bot
status: testing -> resolved
2022-08-28 12:47:45reviewbotsetmessages: + msg77814
nosy: + reviewbot
2022-08-28 12:30:22cedsetkeyword: + backport, review
reviews: 427641003
status: in-progress -> testing
2022-08-28 12:28:56cedsetassignedto: ced
component: + sale_supply
messages: + msg77813
nosy: + ced
status: chatting -> in-progress
2022-05-20 14:27:12pokolisetstatus: need-eg -> chatting
2022-02-11 16:11:01booraa0asetmessages: + msg74024
2022-02-11 12:06:23pokolisetcomponent: + sale_supply_production, - production, sale_supply
messages: + msg74013
nosy: + pokoli
status: unread -> need-eg
2022-02-04 03:45:59booraa0acreate