Odoo Help

0

0
1 Answer
2
Avatar

Med Said BARA

--Med Said BARA--

2859
| 6 5 10
Guelma, 阿尔及利亚
--Med Said BARA--


Med Said BARA
2014/8/23 下午12:20

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
2014/8/23 下午12:23

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

Med Said BARA
2014/8/23 下午12:41

can you be more explicit?

klacus
2014/8/23 下午12:45

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

Med Said BARA
2014/8/23 下午2:32

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
2014/8/23 下午3:46

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

klacus
2014/8/24 上午2:13

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 eLearning platform and experience all Odoo Apps through learning videos, use cases and quizzes.

Test it now