How we can override item_code on change event on purchase invoice?

Example: I am on purchase invoice form and we need to change ‘price_list_rate’ calculation.
frappe.ui.form.on(‘Purchase Invoice Item’, {
item_code: function(frm, cdt, cdn) {
item = locals[cdt][cdn];
item_code = item.item_code;
vat = 5
new_price_list_rate = item.price_list_rate - vat
frappe.model.set_value(cdt, cdn, “price_list_rate”, new_price_list_rate);
This changes is override due to “price_list_rate” trigger event.

How we can do that?

Hi there. Did you find a solution to make custom price calculations?