def METHOD_NAME(self):
    for partner in self:
        if partner.l10n_ro_vat_number:
            history = self.env["l10n.ro.res.partner.anaf"].search(
                [("vat", "=", partner.l10n_ro_vat_number)]
            )
            partner.l10n_ro_anaf_history = [(6, 0, [line.id for line in history])]
        else:
            partner.l10n_ro_anaf_history = [(6, 0, [])]