Crash in shipments when reloading the record without saving

Hi,
We are experiencing a weird issue with shipments, first of all, we have some users who are used to use the ‘reload’ button to save changes instead of the ‘save’ button, so, if you open a shipment with moves defined, modify any field, shipment’s planned or effective date for example, and instead of normally saving the record, you use the ‘reload’ button, and press ‘yes’ in the dialog asking to save changes, the program crashes:

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 200, in wrapper
    return func(request, pool, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "usrlocallibpython3.11dist-packagestrytondprotocolsdispatcher.py", line 196, in _dispatch
    result = rpc.result(meth(*c_args, **c_kwargs))
                        ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "usrlocallibpython3.11dist-packagestrytondmodelmodelsql.py", line 1177, in read
    getter_results = field.get(
                     ^^^^^^^^^^
  File "usrlocallibpython3.11dist-packagestrytondmodelfieldsfunction.py", line 27, in wrapper
    return func(self, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "usrlocallibpython3.11dist-packagestrytondtransaction.py", line 50, in wrapper
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "usrlocallibpython3.11dist-packagestrytondmodelfieldsfunction.py", line 115, in get
    records = Model.browse(ids)
              ^^^^^^^^^^^^^^^^^
  File "usrlocallibpython3.11dist-packagestrytondmodelmodelstorage.py", line 691, in browse
    ids = list(map(int, ids))
          ^^^^^^^^^^^^^^^^^^^
ValueError: invalid literal for int() with base 10: ''

To add a bit of context as the traceback does not clarify what is exactly causing the issue, this is the request causing the issue: company.company.read([''], ['rec_name'] ...., the function is the Company.get_rec_name, and the ‘get’ function:

@getter_context
@without_check_access
def get(self, ids, Model, name, values=None):
        '''
        Call the getter.
        If the function has ``names`` in the function definition then
        it will call it with a list of name.
        '''

is receiving '' as ids. The error disappear by removing company and currency fields from the move form, so I guess it is related to the company field being loaded in the move form.

I’ve been able to reproduce it on the 7.0 demo, also tried in 7.4 demo but it does not crash in this version, anyway, this version still have some strange behaviour, doing exactly the same, the outgoing moves disappear from the shipment, and you can ‘reload’ again and the program will ask you everytime to save changes even if you did not change anything, also everytime you refresh, the moves appear for less than a second and disappear again, until you properly save the record, so they appear again correctly on the shipment’s form.

As I know it is quite hard to understand/reproduce the problem, here I leave the steps to reproduce in the demo:

  • Open a shipment with moves
  • Set/modify the effective_date (for example, but it can be any field)
  • Use the ‘reload’ button to save the record

7.0 behaviour: crash
7.4 behaviour: outgoing moves disappear and the record is not being saved

The reason i’m not filling an issue is because of the behaviour change between both versions, and the 7.4 being a bit more friendly, maybe this is something which has been ‘solved’ or atleast tried to solve recently?

Yes, it was solved in 7.4. I think this is the issue:

However, the new loading problem you mention should be fixed.

1 Like

I see, thanks for the link.

I’ve filled:

Thanks for the response.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.