def METHOD_NAME(self):
    """Search for possible RMA refunds and link them to the delivery note. We
    don't want to link their delivery note lines as that would unbalance the
    qtys to invoice wich isn't correct for this case"""
    super().METHOD_NAME()
    for delivery_note in self:
        refunds = delivery_note.sudo().rma_ids.mapped("refund_id")
        if not refunds:
            continue
        delivery_note.write(
            {
                "invoice_ids": delivery_note.invoice_ids + refunds,
                "invoice_count": len(delivery_note.invoice_ids),
            }
        )