تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
503 أدوات العرض

I would like to add 2 or more separate dynamic filters into a view loaded from JS module.

But the problem is that all of this dynamic filters are treated as one filter group and if activated more or them simultaneously they're combined with an or instead of an and.

For example if I'd like to add a couple of dynamic filters on the Quotations/Orders selection in pos_sale module:

import { ControlButtons } from "@point_of_sale/app/screens/product_screen/control_buttons/control_buttons";
import { _t } from "@web/core/l10n/translation";
import { patch } from "@web/core/utils/patch";
import { SelectCreateDialog } from "@web/views/view_dialogs/select_create_dialog";

patch(ControlButtons.prototype, {
// full override to add dynamic filters
onClickQuotation() {
const dynamicFilters = [{
description: _t("Filter 1"),
domain: [['field_one', '=', 'something']],
}, {
description: _t("Filter 2"),
domain: [['field_two', '=', 'something else']],
}];

this.dialog.add(SelectCreateDialog, {
      resModel: "sale.order",
      noCreate: true,
      multiSelect: false,
      domain: [
        ["state", "!=", "cancel"],
        ["invoice_status", "!=", "invoiced"],
        ["currency_id", "=", this.pos.currency.id],
      ],
      dynamicFilters,
      onSelected: async (resIds) => {
        await this.pos.onClickSaleOrder(resIds[0]);
      },
  });
}
}

This will end up in "Filter 1 or Filter 2" instead of "Filter 1" and "Filter 2"

الصورة الرمزية
إهمال
الكاتب

By the end I've overridden _createGroupOfDynamicFilters in search model in order to support multiple groups

المنشورات ذات الصلة الردود أدوات العرض النشاط
0
يوليو 25
406
1
يوليو 25
5289
0
يوليو 25
836
0
يونيو 25
844
1
يونيو 25
1021