Skip to content
Snippets Groups Projects
Commit 7e13cc7a authored by David (dafr)'s avatar David (dafr)
Browse files

[FIX] stock_inventory: Fix Memory Error


read_group on "stock.inventory.line" could result in a memory error when the database possess to many stock.inventory.line
Those filters were removed on commit ba92e1da by AVD to prevent a test error where those fields were False. On his advices, I re-added them with the '|' comparator handle the False cases.

OPW-2714644

closes odoo/odoo#81813

Signed-off-by: default avatarArnold Moyaux <arm@odoo.com>
parent b0be51f8
No related branches found
No related tags found
No related merge requests found
......@@ -426,8 +426,14 @@ class InventoryLine(models.Model):
return res
def _check_no_duplicate_line(self):
# Performance: restrict domain on 'not null' fields of stock_inventory_line.
domain = [('product_id', 'in', self.product_id.ids), ('location_id', 'in', self.location_id.ids)]
domain = [
('product_id', 'in', self.product_id.ids),
('location_id', 'in', self.location_id.ids),
'|', ('partner_id', 'in', self.partner_id.ids), ('partner_id', '=', None),
'|', ('package_id', 'in', self.package_id.ids), ('package_id', '=', None),
'|', ('prod_lot_id', 'in', self.prod_lot_id.ids), ('prod_lot_id', '=', None),
'|', ('inventory_id', 'in', self.inventory_id.ids), ('inventory_id', '=', None),
]
groupby_fields = ['product_id', 'location_id', 'partner_id', 'package_id', 'prod_lot_id', 'inventory_id']
lines_count = {}
for group in self.read_group(domain, ['product_id'], groupby_fields, lazy=False):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment