Skip to Content
Menu
This question has been flagged
1 Reply
2140 Views

I have two fields Rayon(String) and  Case( String)  in the same form :

i want in every new record make this algorithm :


Record 1 : Rayon : R1  | Casier : C1

Record 2 : Rayon : R1  | Casier C2 

....

Record 8 : Rayon : R1  | Casier C8 

Record 9 : Rayon : R2  | Casier C1

When we have C8 in Casier in the record we should increment Rayon and restart from C1 for Casier field.


How to this in odoo 10


Regards,




Avatar
Discard
Best Answer

Hello medmars,

rayon = ""
case = ""
inc = 0
for i in range(1,10):
  if i == 9:
   inc += 1
   i = 1
  rayon = "R" + str(inc)
  case = "C" + str(i)
You can use logic like this to generate that type of range..
Avatar
Discard
Author

Hi Hardik thanks for your comment,

Can you please translate this logic to the an odoo function in every new record created from my form ( i'm new in odoo so i will be very grateful if you can help for this)

i'm using odoo 10.

King Regards,