Magento2: invoice/order/creditmemo adjusting increment id length issue

Created on 8 Jul 2016  路  4Comments  路  Source: magento/magento2

When creating a order/invoice/creditmemo, the increment id length is always: prefix + 9 numbers.

The default pattern is now always used, when creating a order/invoice/creditmemo in
vendor/magento/module-sales-sequence/Model/Sequence.php::19
const DEFAULT_PATTERN = "%s%'.09d%s";

When adjusting the 'increment_pad_length' column value in the table 'eav_entity_type' to 6, i expected the increment id's to change to the format: prefix + 6 numbers.

example:
prefix = 7
id = 8

Expected increment id = 7000008
Actually increment id = 7000000008

Format is not valid

Most helpful comment

@basselalaraaj you can create a di.xml for your shop defining the pattern for your customer. For instance:

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <type name="Magento\Framework\DB\Sequence\SequenceInterface">
        <arguments>
            <argument name="pattern" xsi:type="string">%s%'.04d%s</argument>
        </arguments>
    </type>
</config>

As it says in the constant name of \Magento\SalesSequence\Model\Sequence::DEFAULT_PATTERN it is only a default value. You can replace it with dependency injection.

All 4 comments

@basselalaraaj
Thank you for reporting!
To allow us to research the issue, please, provide description according to the Issue reporting guidelines: with steps to reproduce, actual result and expected result.
Magento version
Please, provide the used version. If the problem is actual for a specific tag, please, specify it and be sure that the latest update was used.

According to contributor guide, tickets without response for two weeks should be closed.
Please feel free to reopen if it's needed.

@basselalaraaj you can create a di.xml for your shop defining the pattern for your customer. For instance:

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <type name="Magento\Framework\DB\Sequence\SequenceInterface">
        <arguments>
            <argument name="pattern" xsi:type="string">%s%'.04d%s</argument>
        </arguments>
    </type>
</config>

As it says in the constant name of \Magento\SalesSequence\Model\Sequence::DEFAULT_PATTERN it is only a default value. You can replace it with dependency injection.

@andimov you can remove the needs update label.

Was this page helpful?
0 / 5 - 0 ratings