[IMP] website_form: keep label when input changes

Changing the input type should not change the label name.

The goal of this commit is to keep old label when input type
changes and set the default label names for new fields only.

Part of https://github.com/odoo/odoo/pull/68061
task-2431484
This commit is contained in:
xO-Tx
2021-07-12 08:30:57 +00:00
committed by qsm-odoo
parent ebfa28638b
commit e28f264ef6
@@ -821,8 +821,8 @@ options.registry.WebsiteFieldEditor = FieldEditor.extend({
if (!value) {
return;
}
const name = this.el.querySelector(`[data-custom-field="${value}"]`).textContent;
const field = this._getCustomField(value, `Custom ${name}`);
const oldLabelText = this.$target[0].querySelector('.s_website_form_label_content').textContent;
const field = this._getCustomField(value, oldLabelText);
this._setActiveProperties(field);
await this._replaceField(field);
this.rerender = true;