Hi.
I have a cycle like this.
for i in ids:
self.pool.get('product.product').create(cr, uid, vals, context = context)
cr.commit()
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?
Regards.
Laci.
Odoo auto commits the changes you make at the end of the transaction, why are you explicitly calling cr.commit() yourself?
Hi. Thanks for the reply. So I need the data sometimes as well, because I make a large calculation what is take's a lot of time. Sometimes this calculation cannot reach the end of transaction, because some exception raised, but some semi finish data is important for me, and this case I lost all of the calculated data. (I working on some diff. resource planner, what is need to recalculate the production, according the daily capacity and shift happening. ) Now I working on an automatic factory builder, what is create all of the things according few input data. (repacking routings, bill of material, create the sem finish parts, work instruction, according few templates) So in this case sometimes I create 200.000 lines In mrp.routing and I lost all, if some raw data is wrong. (template not exist, wrong mrp code and so on ) That's why I need to write manually the results what is ok.
I understand, in that case I don't think there is a risk associated with this, you are simply committing your changes immediately and it's just one line of code, so it shouldn't be a problem.
As long as you're sure that the batches of code you're committing wont cause a problem in case there is a failure, then it shouldn't be a problem. Just make sure to manage your transactions as the other member suggested in the answer to your question.