Skip to content

Commit 6b8aa43

Browse files
convenientaa-kashk
authored andcommitted
Fix best practice dev/grid/async_indexing for auto invoiced orders
1 parent 5dc13c3 commit 6b8aa43

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

app/code/Magento/Sales/Model/Order/Invoice/Plugin/AddressUpdate.php

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,27 @@ class AddressUpdate
1818
*/
1919
private $attribute;
2020

21+
/**
22+
* Global configuration storage.
23+
*
24+
* @var \Magento\Framework\App\Config\ScopeConfigInterface
25+
*/
26+
protected $globalConfig;
27+
2128
/**
2229
* AddressUpdate constructor.
2330
* @param \Magento\Sales\Model\ResourceModel\GridPool $gridPool
2431
* @param \Magento\Sales\Model\ResourceModel\Attribute $attribute
32+
* @param \Magento\Framework\App\Config\ScopeConfigInterface $globalConfig
2533
*/
2634
public function __construct(
2735
\Magento\Sales\Model\ResourceModel\GridPool $gridPool,
28-
\Magento\Sales\Model\ResourceModel\Attribute $attribute
36+
\Magento\Sales\Model\ResourceModel\Attribute $attribute,
37+
\Magento\Framework\App\Config\ScopeConfigInterface $globalConfig
2938
) {
3039
$this->gridPool = $gridPool;
3140
$this->attribute = $attribute;
41+
$this->globalConfig = $globalConfig;
3242
}
3343

3444
/**
@@ -68,9 +78,10 @@ public function afterProcess(
6878
$this->attribute->saveAttribute($invoice, $invoiceAttributesForSave);
6979
}
7080
}
71-
7281
if ($orderInvoiceHasChanges) {
73-
$this->gridPool->refreshByOrderId($order->getId());
82+
if (!$this->globalConfig->getValue('dev/grid/async_indexing')) {
83+
$this->gridPool->refreshByOrderId($order->getId());
84+
}
7485
}
7586
}
7687
}

0 commit comments

Comments
 (0)