Skip to content

Commit

Permalink
ENGCOM-2031: [Backport] #14063 - Wrong invoice prefix in multistore s…
Browse files Browse the repository at this point in the history
…etup due to default stor… #15821

 - Merge Pull Request #15821 from sanjay-wagento/magento2:2.1-develop-PR-port-15332
 - Merged commits:
   1. 2fcaf53
  • Loading branch information
magento-engcom-team committed Jun 18, 2018
2 parents d2494a8 + 2fcaf53 commit b82653b
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,15 @@ protected function _beforeSave(\Magento\Framework\Model\AbstractModel $object)
{
/** @var \Magento\Sales\Model\AbstractModel $object */
if ($object instanceof EntityInterface && $object->getIncrementId() == null) {
$store = $object->getStore();
$storeId = $store->getId();
if ($storeId === null) {
$storeId = $store->getGroup()->getDefaultStoreId();
}
$object->setIncrementId(
$this->sequenceManager->getSequence(
$object->getEntityType(),
$object->getStore()->getGroup()->getDefaultStoreId()
$storeId
)->getNextValue()
);
}
Expand Down

0 comments on commit b82653b

Please sign in to comment.