def METHOD_NAME(self, delayed_job, attachment):
    queue_job = self.env["queue.job"].search(
        [("uuid", "=", delayed_job.uuid)], limit=1
    )
    attachment.write({"res_model": "queue.job", "res_id": queue_job.id})