[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 <amoyaux@users.noreply.github.com>
This commit is contained in:
Fanny He
2020-01-28 13:03:13 +00:00
committed by Arnold Moyaux
parent 3c7bc9721b
commit a227bd9156
+2
View File
@@ -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):