Odoo Help

0
1 Answer
2
Avatar

Med Said BARA

--Med Said BARA--

2824
| 5 5 7
Algeria
--Med Said BARA--
Med Said BARA
8/23/14, 12:20 PM

You should NEVER call cr.commit() yourself, UNLESS you have created your own database cursor explicitly! And the situations where you need to do that are exceptional!

And by the way if you did create your own cursor, then you need to handle error cases and proper rollback, as well as properly close the cursor when you're done with it.

From: https://doc.odoo.com/contribute/15_guidelines/coding_guidelines_framework/#never-commit-the-transaction

6 Comments
klacus
8/23/14, 12:23 PM

Ok. What is the situation whit wizards? This can be commit own self?

Med Said BARA
8/23/14, 12:41 PM

can you be more explicit?

klacus
8/23/14, 12:45 PM

Hi Med. Can you explain me how to create an own database cursor, to take safe my activities?

Med Said BARA
8/23/14, 2:32 PM

It's in the above response;"And by the way if you did create your own cursor, then you need to handle error cases and proper rollback, as well as properly close the cursor when you're done with it." Keep in mind the "Transaction Isolation". To read: http://www.postgresql.org/docs/9.2/static/transaction-iso.html http://fossies.org/dox/odoo-7.saas-5/classopenerp_1_1sql__db_1_1Cursor.html

Med Said BARA
8/23/14, 3:46 PM

A good example: https://github.com/yeahliu/workflow_info/blob/master/controller.py

klacus
8/24/14, 2:13 AM

Thx Med. i will try it soon as possible.

Ask a Question
Writer
Keep Informed
2 follower(s)
About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register
Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now