From a227bd915680d56ff99a5781aa52eff33f33e0a7 Mon Sep 17 00:00:00 2001 From: Fanny He Date: Thu, 23 Jan 2020 13:26:48 +0000 Subject: [PATCH] [FIX] stock, stock_account: commit _run_scheduler_tasks When running the scheduler, either from the cron or from Inventory, _run_scheduler_tasks calls _merge_quants. However, when there were quants to merge, the query from _merge_quants would not be applied from this function. This is because the parameter use_new_cursor was used but a manual commit was missing after calling _merge_quants. For run_scheduler, we use the parameter use_new_cursor except for tests. We add a commit in _run_scheduler_tasks, so that the result of _merge_quants is committed in the database. Same issue for _run_fifo_vaccum opw 2155559 closes odoo/odoo#44105 X-original-commit: 021f0f0cdeb006006e93fd74f0280d18b5688836 Signed-off-by: Arnold Moyaux --- addons/stock/models/stock_rule.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/addons/stock/models/stock_rule.py b/addons/stock/models/stock_rule.py index 8768173a7bb..e3d7f62ea87 100644 --- a/addons/stock/models/stock_rule.py +++ b/addons/stock/models/stock_rule.py @@ -499,6 +499,8 @@ class ProcurementGroup(models.Model): # Merge duplicated quants self.env['stock.quant']._quant_tasks() + if use_new_cursor: + self._cr.commit() @api.model def run_scheduler(self, use_new_cursor=False, company_id=False):