Delete/Search when modifying a sale line raises a ValueError
When editing an existing sale line in a particular way, the following exception is raised:
Traceback (most recent call last):
File "/site-packages/trytond/wsgi.py", line 73, in dispatch_request
return endpoint(request, **request.view_args)
File "/site-packages/trytond/protocols/dispatcher.py", line 46, in rpc
request, database_name, *request.rpc_params)
File "/site-packages/trytond/wsgi.py", line 44, in auth_required
return wrapped(*args, **kwargs)
File "/site-packages/trytond/protocols/wrappers.py", line 122, in wrapper
return func(request, pool, *args, **kwargs)
File "/site-packages/trytond/protocols/dispatcher.py", line 176, in _dispatch
result = rpc.result(meth(*c_args, **c_kwargs))
File "/site-packages/trytond/model/modelsql.py", line 827, in read
getter_results = field.get(ids, cls, field_list, values=result)
File "/site-packages/trytond/model/fields/function.py", line 103, in get
return dict((name, call(name)) for name in names)
File "/site-packages/trytond/model/fields/function.py", line 103, in <genexpr>
return dict((name, call(name)) for name in names)
File "/site-packages/trytond/model/fields/function.py", line 96, in call
return method(records, name)
File "/site-packages/trytond/modules/sale/product.py", line 90, in get_sale_price_uom
return cls.get_sale_price(products, quantity=quantity)
File "/site-packages/trytond/modules/sale_price_list/product.py", line 38, in get_sale_price
customer, product, prices[product.id], quantity, uom)
File "/site-packages/trytond/modules/product_price_list/price_list.py", line 72, in compute
product.default_uom, round=False) if product else quantity
File "/site-packages/trytond/modules/product/uom.py", line 207, in compute_qty
% (from_uom.category.name, to_uom.category.name))
ValueError: cannot convert between Units and Length
Steps to reproduce:
* Create a sale and add a sale line
* For the sale line: "Edit selected record <F2>"
* In the product field: Click "Clear the field <Del>"
* The product field is now blank
* In the product field: Click "Search a record <F2>"
* The client raise the exception mentioned above
The sale line may be modified by just typing away in the product field and replacing the product without deleting it in the first place. Furthermore deleting the product and typing the name of the new product without opening the additional search window works as well.
Tested with GTK3 client only.
Versions: 5.0.0