Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
2 ตอบกลับ
17084 มุมมอง

Hi,

I'm trying to change the sequences from delivery orders, invoices, refunds . It's easy by the interface, but I need this changes in code for all my installations to have all the same sequence, and to avoid to configure everything in each installation and have the risk to forget of something.

For the example of account.invoice, I need to change the padding, and the prefix from :

            <field name="prefix">SAJ/%(year)s/</field>
            <field name="padding">4</field>

to :

            <field name="prefix">SAJ/%(year)s</field>
            <field name="padding">6</field>

The prefix without the last "/" and instead of "4" in padding have "6".

I want to do this configurations in my new module but I don't know how to change this to parameters from existing sequences?

Thanks in advance!

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

On this case if you want to overwrite it you have to follow the following steps:

  1. add account to dependencies on your module (__openerp__.py)
  2. Look for the original code, in this case: (/account/data/account_data.xml)
  3. Copy the entire record that you want to change and paste it on your module
  4. Add the module name of the module account on your module (change sequence_sale_journal -> account.sequence_sale_journal)
  5. Modify what you need to modify
  6. Install your module

Account module

 <record id="sequence_sale_journal"
 model="ir.sequence">
             <field name="name">Account Default Sales Journal</field>
             <field eval="3" name="padding"/>
             <field name="prefix">SAJ/%(year)s/</field>
         </record>

Your module

<record id="account.sequence_sale_journal" model="ir.sequence">
            <field name="name">Account Default Sales Journal</field>
            <field eval="6" name="padding"/>
            <field name="prefix">SAJ/%(year)s/</field>
        </record>
อวตาร
ละทิ้ง
ผู้เขียน

Doesn't work! I did everything that you say but the first invoice has this : SAJ/2013/0001.

Did you create the invoice before installing my code?

ผู้เขียน

No! First I install the module then create the invoice, but sequences are still the same way.

It works when the module is first installed, not if I update it later on

คำตอบที่ดีที่สุด

Just simply

Go to Setting->Technical->Sequence and Identifiers->Sequences

Find Sales Order

อวตาร
ละทิ้ง
ผู้เขียน

I want by programing...

Related Posts ตอบกลับ มุมมอง กิจกรรม
3
ธ.ค. 23
7198
0
มิ.ย. 15
5432
3
มี.ค. 15
8071
0
มิ.ย. 21
1779
0
มี.ค. 25
1065