Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[16.0][FIX] web_widget_product_label_section_and_note: Use a flag to change the icon based on product visibility. #3083

Open
wants to merge 1 commit into
base: 16.0
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ export class ProductLabelSectionAndNoteField extends Many2OneField {
this.labelVisibility = useState({value: false});
this.isProductVisible = useState({value: false});
this.switchToLabel = false;
this.changeProductVisibility = true;
this.columnIsProductAndLabel = useState({
value: this.props.record.columnIsProductAndLabel,
});
Expand Down Expand Up @@ -184,8 +185,10 @@ export class ProductLabelSectionAndNoteField extends Many2OneField {
window.removeEventListener("afterprint", this.onAfterPrint);
});
onWillUpdateProps((newProps) => {
const label = newProps.record.data.name || "";
this.isProductVisible.value = label.includes(this.productName);
if (this.changeProductVisibility) {
const label = newProps.record.data.name || "";
this.isProductVisible.value = label.includes(this.productName);
}
});
}

Expand Down Expand Up @@ -257,9 +260,12 @@ export class ProductLabelSectionAndNoteField extends Many2OneField {
}

updateLabel(value) {
this.changeProductVisibility = false;
this.props.record.update({
name:
this.productName && this.productName !== value
this.productName &&
this.productName !== value &&
this.isProductVisible.value
? `${this.productName}\n${value}`
: value,
});
Expand Down
Loading