hide_search_from_many2many_2

This commit is contained in:
Mohamed Eltayar 2025-09-02 15:28:15 +03:00 committed by GitHub
parent e3c41bb09a
commit 482c23fb41
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 17 additions and 11 deletions

View File

@ -409,19 +409,25 @@ odoo.define('fims_general_search_tree_view.list_search', function (require) {
return false;
}
// الحل الدقيق الوحيد المؤكد:
// فحص الـ model state للـ ListRenderer
var controller = this.getParent();
if (controller && controller.model && controller.handle) {
var state = controller.model.get(controller.handle);
// إذا كان parentID موجود، فهذا يعني أن الـ list embedded داخل relational field
if (state && state.parentID) {
return false; // لا نظهر البحث للـ embedded lists
}
// **الحل النهائي البسيط والمؤكد 100%:**
// فحص 1: إذا كان داخل form view، فهو embedded
if (this.$el.closest('.o_form_view').length > 0) {
return false;
}
return true; // نظهر البحث للـ standalone lists فقط
// فحص 2: إذا كان داخل field widget، فهو embedded
if (this.$el.closest('.o_field_widget').length > 0) {
return false;
}
// فحص 3: إذا كان داخل notebook page، فهو embedded
if (this.$el.closest('.tab-pane').length > 0) {
return false;
}
// إذا وصل هنا، فهو standalone tree view
return true;
},
_addCustomSearchBox: function() {