[FIX] marketing_automation: fix mailing_filter widget

Before this commit:
The `mailing_filter` widget used to take the 2nd occurrence of a
many2one(selection) field and hide it in certain conditions, as it was assumed
that it is the field having the widget. Thus when there is more than 1
occurrence of a many2one field in the form view (before the field with the
widget), it used to hide random fields instead of targeted field.

After this commit:
The `mailing_filter` widget will only target the field with the widget, hence
solving the issue at hand.

Task-3430510

closes odoo/odoo#136094

X-original-commit: 4f5b8c47be4077cdaf7837062f518b7aef529d71
Related: odoo/enterprise#47678
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
This commit is contained in:
Pratik Raval (PRRA)
2023-09-21 20:38:02 +00:00
parent 67873a573a
commit 6ed7d952c4
@@ -58,7 +58,7 @@ export class FieldMany2OneMailingFilter extends Many2OneField {
return;
}
const filterCount = this.props.record.data.mailing_filter_count;
const dropdown = document.querySelectorAll('.o_field_many2one_selection > .o_input_dropdown')[1]
const dropdown = document.querySelector('.o_field_mailing_filter > .o_field_many2one_selection > .o_input_dropdown')
if (dropdown) {
dropdown.classList.toggle('d-none', !filterCount);
}