The problem is cache. Added context.no_cache = 1. Thanks to @treeem for the solution mentioned in Frappe context not changing. Cache problem
I changed the .py to
import frappe
from frappe.utils.data import ceil
def get_context(context):
**********
**********
context.no_cache = 1
return context