mirror of
https://github.com/OCA/web.git
synced 2025-02-22 13:21:25 +02:00
@@ -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,
|
||||
});
|
||||
@@ -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);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user