Skip to content

Commit

Permalink
Merge pull request #14 from vgelani/2.1-develop-PR-port-15332
Browse files Browse the repository at this point in the history
[Backport] magento#14063 - Wrong invoice prefix in multistore setup due to default stor…
  • Loading branch information
gelanivishal authored Jun 1, 2018
2 parents e55cdca + c308795 commit 634b957
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 634b957

Please sign in to comment.