[IMP] mrp_multi_level: reduce some logging

When running the multi level planner, the wizard will delete the records
from the previous run (mrp.inventory, mrp.move, mrp.planned.order).
There can be hundreds of such records, and the call to unlink() will
create a log entry which is not really informative. We disable this log
during the call to the wizard (but keep if for manual unlinking of the
records which we want to trace).
This commit is contained in:
Alexandre Fayolle
2023-12-04 12:18:10 +01:00
committed by Lois Rilo
parent 9786346cf6
commit 2a3a9f704b

View File

@@ -8,7 +8,7 @@ import logging
from datetime import date, timedelta
from odoo import _, api, exceptions, fields, models
from odoo.tools import float_is_zero
from odoo.tools import float_is_zero, mute_logger
logger = logging.getLogger(__name__)
@@ -321,10 +321,11 @@ class MultiLevelMrp(models.TransientModel):
domain = []
if mrp_areas:
domain += [("mrp_area_id", "in", mrp_areas.ids)]
self.env["mrp.move"].search(domain).unlink()
self.env["mrp.inventory"].search(domain).unlink()
domain += [("fixed", "=", False)]
self.env["mrp.planned.order"].search(domain).unlink()
with mute_logger("odoo.models.unlink"):
self.env["mrp.move"].search(domain).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