Hilfe

3

No concurrency check when updating records

Avatar
siddharth jambukiya

Only one user at any time should be able to edit a contract. We need to pop up a dialog box with details of the user that has the record open if another user tries to edit the record.

This obvious feature doesn't appear to be native to OpenERP.

Is there a module that implements this across the whole system?

Only one user at any time should be able to edit a contract. We need to pop up a dialog box with details of the user that has the record open if another user tries to edit the record. The 2nd user should then be prevented from editing the record until it is unlocked (i.e. the 1st user either saves or discards the record).

Seems odd that record locking is not part of the default Openerp architecture - do you know why?

Can we take a look at how we can implement this and come back with some ideas. It's not a burning priority at the moment but will be as soon as one/two of the users "discover" this issue.

2 Kommentare
Avatar
Verwerfen

Did you report a bug on Github ? Can you post the link ? Thanks.

I reported the bug: https://github.com/odoo/odoo/issues/6737

4 Antworten
2
Best Answer

The BaseModel in orm implements a function for that problem "_check_concurrency" that is called within the write method. For a reason I don't know the "_last_update" entry is never added to the context therefor that method is useless. Anyone does know more about?

Avatar
Verwerfen
0
Avatar
Anwar
Best Answer

Anyone tryied to make this feature work in Odoo 11? If yes, how did you managed to make it trigger the "_check_concurrency" in order to prompt an error if a user is updating a record that have been updated by another user?


We tryied in our team to follow the source code that lead us to the "__last_update" field, and we gave it a try by updating the context to add this field by overriding the method "read(self)" of the tested model, but it seems the verification on the file /odoo/odoo/models.py on the "def _check_concurrency(self)" always display a context without any "__last_update" fields, and we cannot wrap our head around this!!

Does someone also tryied to update the context? If yes, did you manage to trigger the checking by setting the context on the python side or javascript side or something else?

Avatar
Verwerfen
0
Avatar
Martin Malorni
Best Answer

We have created a module that fixes the issues with the _check_concurrency function and we have improved on it as it was not covering some use cases. The module is available here. https://apps.openerp.com/apps/modules/9.0/concurrency/. The module can be made to work for v8 and v10 easily if there is an interest. It work in the enterprise version as well.

Avatar
Verwerfen
0
Avatar
Ray Carnes
Best Answer

Conflicts when two people edit the same record are presented/resolved when they save.

Try it!

2 Kommentare
Avatar
Verwerfen
Avatar
siddharth jambukiya
-

i am agree with you Ray carnes but conflicts occurs when two user try to edit same record and same field at a time...

Avatar
Mathieu Laflamme
-

I try and to me this is not working fine. I created an order. I click edit on that sale order with user admin. Then I used another user "laflammm" on another PC to edit the same order. Then I changed the Comment field to "whatever" with user "admin" then I saved. I returned on that same order opened by "laflammm" on another computer and changed the same field to "whatever2" and saved. I got no error to let me know I just overwrote the previous save done by admin!