Skip to content

Commit

Permalink
Merge PR #3083 into 16.0
Browse files Browse the repository at this point in the history
Signed-off-by pedrobaeza
  • Loading branch information
OCA-git-bot committed Feb 8, 2025
2 parents bcdf468 + f74971b commit 8b12a0d
Showing 1 changed file with 9 additions and 3 deletions.
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

0 comments on commit 8b12a0d

Please sign in to comment.