refactor: remove debug logs and console statements from backend and frontend logic

This commit is contained in:
Suherdy Yacob 2026-04-03 22:22:46 +07:00
parent ba97eac4cc
commit 9a45473013
2 changed files with 4 additions and 9 deletions

View File

@ -61,7 +61,7 @@ class StockLocation(models.Model):
source_name = f"PT {pt.display_name} (M21)"
if allowed_ids:
_logger.error(f"DEBUG_RESTRICT: Identified {len(allowed_ids)} Allowed Locations for {source_name}: {allowed_ids}")
_logger.debug(f"DEBUG_RESTRICT: Identified {len(allowed_ids)} Allowed Locations for {source_name}: {allowed_ids}")
return allowed_ids
return []

View File

@ -12,8 +12,6 @@ patch(SMLX2ManyField.prototype, {
return super.onAdd({ context, editable });
}
console.log("DEBUG_RESTRICT: Intercepting SMLX2ManyField.onAdd (Attempt 20)");
// 1. Sync Dirty Data (Internal Odoo Logic)
await this.updateDirtyQuantsData();
@ -34,19 +32,18 @@ patch(SMLX2ManyField.prototype, {
picking_type_id: this.props.context.default_picking_type_id,
}
);
console.log("DEBUG_RESTRICT: RPC Success. Allowed IDs:", allowedIds);
} catch (e) {
console.error("DEBUG_RESTRICT: RPC Failed, using safety fallback.", e);
// Safety fallback to standard location logic if RPC fails
allowedIds = [];
}
// 4. Prepare Context (Reinforced with default_product_id for Attempt 20)
// 4. Prepare Context
context = {
...context,
single_product: true,
list_view_ref: "stock.view_stock_quant_tree_simple",
active_mo_id: mo_id,
default_product_id: this.props.record.data.product_id.id, // CRITICAL: Ensure product link is preserved
default_product_id: this.props.record.data.product_id.id,
default_picking_type_id: this.props.context.default_picking_type_id,
default_allowed_source_location_ids: allowedIds,
};
@ -86,8 +83,6 @@ patch(SMLX2ManyField.prototype, {
}
}
console.log("DEBUG_RESTRICT: Final Domain (Attempt 20):", domain);
// 7. Open the selection modal
return this.selectCreate({ domain, context, title });
}