This question has been flagged
1 Reply
3885 Views

I am starting to develop a new module and created the corresponding sequence for each record. But I need to create separate sequences for the module for each company created. Currently only one sequence is created and for the main company. The following is the code:
XML

<data noupdate="1">
        <record id="sequence_letter" model="ir.sequence">
            <field name="name">Cite</field>
            <field name="code">letter.sequence</field>
            <field name="prefix">CITE.:</field>
            <field name="suffix">/%(y)s</field>
            <field name="padding">4</field>
            <field name="number_next">1</field>
            <field name="number_increment">1</field>
        </record>
    </data>

Avatar
Discard
Best Answer

Try adding the following in your record definition. However, for this you will need to create the company through the module code to be able to reference the same external id.

<field name="company_id" ref="EXTERNAL_ID_OF_THE_COMPANY"/>

for example,

<field name="company_id" ref="base.main_company"/>
Avatar
Discard
Author

Hello Paresh.

This shape would create an individual sequence for a company. By default the sequences are created for the main company. In this case I would like a form of sequencing for each company created and to be created.

Hi Franklin: I'm sorry, I didn't understand your comment. Please could you explain it differently.