From 2e619f9e9c5e2f711b79221038591ac61f3b6515 Mon Sep 17 00:00:00 2001 From: Simone Orsi Date: Fri, 22 Sep 2023 13:28:14 +0200 Subject: [PATCH] cms_form: fix master/slave js handle required The field wrapper should toggle the required class. --- cms_form/static/src/js/master_slave.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/cms_form/static/src/js/master_slave.js b/cms_form/static/src/js/master_slave.js index fd7c95fd..3cb7f2b6 100644 --- a/cms_form/static/src/js/master_slave.js +++ b/cms_form/static/src/js/master_slave.js @@ -76,10 +76,16 @@ odoo.define("cms_form.master_slave", function (require) { .removeClass("disabled"); }, handle_required: function (slave_fname) { - $('[name="' + slave_fname + '"]').attr("required", "required"); + $('[name="' + slave_fname + '"]') + .attr("required", "required") + .closest(".form-group") + .addClass("field-required"); }, handle_no_required: function (slave_fname) { - $('[name="' + slave_fname + '"]').attr("required", null); + $('[name="' + slave_fname + '"]') + .attr("required", null) + .closest(".form-group") + .removeClass("field-required"); }, }); });