Issue 11120

Title
Fault: can't adapt type 'stock.location' error when using cost per warehouse in product configuration
Priority
bug
Status
resolved
Nosy list
booraa0a, ced, reviewbot, roundup-bot
Assigned to
ced
Keywords
review

Created on 2022-01-05.19:38:33 by booraa0a, last changed 5 days ago by ced.

Messages

New changeset 6932fea883cb by Cédric Krier in branch 'default':
Use warehouse id instead of instance in SQL clause
https://hg.tryton.org/tryton-env/rev/6932fea883cb
New changeset 9a04d26c5d1b by Cédric Krier in branch 'default':
Use warehouse id instead of instance in SQL clause
https://hg.tryton.org/modules/product_cost_warehouse/rev/9a04d26c5d1b
Author: [hidden] (booraa0a)
Date: 2022-01-06.14:30:33

it is resolved. Thanks.

However, when I viewed a products by location report for a warehouse (different than set in user preferences), the costs are still based on warehouse set in the user preferences not the subject warehouse, which might be misleading.

Author: [hidden] (ced) Tryton committer Tryton translator
Date: 2022-01-05.21:32:34

It should be fixed by review377941008.

Author: [hidden] (booraa0a)
Date: 2022-01-05.19:40:22

The error relates to Tryton 6.2

Author: [hidden] (booraa0a)
Date: 2022-01-05.19:38:33

I am getting the below error when I run report products by location for a warehouse. The below error shows only when cost per warehouse is activated in product configuration.

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/modelsqlpy", line 891, in read
    getter_results = fieldget(
  File "/usr/local/lib/python39/dist-packages/trytond/model/fields/functionpy", line 105, in get
    return dict((name, call(name)) for name in names)
  File "/usr/local/lib/python39/dist-packages/trytond/model/fields/functionpy", line 105, in <genexpr>
    return dict((name, call(name)) for name in names)
  File "/usr/local/lib/python39/dist-packages/trytond/model/fields/functionpy", line 100, in call
    return dict((rid, method(r, name)) for r in records)
  File "/usr/local/lib/python39/dist-packages/trytond/model/fields/functionpy", line 100, in <genexpr>
    return dict((rid, method(r, name)) for r in records)
  File "/usr/local/lib/python39/dist-packages/trytond/modules/stock/locationpy", line 799, in get_product
    value = getattr(selfproduct, name)
  File "/usr/local/lib/python39/dist-packages/trytond/model/fields/functionpy", line 129, in __get__
    return super()__get__(inst, cls)
  File "/usr/local/lib/python39/dist-packages/trytond/model/fields/fieldpy", line 342, in __get__
    return inst__getattr__(selfname)
  File "/usr/local/lib/python39/dist-packages/trytond/model/modelstoragepy", line 1697, in __getattr__
    read_data = selfread(list(indexkeys()), list(ffieldskeys()))
  File "/usr/local/lib/python39/dist-packages/trytond/model/modelsqlpy", line 891, in read
    getter_results = fieldget(
  File "/usr/local/lib/python39/dist-packages/trytond/model/fields/functionpy", line 105, in get
    return dict((name, call(name)) for name in names)
  File "/usr/local/lib/python39/dist-packages/trytond/model/fields/functionpy", line 105, in <genexpr>
    return dict((name, call(name)) for name in names)
  File "/usr/local/lib/python39/dist-packages/trytond/model/fields/functionpy", line 98, in call
    return method(records, name)
  File "/usr/local/lib/python39/dist-packages/trytond/modules/stock/productpy", line 173, in get_cost_value
    if productcost_price is not None:
  File "/usr/local/lib/python39/dist-packages/trytond/model/fields/functionpy", line 129, in __get__
    return super()__get__(inst, cls)
  File "/usr/local/lib/python39/dist-packages/trytond/model/fields/fieldpy", line 342, in __get__
    return inst__getattr__(selfname)
  File "/usr/local/lib/python39/dist-packages/trytond/model/modelstoragepy", line 1697, in __getattr__
    read_data = selfread(list(indexkeys()), list(ffieldskeys()))
  File "/usr/local/lib/python39/dist-packages/trytond/model/modelsqlpy", line 891, in read
    getter_results = fieldget(
  File "/usr/local/lib/python39/dist-packages/trytond/model/fields/functionpy", line 105, in get
    return dict((name, call(name)) for name in names)
  File "/usr/local/lib/python39/dist-packages/trytond/model/fields/functionpy", line 105, in <genexpr>
    return dict((name, call(name)) for name in names)
  File "/usr/local/lib/python39/dist-packages/trytond/model/fields/functionpy", line 100, in call
    return dict((rid, method(r, name)) for r in records)
  File "/usr/local/lib/python39/dist-packages/trytond/model/fields/functionpy", line 100, in <genexpr>
    return dict((rid, method(r, name)) for r in records)
  File "/usr/local/lib/python39/dist-packages/trytond/model/multivaluepy", line 57, in _multivalue_getter
    value = selfget_multivalue(name)
  File "/usr/local/lib/python39/dist-packages/trytond/modules/product_kit/productpy", line 72, in get_multivalue
    value = super()get_multivalue(name, **pattern)
  File "/usr/local/lib/python39/dist-packages/trytond/modules/product_cost_warehouse/productpy", line 67, in get_multivalue
    return super()get_multivalue(name, **pattern)
  File "/usr/local/lib/python39/dist-packages/trytond/modules/product_cost_history/productpy", line 52, in get_multivalue
    cost_price = selfget_cost_price_at(datetimedate(), **pattern)
  File "/usr/local/lib/python39/dist-packages/trytond/modules/product_cost_history/productpy", line 63, in get_cost_price_at
    records = CostHistorysearch([
  File "/usr/local/lib/python39/dist-packages/trytond/model/modelsqlpy", line 1459, in search
    cursorexecute(*select)
  File "/usr/local/lib/python39/dist-packages/trytond/backend/postgresql/databasepy", line 72, in execute
    cursorexecute(self, sql, args)
psycopg2ProgrammingError: can't adapt type 'stocklocation'

Fault: can't adapt type 'stock.location'
History
Date User Action Args
2022-01-22 21:04:19cedsetkeyword: - backport
2022-01-20 18:59:24roundup-botsetmessages: + msg73349
2022-01-20 18:59:14roundup-botsetmessages: + msg73348
nosy: + roundup-bot
status: testing -> resolved
2022-01-06 14:30:33booraa0asetmessages: + msg73160
2022-01-05 21:52:47reviewbotsetmessages: + msg73137
nosy: + reviewbot
2022-01-05 21:32:34cedsetkeyword: + backport, review
messages: + msg73136
reviews: 377941008
status: in-progress -> testing
2022-01-05 21:31:45cedsetassignedto: ced
nosy: + ced
status: unread -> in-progress
type: crash
2022-01-05 19:40:22booraa0asetmessages: + msg73133
2022-01-05 19:38:33booraa0acreate

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