I want to clean up my sales.orders regualary (e-Commerce in odoo 11).
So I wrote a script, which should delete 200 rows per execution:
dateTime = datetime.datetime.now() - datetime.timedelta(hours = 96)
emptyOffers = env['sale.order'].search(
[
('create_date', '<', dateTime.strftime('%Y-%m-%d %H:%M:%S')),
('amount_total', '=', '0')
]
)
i = 0;
for emptyOffer in emptyOffers:
emptyOffer.unlink()
raise Warning('unlink one') # <= Debug code
i = i + 1;
if i > 200:
break;
Everything works fine until "...unlink()". Then the script just runs into timeout => No message, No Exception, Not a single row was deleted
Does anyone know, what i missed?