How to run a client script when a field is updated thru list view

I am trying to run a client script in Serial Number doctype to update the warranty expiry date based on the selection of the warranty period in months.

It is very difficult to update each and every serial no. docs. What is the code to be used to run when the field is updated in list view.

Now using

frappe.ui.form.on(‘Serial No’, {
refresh(frm) {
function compute(doc, cdt, cdn){