Test Tax raises ValueError: invalid literal for int() with base 10: 'add'
Summary
In 7.0.2, testing a trivial tax fails with
ValueError: invalid literal for int() with base 10: 'add'
In 6.xx, this works, and produces the expected result.
How to Reproduce
I tested on https://demo7.0.tryton.org/ and https://demo6.0.tryton.org/ respectively.
- Go to "Financial / Configuration / Taxes / Taxes"
- Create a new tax with name, description, type "percentage" and rate "15%", invoice account "main payable" and credit note account "main receivable" (or any other values)
- Save the new tax
- Go to "Financial / Configuration / Taxes / Test Tax"
- Enter a unit price larger than 0
- Add the newly created test under "Taxes"
Result:
- On 6.x you get the expected result. (See screenshot below)
- On 7.x, it fails, see stack trace below.
Stack Trace in 7.x
Traceback (most recent call last):
File "usrlocallibpython3.11dist-packagestrytondwsgi.py", line 109, in dispatch_request
return endpoint(request, **request.view_args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "usrlocallibpython3.11dist-packagestrytondprotocolsdispatcher.py", line 43, in rpc
return methods.get(request.rpc_method, _dispatch)(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "usrlocallibpython3.11dist-packagestrytondwsgi.py", line 75, in wrapper
return func(request, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "usrlocallibpython3.11dist-packagestrytondprotocolswrappers.py", line 197, in wrapper
return func(request, pool, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "usrlocallibpython3.11dist-packagestrytondprotocolsdispatcher.py", line 201, in _dispatch
result = rpc.result(meth(inst, *c_args, **c_kwargs))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "usrlocallibpython3.11dist-packagestrytondmodelfieldsfield.py", line 203, in wrapper
setattr(self, fieldname, value)
File "usrlocallibpython3.11dist-packagestrytondmodelfieldsone2many.py", line 303, in __set__
records = instanciate_values(Target, value, **extra)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "usrlocallibpython3.11dist-packagestrytondmodelfieldsfield.py", line 176, in instanciate_values
return tuple(instance(x) for x in (value or []))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "usrlocallibpython3.11dist-packagestrytondmodelfieldsfield.py", line 176, in <genexpr>
return tuple(instance(x) for x in (value or []))
^^^^^^^^^^^
File "usrlocallibpython3.11dist-packagestrytondmodelfieldsfield.py", line 175, in instance
return Target(data, **extra, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "usrlocallibpython3.11dist-packagestrytondmodelmodel.py", line 278, in __init__
id = int(id)
^^^^^^^
ValueError: invalid literal for int() with base 10: 'add'