Naming table field by script

I’m trying name my table fields by scripting, I tried do this by erpnext interface but not works at all…
Tried do with append too, but this require the anothers values of table and i think that’s not the best way to do this…

Follow the ideia:

Table picture:

JS:

frappe.ui.form.on("Purchase Invoice", "after_save", function(frm) {
	$.each(frm.doc.parcelas || [], function(i, d) {
		//Naming parcelas
		frappe.call({
			method: "financeiro.financeiro.doctype.titulos.titulos.naming_parcelas",
			args: {
				doc_nome: frm.doc.name,
			},
			callback: function(r){}
		});
	});
});

PY:

@frappe.whitelist()
def naming_parcelas(doc_nome):
	purchase_invoice = frappe.get_doc("Purchase Invoice", doc_nome)
	purchase_invoice.parcelas[
		'naming_series' = 'PARC-'
	]
    purchase_invoice.save()
	return

What is your use case? have you tried this with the autoname field on doctype?

Check this,

I tried it, it even counts in the naming series page, but it does not show the number in the document, it only shows PAG-TIT-

Any help please?

In autoname field set PAG-TIT-.#######.

Trying now

Not worked… i have another idea, i’ll do it and post here if that works
Thanks at all @saurabh6790