[IMP] stock: avoid calling quant_tasks by default.
Currently, a cron is called once a day (by default) to merge duplicated quants. Moreover, each time the customer loads the Inventory Report, the duplicated quants are also merged. This is a bit overkill as duplicated quants due to concurrent updates are quite rare. Also, merging quants can be quite slow when the stock.quant table is big (>1M). This commit adds an ir.config_parameter to turn off the merging of quants when accessing the Inventory Report. It can be switched back on for a specific DB if duplicated quants happen more frequently. opw-2574152 closes odoo/odoo#87119 X-original-commit: bb2cb76a724c1bc12aa7e515b1376b88ffd97b3d Signed-off-by: Arnold Moyaux <arm@odoo.com>
This commit is contained in:
@@ -917,7 +917,8 @@ class StockQuant(models.Model):
|
||||
:param domain: List for the domain, empty by default.
|
||||
:param extend: If True, enables form, graph and pivot views. False by default.
|
||||
"""
|
||||
self._quant_tasks()
|
||||
if not self.env['ir.config_parameter'].sudo().get_param('stock.skip_quant_tasks'):
|
||||
self._quant_tasks()
|
||||
ctx = dict(self.env.context or {})
|
||||
ctx['inventory_report_mode'] = True
|
||||
ctx.pop('group_by', None)
|
||||
|
||||
Reference in New Issue
Block a user