Issue 11531

Title
Warehouse should be required on sale when using sale_stock_quantity
Priority
bug
Status
testing
Nosy list
mrichez, pokoli, reviewbot, tbruyere
Assigned to
mrichez
Keywords
backport, review

Created on 2022-06-01.09:07:25 by mrichez, last changed 7 days ago by reviewbot.

Messages

Author: [hidden] (pokoli) Tryton committer Tryton translator
Date: 2022-06-01.09:50:07

No, we should skip the quantity check if no warehouse is set.

Author: [hidden] (mrichez)
Date: 2022-06-01.09:39:35

_check_stock_quantity is called before the super() (https://hg.tryton.org/modules/sale_stock_quantity/file/tip/sale.py#l24)

So the check for warehouse is done after...

Should add a 'required' in warehouse field states based on the state ?

Author: [hidden] (mrichez)
Date: 2022-06-01.09:35:18

Probably my tracelog is related to some custom code but...

I just try now on the 6.4 demo online and i get the same error:

Warning:

Traceback (most recent call last):
File "/usr/local/lib/python39/dist-packages/trytond/wsgipy", line 119, 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 86, in auth_required
return wrapped(*args,
kwargs)
File "/usr/local/lib/python39/dist-packages/trytond/protocols/wrapperspy", line 161, in wrapper
return func(request, pool, args, kwargs)
File "/usr/local/lib/python39/dist-packages/trytond/protocols/dispatcherpy", line 181, in _dispatch
result = rpcresult(meth(
c_args, c_kwargs))
File "/usr/local/lib/python39/dist-packages/trytond/model/modelviewpy", line 707, 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_stock_quantity/salepy", line 24, in quote
cls_check_stock_quantity(sales)
File "/usr/local/lib/python39/dist-packages/trytond/modules/sale_stock_quantity/salepy", line 38, in _check_stock_quantity
salecheck_stock_quantity()
File "/usr/local/lib/python39/dist-packages/trytond/modules/sale_stock_quantity/salepy", line 133, in check_stock_quantity
locations=[selfwarehouseid],
AttributeError: 'NoneType' object has no attribute 'id'

Author: [hidden] (pokoli) Tryton committer Tryton translator
Date: 2022-06-01.09:29:08

We have a check that ensures that the warehouse is set when quoting a sale. That should prevent the error.

Also your traceback seems related to some custom code. Is the issue related to it?

Author: [hidden] (mrichez)
Date: 2022-06-01.09:07:23

When using multiple warehouses, there's no default warehouse set by default on sale.

Module sale_stock_quantity is checking stock quantity when quoting sale. But to check stock_quantity, warehouse should be required otherwise we get this error:

Traceback (most recent call last):
File "/trytond/wsgi.py", line 119, in dispatch_request
return endpoint(request, request.view_args)
File "/trytond/protocols/dispatcher.py", line 47, in rpc
request, database_name, request.rpc_params)
File "/trytond/wsgi.py", line 86, in auth_required
return wrapped(
args,
kwargs)
File "/trytond/protocols/wrappers.py", line 161, in wrapper
return func(request, pool, args, kwargs)
File "/trytond/protocols/dispatcher.py", line 181, in _dispatch
result = rpc.result(meth(
c_args, c_kwargs))
File "/trytond/model/modelview.py", line 707, in wrapper
return func(cls, records, *args,
kwargs)
File "/trytond/model/workflow.py", line 37, in wrapper
result = func(cls, filtered, args, *kwargs)
File "/sale/sale.py", line 172, in quote
sale.create_planned_move()
File "/sale/sale.py", line 148, in create_planned_move
move.from_location = self.warehouse.storage_location
AttributeError: 'NoneType' object has no attribute 'storage_location'

Fault: 'NoneType' object has no attribute 'storage_location'

History
Date User Action Args
2022-06-22 13:11:02reviewbotsetmessages: + msg77208
2022-06-20 12:02:39reviewbotsetmessages: + msg77135
2022-06-08 09:52:49reviewbotsetmessages: + msg77013
2022-06-07 23:29:37cedsetkeyword: + backport
2022-06-07 13:22:50reviewbotsetmessages: + msg76982
2022-06-02 10:04:25reviewbotsetmessages: + msg76899
2022-06-01 11:54:07reviewbotsetmessages: + msg76882
2022-06-01 10:55:59reviewbotsetmessages: + msg76875
nosy: + reviewbot
2022-06-01 10:43:34mrichezsetkeyword: + review
reviews: 419231003
status: in-progress -> testing
2022-06-01 10:40:54mrichezsetstatus: chatting -> in-progress

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