in this blog we will explain example to generate random number of 4 digits in odoo so let us start
- First we have to import choice class from random package as bellow
from random import choice
- Then we have to import digits class from string package as bellow
from string import digits
- Last we can use the function bellow that will return the random number
def _default_random_pin(self):
return ("".join(choice(digits) for i in range(4)))
No comments:
Post a Comment