[FIX] stock: domain optimization

'State' field on stock move is indexed. Some domains on stock move state
are expressed like (state, not in, ('a', 'b', 'c')) instead of (state,
in, ('d', 'e', 'f', NULL)). The 'not in' domain won't the index and thus
will be relatively slower

closes odoo/odoo#109201

X-original-commit: 96f8321e894a9b7284cca8f201e5a2877b0b3a76
Signed-off-by: Rémy Voet <ryv@odoo.com>
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
This commit is contained in:
William Henrotin
2023-01-06 12:29:38 +01:00
parent 5eba1ff07e
commit 2e8dcad061
@@ -39,8 +39,8 @@ class ReplenishmentReport(models.AbstractModel):
def _move_confirmed_domain(self, product_template_ids, product_variant_ids, wh_location_ids):
in_domain, out_domain = self._move_domain(product_template_ids, product_variant_ids, wh_location_ids)
out_domain += [('state', 'not in', ['draft', 'cancel', 'done'])]
in_domain += [('state', 'not in', ['draft', 'cancel', 'done'])]
out_domain += [('state', 'in', ['waiting', 'assigned', 'confirmed', 'partially_available'])]
in_domain += [('state', 'in', ['waiting', 'assigned', 'confirmed', 'partially_available'])]
return in_domain, out_domain
def _compute_draft_quantity_count(self, product_template_ids, product_variant_ids, wh_location_ids):