I am trying to update field on submit event ,
i have used following ways to set the value
def generate_pin(PR, method):
code=‘’.join(random.SystemRandom().choice(string.ascii_uppercase + string.digits) for _ in range(6))
PR.pin=code
**OR**
PR.update({"pin":code})
PR stands for Purchase Receipt document