diff --git a/models/stock_location.py b/models/stock_location.py index c2592e8..b022329 100644 --- a/models/stock_location.py +++ b/models/stock_location.py @@ -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 [] diff --git a/static/src/js/stock_move_line_x2_many_field_patch.js b/static/src/js/stock_move_line_x2_many_field_patch.js index 6952011..ee1b11b 100644 --- a/static/src/js/stock_move_line_x2_many_field_patch.js +++ b/static/src/js/stock_move_line_x2_many_field_patch.js @@ -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 }); }