تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
3 الردود
10982 أدوات العرض

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


الصورة الرمزية
إهمال
أفضل إجابة

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.

 

الصورة الرمزية
إهمال
أفضل إجابة

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 )

الصورة الرمزية
إهمال
الكاتب

thanks dimple:)

الكاتب

thanks dimple:)

الكاتب أفضل إجابة

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 '/',
                }
       

 

الصورة الرمزية
إهمال