This question has been flagged
2 Replies
9417 Views

I have created a sequence and it was working perfectly but now I'm getting the following error. While creating a new record I'm calling that sequence form the create method.

How can I resolve this?

I'm not able to do any actions with that sequence record from front end and from the database side also.



Avatar
Discard
Best Answer

Now we are in version 16 Enterprise,

 still i am facing the same problem


RPC_ERROR

Odoo Server Error

Traceback (most recent call last):

  File "/home/odoo/src/odoo/odoo/http.py", line 1633, in _serve_db

    return service_model.retrying(self._serve_ir_http, self.env)

  File "/home/odoo/src/odoo/odoo/service/model.py", line 133, in retrying

    result = func()

  File "/home/odoo/src/odoo/odoo/http.py", line 1660, in _serve_ir_http

    response = self.dispatcher.dispatch(rule.endpoint, args)

  File "/home/odoo/src/odoo/odoo/http.py", line 1864, in dispatch

    result = self.request.registry['ir.http']._dispatch(endpoint)

  File "/home/odoo/src/odoo/odoo/addons/base/models/ir_http.py", line 154, in _dispatch

    result = endpoint(**request.params)

  File "/home/odoo/src/odoo/odoo/http.py", line 697, in route_wrapper

    result = endpoint(self, *args, **params_ok)

  File "/home/odoo/src/odoo/addons/web/controllers/dataset.py", line 46, in call_button

    action = self._call_kw(model, method, args, kwargs)

  File "/home/odoo/src/odoo/addons/web/controllers/dataset.py", line 33, in _call_kw

    return call_kw(request.env[model], method, args, kwargs)

  File "/home/odoo/src/odoo/odoo/api.py", line 468, in call_kw

    result = _call_kw_multi(method, model, args, kwargs)

  File "/home/odoo/src/odoo/odoo/api.py", line 453, in _call_kw_multi

    result = method(recs, *args, **kwargs)

  File "/home/odoo/src/user/sale_base_16/models/sale_approval.py", line 509, in get_approval

    self.action_confirm()

  File "/home/odoo/src/user/sale_base_16/models/sale_approval.py", line 430, in action_confirm

    return super(CustomSaleOrder, self).action_confirm()

  File "/home/odoo/src/user/sale_base_16/models/models.py", line 58, in action_confirm

    rec.name = rec.doc_type_id.sequence_id.next_by_id()

  File "/home/odoo/src/odoo/odoo/addons/base/models/ir_sequence.py", line 274, in next_by_id

    return self._next(sequence_date=sequence_date)

  File "/home/odoo/src/odoo/odoo/addons/base/models/ir_sequence.py", line 263, in _next

    return self._next_do()

  File "/home/odoo/src/odoo/odoo/addons/base/models/ir_sequence.py", line 204, in _next_do

    number_next = _update_nogap(self, self.number_increment)

  File "/home/odoo/src/odoo/odoo/addons/base/models/ir_sequence.py", line 57, in _update_nogap

    self._cr.execute("SELECT number_next FROM %s WHERE id=%%s FOR UPDATE NOWAIT" % self._table, [self.id])

  File "/home/odoo/src/odoo/odoo/sql_db.py", line 321, in execute

    res = self._obj.execute(query, params)

psycopg2.errors.LockNotAvailable: could not obtain lock on row in relation "ir_sequence"

 

 

The above server error caused the following client error:

RPC_ERROR: Odoo Server Error

    at makeErrorFromResponse (https://ltindia-ltindia.odoo.com/web/assets/19741-472c7f6/web.assets_backend.min.js:1000:163)

    at XMLHttpRequest. (https://ltindia-ltindia.odoo.com/web/assets/19741-472c7f6/web.assets_backend.min.js:1008:13)


Avatar
Discard
Best Answer

Thats error message caused by postgresql failed to fetch some record because the record wich related to the action but the pgsql still processing (can be write command or etc) by another request at postgresql buffer.


If you use "No Gap" implementation then for a simple way to resolve your issue you can try change the implementation to "Standard"




But if you still require to use "No Gap" implementation maybe you must reconfigure your postgresql server configuration,, or you can optimize your server to speed up the performance

Further read:
https://www.postgresql.org/docs/9.1/explicit-locking.html


Avatar
Discard
Author

I have tried this already but the problem is I'm not able to save the record after that change. Both from the front end and from database also i tried. It's not saving. It's getting timeout.

Timeout means it execute heavy transaction, so you must debug it,,, and analyse why it so took long time...

Maybe you can see log (using --log-level=debug)

What postgresql version what you have ?Can you tell your server specification (CPU,RAM, OS, POstgresql)?

Is this happened on your production stage or you try in development stage??

If in production stage, are the database sizes big ??

You said that you also tried inserting data direct into database,, I think,, its trouble comes from your installed postgresql server..

Regards..

Author

Thanks for your support.

It's resolved after restarting the postgresql service.

It was in live server and the database is very big. I don't know why that error came. Anyway its resolved now after restarting postgresql.

Ok if my answers was helpful please vote up / accept my answers,, and i would like to say thanks.

Regards