Skip to Content
Menu
This question has been flagged
2 Replies
2470 Views
 

How to increment the sequence in every two records

for ex :

     Record 1 : sequence : 1
     Record 2 : sequence : 1(the same number)
     Record 3 : sequence : 2
     Record 4 : sequence : 2(the same number)

What is the best condition that i can use it to achieve this result in odoo 10

Regards

Avatar
Discard
Best Answer

if( i % 2 == 0): 

     count +=1

# this mean if i is even number (in 2 , 4 , 6 ,.... will be True)

Avatar
Discard
Best Answer

Hai medmars, 
you do like this,

seq = env['ir.sequence'].search([('code', '=', code)])
if (seq % 2 == 1)
     number = (seq / 2) + 1
else:
     number = (seq/2)

i think it will help you,

Avatar
Discard