Skip to Content
Menu
This question has been flagged
3 Replies
26751 Views

When i validate more than one invoice same time it says ValueError: "could not serialize access due to concurrent update.

This issue cause on odoo.com demo site.

Here is detail of error

OpenERP Server Error

Traceback (most recent call last): File "/home/odoo/src/odoo/saas-3/openerp/http.py", line 379, in _handle_exception return super(JsonRequest, self)._handle_exception(exception) File "/home/odoo/src/odoo/saas-3/openerp/http.py", line 398, in dispatch result = self._call_function(**self.params) File "/home/odoo/src/odoo/saas-3/openerp/http.py", line 235, in _call_function return checked_call(self.db, *args, **kwargs) File "/home/odoo/src/odoo/saas-3/openerp/service/model.py", line 114, in wrapper return f(dbname, *args, **kwargs) File "/home/odoo/src/odoo/saas-3/openerp/http.py", line 232, in checked_call return self.func(*a, **kw) File "/home/odoo/src/odoo/saas-3/openerp/http.py", line 562, in __call__ return self.method(*args, **kw) File "/home/odoo/src/odoo/saas-3/addons/web/controllers/main.py", line 1245, in exec_workflow return request.session.exec_workflow(model, id, signal) File "/home/odoo/src/odoo/saas-3/openerp/http.py", line 849, in exec_workflow r = self.proxy('object').exec_workflow(self.db, self.uid, self.password, model, signal, id) File "/home/odoo/src/odoo/saas-3/openerp/http.py", line 621, in proxy_method result = openerp.netsvc.dispatch_rpc(self.service_name, method, args) File "/home/odoo/src/odoo/saas-3/openerp/netsvc.py", line 240, in dispatch_rpc result = dispatch(method, params) File "/home/odoo/src/odoo/saas-3/openerp/service/model.py", line 37, in dispatch res = fn(db, uid, *params) File "/home/odoo/src/odoo/saas-3/openerp/service/model.py", line 114, in wrapper return f(dbname, *args, **kwargs) File "/home/odoo/src/odoo/saas-3/openerp/service/model.py", line 195, in exec_workflow return exec_workflow_cr(cr, uid, obj, signal, *args) File "/home/odoo/src/odoo/saas-3/addons/audittrail/audittrail.py", line 540, in exec_workflow_cr return fct_src(cr, uid, model, method, *args, **kw) File "/home/odoo/src/odoo/saas-3/openerp/service/model.py", line 189, in exec_workflow_cr return execute_cr(cr, uid, obj, 'signal_workflow', [res_id], signal)[res_id] File "/home/odoo/src/odoo/saas-3/addons/audittrail/audittrail.py", line 534, in execute_cr return fct_src(cr, uid, model, method, *args, **kw) File "/home/odoo/src/odoo/saas-3/openerp/service/model.py", line 160, in execute_cr return getattr(object, method)(cr, uid, *args, **kw) File "/home/odoo/src/odoo/saas-3/openerp/osv/orm.py", line 3658, in signal_workflow result[res_id] = workflow.trg_validate(uid, self._name, res_id, signal, cr) File "/home/odoo/src/odoo/saas-3/openerp/workflow/__init__.py", line 85, in trg_validate return WorkflowService.new(cr, uid, res_type, res_id).validate(signal) File "/home/odoo/src/odoo/saas-3/openerp/workflow/service.py", line 91, in validate res2 = wi.validate(signal) File "/home/odoo/src/odoo/saas-3/openerp/workflow/instance.py", line 75, in validate wi.process(signal=signal, force_running=force_running, stack=stack) File "/home/odoo/src/odoo/saas-3/openerp/workflow/workitem.py", line 121, in process ok = self._split_test(activity['split_mode'], signal, stack) File "/home/odoo/src/odoo/saas-3/openerp/workflow/workitem.py", line 249, in _split_test self._join_test(t[0], t[1], stack) File "/home/odoo/src/odoo/saas-3/openerp/workflow/workitem.py", line 258, in _join_test WorkflowItem.create(self.session, self.record, activity, inst_id, stack=stack) File "/home/odoo/src/odoo/saas-3/openerp/workflow/workitem.py", line 96, in create workflow_item.process(stack=stack) File "/home/odoo/src/odoo/saas-3/openerp/workflow/workitem.py", line 117, in process if not self._execute(activity, stack): File "/home/odoo/src/odoo/saas-3/openerp/workflow/workitem.py", line 163, in _execute returned_action = self.wkf_expr_execute(activity) File "/home/odoo/src/odoo/saas-3/openerp/workflow/workitem.py", line 314, in wkf_expr_execute return self.wkf_expr_eval_expr(activity['action']) File "/home/odoo/src/odoo/saas-3/openerp/workflow/workitem.py", line 292, in wkf_expr_eval_expr result = eval(line, env, nocopy=True) File "/home/odoo/src/odoo/saas-3/openerp/tools/safe_eval.py", line 312, in safe_eval return eval(c, globals_dict, locals_dict) File "", line 1, in <module> File "/home/odoo/src/odoo/saas-3/openerp/osv/orm.py", line 378, in function_proxy return attr(self._cr, self._uid, [self._id], *args, **kwargs) File "/home/odoo/src/odoo/saas-3/addons/account/account_invoice.py", line 1078, in action_move_create move_obj.post(cr, uid, [move_id], context=ctx) File "/home/odoo/src/odoo/saas-3/addons/account/account.py", line 1302, in post new_name = obj_sequence.next_by_id(cr, uid, journal.sequence_id.id, c) File "/home/odoo/src/odoo/saas-3/openerp/addons/base/ir/ir_sequence.py", line 267, in next_by_id return self._next(cr, uid, ids, context) File "/home/odoo/src/odoo/saas-3/addons/account/ir_sequence.py", line 56, in _next return super(ir_sequence, self)._next(cr, uid, seq_ids, context) File "/home/odoo/src/odoo/saas-3/openerp/addons/base/ir/ir_sequence.py", line 252, in _next cr.execute("SELECT number_next FROM ir_sequence WHERE id=%s FOR UPDATE NOWAIT", (seq['id'],)) File "/home/odoo/src/odoo/saas-3/openerp/sql_db.py", line 156, in wrapper return f(self, *args, **kwargs) File "/home/odoo/src/odoo/saas-3/openerp/sql_db.py", line 221, in execute res = self._obj.execute(query, params) ValueError: "could not serialize access due to concurrent update " while evaluating u'action_move_create()'

 

Avatar
Discard
Best Answer

The problem is due to lock on sequence table.

Actually this is probably bug. Ordinary sequence for id should be called in separate transaction. It would limit number of confilts almost to zero.

Professional Odoo implementations

 

Avatar
Discard

Yeah, this is a real pain. I'm trying to refactor some code that creates a bunch of objects for a data migration, which are all of similar types. I can't make this parallel and take advantage of multi-CPU systems because it hits serialization issues on the sequence ids (mostly, also some other parts). This really needs finer-grained transaction isolation than the current "everything running in this cursor" type isolation. Particularly for sequences. Looks like I'll have to try some sort of manual cursor commit, close, open dance. Ugh.

Best Answer

This may happen sometines if you use two sequences in invoices - on different journals, where one sequence type is Standards and the other no-gap

Avatar
Discard