[FIX] account:Auto Post scheduler action threads killed by timeout.

Before this commit:

  When there is too much records to post and it's take time more than 15 minutes then server was restarted.
  So scheduler action will do the process with the same records again and again.

After this commit:

  post record in batch of 1000

opw-2451446

closes odoo/odoo#70831

X-original-commit: 819321c3a129613890ce49e3efe9a903c3218070
Signed-off-by: rrt-odoo <rrt-odoo@users.noreply.github.com>
This commit is contained in:
Roopam Rathod
2021-05-17 06:38:08 +00:00
committed by Jigar Vaghela
parent e79316d229
commit 7aef86fa69
+4 -1
View File
@@ -2959,7 +2959,10 @@ class AccountMove(models.Model):
('date', '<=', fields.Date.context_today(self)),
('auto_post', '=', True),
])
records._post()
for ids in self._cr.split_for_in_conditions(records.ids, size=1000):
self.browse(ids)._post()
if not self.env.registry.in_test_mode():
self._cr.commit()
# offer the possibility to duplicate thanks to a button instead of a hidden menu, which is more visible
def action_duplicate(self):