FIX: Status propagation from Parent Product

toSell or toBuy Status propagation should be done only when parent is updated. 

Otherwise, any modification made on the parent will overwrite the specific configuration made at the child level.
This commit is contained in:
BadPixxel 2021-11-02 14:16:55 +01:00 committed by GitHub
parent 960319fd8a
commit 98929f2dba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -488,8 +488,14 @@ class ProductCombination
$child->price_autogen = $parent->price_autogen;
$child->weight = $parent->weight;
$child->status = $parent->status;
// Only when Parent Status are updated
if ($parent->oldcopy && ($parent->status != $parent->oldcopy->status)) {
$child->status = $parent->status;
}
if ($parent->oldcopy && ($parent->status_buy != $parent->oldcopy->status_buy)) {
$child->status_buy = $parent->status_buy;
}
if ($this->variation_weight) { // If we must add a delta on weight
$child->weight = ($child->weight ? $child->weight : 0) + $this->variation_weight;
}