Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Put your model and field name here.
- model_name = 'account.invoice'
- field_name = 'residual'
- # Do not change anything below this line.
- model = env[model_name]
- offset = 0
- page_size = 100
- set = model.search([], limit=page_size, offset=offset, order='id asc')
- count = model.search_count([])
- while len(set):
- print('Processed: %i/%i' % (offset, count))
- env.add_todo(model._fields[field_name], set)
- model.recompute()
- # Clear the cache to avoid hitting memory limit.
- env.clear()
- offset += page_size
- env.cr.commit()
- set = model.search([], limit=page_size, offset=offset, order='id asc')
- print('Done')
Add Comment
Please, Sign In to add comment