Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
3 Risposte
11025 Visualizzazioni

Does anyone here knows how to change the name of a sequential???


Avatar
Abbandona
Risposta migliore

You can change the formatting of any sequence.

This includes Purchase Orders, Sales Orders, Delivery Orders, Manufacturing Orders, Invoices, etc.

Do this via the menu sequence  Settings -> Technical -> Sequences and Identifiers -> Sequences

For Invoices via the Sales Journal, you will see the following when you open the relevant record:

You can see that the only things you can incorporate into a sequence this way are:

  1. Fixed or date/time based prefix characters
  2. Fixed or date/time based suffix characters
  3. The total number of numerals in the number (padding) ie: 001 or 000001
  4. The increment used for the next number in the sequence
  5. The next number used for the numeric part of the sequence
  6. Whether to allow gaps in the sequence

You can see at the bottom the format for various components of the data and time.

 

Avatar
Abbandona
Risposta migliore

For this we only need the  sequence.xml and __openerp__.py files. 

example code : 

<?xml version="1.0" encoding="utf-8"?>
<openerp>
    <data noupdate="1">

        <!-- Sequences for crm.lead -->
     <!--    <record id="seq_type_lead_no" model="ir.sequence.type">
            <field name="name">Leadnumber</field>
           <field name="code">crm.lead</field> 
        </record> -->

        <record id="seq_lead_no" model="ir.sequence">
            <field name="name">Leadnumber</field>
            <field name="code">crm.lead</field>
            <field name="prefix">LN</field>
            <field name="padding">3</field>
            <field name="company_id" eval="False"/>
        </record>

    </data>
</openerp>

For changing MO to JO,first we have to delete the MO code from the sequences ( Settings -> Technical -> Sequences & Identifiers ->Sequences )

Avatar
Abbandona
Autore

thanks dimple:)

Autore

thanks dimple:)

Autore Risposta migliore

My problem got solved by adding this code in my additional .xml then change the prefix from MO to JO. In my .py I add the _default for my fields that will going to use sequence:

.xml:

 <record id="mrp.sequence_mrp_prod_type" model="ir.sequence.type">
            <field name="name">Production order</field>
            <field name="code">mrp.production</field>
        </record>
        
        <record id="mrp.sequence_mrp_prod" model="ir.sequence">
            <field name="name">Production order</field>
            <field name="code">mrp.production</field>
            <field name="prefix">JO/</field>
            <field name="padding">5</field>
            <field name="number_next">1</field>
            <field name="number_increment">1</field>
        </record>

.py:

  _defaults ={
                'name': lambda x, y, z, c: x.pool.get('ir.sequence').get(y, z, 'mrp.production') or '/',
                }
       

 

Avatar
Abbandona