Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
1 Rispondi
7378 Visualizzazioni

Hi,

I am trying to import data to a form which is apparently the below

  • Seq No (sequence number field - am generating with openerp sequence)
  • Customer (Customer Reference field)
  • Services (one 2 many field)
    • contract Start Date
    • contract End Date

Data i import is something like this

Customer    Contract Start Date     Contract End Date

 ABC            13/02/12                12/05/14
                12/05/14                14/04/16
                12/08/16                14/06/18
 XYZ            15/04/12                18/08/14
                11/05/14                19/05/16

Now 2 records are generated in my form with sub records, but the id generated for first record is R001 and second is R004. i.e for every record of import an id is generated (but not used). so there's an interval. But this is the method i've identified to import form values with one2many.

Now i need to understand the below - Am i doing things right, or is there any other way to import one2many data - Is there a way to organize my sequence number while import - And last one(crooked) is that i can go to database update all values to a sequence. And when i create a form field manually the last id+1 generated by openerp is taken. So i need to update the sequence number to start with the last values + 1 that i've changed in the database.

Kindly guide me to do the necessary. And feel free to update the post if it's not that clear. Thanks for your time.

Avatar
Abbandona
Risposta migliore

try to make a function for your sequence sample is this:

In your .py

def create(self, cr, uid, values, context=None): values['seq'] = self.pool.get('ir.sequence').get(cr, uid, 'change.order') return super(change_order, self).create(cr, uid, values, context=context)

and in your .xml

     <record model="ir.sequence.type" id="seq_type_project">
        <field name="name">Change Order</field>
        <field name="code">change.order</field>
    </record>
    <record model="ir.sequence" id="seq_change_order">
        <field name="name">Change Order</field>
        <field name="code">change.order</field>
        <field name="prefix">CORBOM</field>
        <field name="padding">3</field>
    </record>

Hope it will help :)

Avatar
Abbandona
Autore

Thanks for your answer friend, i've already done that. My prob is with importing now. The records imported is having intervals between sequence number due to one2many records. How to avoid that is my question. Please guide me. Thank You.

Post correlati Risposte Visualizzazioni Attività
1
nov 24
1723
4
nov 18
8289
0
mar 15
4326
1
mar 15
4489
1
feb 24
2330