I have a cycle like this.
for i in ids:
self.pool.get('product.product').create(cr, uid, vals, context = context)
Now in empty system this is not cause any matter, but what is a risk, for this kind of execution? Think of live system with user activites, and so on.
If has what is a different's between 6.1, 7.0, 8.0 versions?
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.
Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!
About This Community
|Asked: 8/22/14, 12:30 PM|
|Seen: 4721 times|
|Last updated: 11/24/16, 6:41 PM|