Hi, @Pararera, I have applied custom script on Sales Invoice based selection of company.
Please make series field Read only from customize sales invoice

frappe.ui.form.on("Sales Invoice", {
company: cur_frm.cscript.company = function(doc, cdt, cdn){
//function(frm){
// this function is called when the value of company is changed.
if(cur_frm.doc.company=== 'Demo India Pvt. Ltd.'){
cur_frm.set_value("naming_series","PO/ABC/.###");
}
else if(cur_frm.doc.company == 'Test India Pvt. Ltd.'){
cur_frm.set_value("naming_series","PO/XYZ/.###");
}
}
});
Hope this will help. Thanks -Suresh