Issue 11531

Title
Warehouse should be required on sale when using sale_stock_quantity
Priority
bug
Status
testing
Superseder
Error if warehouse is not set for checking quantities when quoting sale (issue 11799)
Project-Id-Version: Roundup 0.7.0 Report-Msgid-Bugs-To: roundup-devel@lists.sourceforge.net POT-Creation-Date: 2021-07-12 22:10-0400 PO-Revision-Date: 2004-11-20 13:47+0200 Language-Team: English Language: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii
Missing warehouse in grouping when searching sale lines to remove quantities already sold (issue 11802)
Nosy list
ced, mrichez, pokoli, reviewbot, tbruyere
Assigned to
mrichez
Keywords
review

Created on 2022-06-01.09:07:25 by mrichez, last changed 1 month ago by ced.

Messages

Author: [hidden] (ced) Tryton committer Tryton translator
Date: 2022-10-20.11:01:57

Some of the issues have been fixed by issue11799 and issue11802. The remaining part is about using the warehouse computed on the line instead of the sale. This is for me more a behavior improvement (which should not be backported) than a crash because it is about allowing warehouse customization per line.

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-10-20 11:01:57cedsetkeyword: - backport
messages: + msg79215
nosy: + ced
superseder: + Error if warehouse is not set for checking quantities when quoting sale, Missing warehouse in grouping when searching sale lines to remove quantities already sold
type: crash -> behavior
2022-09-13 12:38:01reviewbotsetmessages: + msg78064
2022-09-12 11:43:58reviewbotsetmessages: + msg78032
2022-07-19 15:43:57reviewbotsetmessages: + msg77433
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
2022-06-01 09:50:07pokolisetmessages: + msg76874
2022-06-01 09:39:41mrichezsetstatus: in-progress -> chatting
2022-06-01 09:39:35mrichezsetmessages: + msg76873
2022-06-01 09:35:18mrichezsetmessages: + msg76872
status: need-eg -> in-progress
2022-06-01 09:29:08pokolisetmessages: + msg76871
nosy: + pokoli
status: in-progress -> need-eg
2022-06-01 09:12:17mrichezsetstatus: unread -> in-progress
2022-06-01 09:07:25mrichezcreate