batch script for location update

 avatar
user_0223141589
python
a year ago
379 B
6
Indexable
write_date = "2023-XX-XX 00:00:00"
users = []

locations = env['stock.location'].search([('active', '=', True),('write_date', '>=', write_date),('write_uid', 'in', users)])

total_count = len(locations)

BATCH_SIZE = 100

while locations:
    to_works = locations[:BATCH_SIZE]
    to_works.with_delay()._onchange_zip_location_type_id()    

    locations = locations[BATCH_SIZE:]