summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoopam Rathod <rrt@odoo.com>2021-02-18 13:16:54 +0000
committerJigar Vaghela <jva@odoo.com>2021-05-14 16:41:53 +0000
commit819321c3a129613890ce49e3efe9a903c3218070 (patch)
tree3d9fc321a88ad3f39bc9cef6f50c40649ec23aea
parentaf5a88e84fb1c05c4be38930373165f28a06f4f0 (diff)
[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#69738 X-original-commit: b87612d6fc8d9ec27a8cf0803369c90df00c5f57 Signed-off-by: William André (wan) <wan@odoo.com> Signed-off-by: rrt-odoo <rrt-odoo@users.noreply.github.com>
-rw-r--r--addons/account/models/account_move.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/addons/account/models/account_move.py b/addons/account/models/account_move.py
index d382db1b85b..42d9367d763 100644
--- a/addons/account/models/account_move.py
+++ b/addons/account/models/account_move.py
@@ -2809,7 +2809,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):