def METHOD_NAME(self):
    conf = self.env["res.config.settings"].create(
        {"include_ubl_attachment_in_invoice_email": True}
    )
    conf.set_values()
    composer = (
        self.env["mail.compose.message"]
        .with_context(self.composer_ctx)
        .create(self.composer_vals)
    )
    self.assertFalse(composer.attachment_ids)
    composer.with_context(
        force_report_rendering=True
    ).onchange_template_id_wrapper()
    self.assertTrue(composer.attachment_ids)
    self.assertEqual(len(composer.attachment_ids), 1)