# \_TransactionLockError()

**URL:** https://discuss.tryton.org/t/transactionlockerror/6914
**Category:** Developer
**Tags:** accounting
**Created:** [January 26, 2024, 3:47pm UTC](https://discuss.tryton.org/t/transactionlockerror/6914 "2024-01-26T15:47:44Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![yarzai](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/yarzai/32/2767_2.png) [@yarzai](https://discuss.tryton.org/u/yarzai)
#### Post date: [January 26, 2024, 3:47pm UTC](https://discuss.tryton.org/t/transactionlockerror/6914/1 "2024-01-26T15:47:45Z")

</div>

Hello,

I’m encountering an issue while using the `FiscalYear.create(data)` method in the [User Application](https://docs.tryton.org/projects/server/en/latest/topics/user_application.html). Specifically, I’m getting a `_TransactionLockError(_table="account_fiscalyear")`.

 ![image](https://discuss-cdn.tryton.org/uploads/default/original/2X/7/76006ba807b88f8d688d28f22042c324c817bbd8.png)

I’ve already verified the data to see if any field is missing, but everything appears to be in order.

Any assistance you can provide would be greatly appreciated.

Thank you.

---

<div class="post-metadata">

### Author: ![JCavallo](https://discuss-cdn.tryton.org/letter_avatar_proxy/v4/letter/j/48db29/32.png) [@JCavallo](https://discuss.tryton.org/u/JCavallo)
#### Post date: [January 26, 2024, 4:25pm UTC](https://discuss.tryton.org/t/transactionlockerror/6914/2 "2024-01-26T16:25:05Z")

</div>

Hello,

AFAIK, this comes from the 6.8 version, where locks can only be acquired at the start of the transaction.

See [this commit](https://foss.heptapod.net/tryton/tryton/-/commit/c8771e45b861644409ee60c46c4857e6e192e46a), you can check in `protocols/dispatcher.py@_dispatch` for how to handle this manually.

---

<div class="post-metadata">

### Author: ![ced](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/ced/32/1237_2.png) [@ced](https://discuss.tryton.org/u/ced)
#### Post date: [January 26, 2024, 4:43pm UTC](https://discuss.tryton.org/t/transactionlockerror/6914/3 "2024-01-26T16:43:21Z")

</div>

It looks like the `with_transaction` decorator is missing the `TransactionError` management: [with\_transaction decorator does not manage TransactionError (#12962) · Issues · Tryton / Tryton · GitLab](https://foss.heptapod.net/tryton/tryton/-/issues/12962)

---

<div class="post-metadata">

### Author: ![yarzai](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/yarzai/32/2767_2.png) [@yarzai](https://discuss.tryton.org/u/yarzai)
#### Post date: [January 27, 2024, 4:26am UTC](https://discuss.tryton.org/t/transactionlockerror/6914/4 "2024-01-27T04:26:52Z")

</div>

Thanks @ced for your reply.

When the issue [#12962](https://foss.heptapod.net/tryton/tryton/-/issues/12962) will be resolved?

or is there any alternative solution to manually lock the table?

---

<div class="post-metadata">

### Author: ![ced](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/ced/32/1237_2.png) [@ced](https://discuss.tryton.org/u/ced)
#### Post date: [January 27, 2024, 8:30am UTC](https://discuss.tryton.org/t/transactionlockerror/6914/5 "2024-01-27T08:30:42Z")

</div>

> [@yarzai](#):
>
> When the issue [#12962](https://foss.heptapod.net/tryton/tryton/-/issues/12962) will be resolved?

Do not know. This is a community project, it will be fixed when someone spend his time on it.

> [@yarzai](#):
>
> or is there any alternative solution to manually lock the table?

You must start the transaction yourself and pass `_lock_tables` argument as a list containing the names of the tables to lock.

---

<div class="post-metadata">

### Author: ![system](https://discuss-cdn.tryton.org/uploads/default/original/1X/c6f8ec0a40525cdcd50058c734283450a4b3d38b.png) [@system](https://discuss.tryton.org/u/system)
#### Post date: [January 27, 2024, 8:31pm UTC](https://discuss.tryton.org/t/transactionlockerror/6914/6 "2024-01-27T20:31:23Z")

</div>

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