This commit will also ensure that the document is ready before adding the debug class. Part-of: odoo/odoo#84314