Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[15.0][IMP] mrp_multi_level: mrp cleanup performance #1379

Merged
merged 1 commit into from
Oct 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion mrp_multi_level/models/mrp_production.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,7 @@ class MrpProduction(models.Model):

_inherit = "mrp.production"

planned_order_id = fields.Many2one(comodel_name="mrp.planned.order")
planned_order_id = fields.Many2one(
comodel_name="mrp.planned.order",
index=True,
)
5 changes: 3 additions & 2 deletions mrp_multi_level/wizards/mrp_multi_level.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,9 +306,10 @@ def _mrp_cleanup(self, mrp_areas):
domain += [("mrp_area_id", "in", mrp_areas.ids)]
with mute_logger("odoo.models.unlink"):
self.env["mrp.move"].search(domain).unlink()
self.env["mrp.planned.order"].search(
domain + [("fixed", "=", False)]
).unlink()
self.env["mrp.inventory"].search(domain).unlink()
domain += [("fixed", "=", False)]
self.env["mrp.planned.order"].search(domain).unlink()
logger.info("End MRP Cleanup")
return True

Expand Down
Loading