Error closing period

when I tried to close a period I get the following error:

Traceback (most recent call last):
  File "/trytond/wsgi.py", line 117, in dispatch_request
    return endpoint(request, **request.view_args)
  File "/trytond/protocols/dispatcher.py", line 47, in rpc
    return methods.get(request.rpc_method, _dispatch)(
  File "/trytond/wsgi.py", line 84, in auth_required
    return wrapped(*args, **kwargs)
  File "/trytond/protocols/wrappers.py", line 156, 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/modules/account_asset/account.py", line 235, in close
    super(Period, cls).close(periods)
  File "/trytond/model/modelview.py", line 774, in wrapper
    return func(cls, records, *args, **kwargs)
  File "/trytond/model/workflow.py", line 37, in wrapper
    result = func(cls, filtered, *args, **kwargs)
  File "/trytond/modules/account_invoice/account.py", line 160, in close
    super().close(periods)
  File "/trytond/model/modelview.py", line 774, in wrapper
    return func(cls, records, *args, **kwargs)
  File "/trytond/model/workflow.py", line 37, in wrapper
    result = func(cls, filtered, *args, **kwargs)
  File "/trytond/modules/account/period.py", line 307, in close
    database.lock(connection, Move._table)
  File "/trytond/backend/postgresql/database.py", line 436, in lock
    cursor.execute(SQL('LOCK {} IN EXCLUSIVE MODE NOWAIT').format(
  File "/trytond/backend/postgresql/database.py", line 72, in execute
    cursor.execute(self, sql, args)
psycopg2.errors.LockNotAvailable: could not obtain lock on relation "account_move"

I appreciate your help

There is a concurrent transaction that is holding a the table or a row of “account_move”.
You can see current transactions with SELECT * FROM pg_stat_activity;.

1 Like