Auto Update Fields in Recurring Invoices

Hey guys,

maybe someone has an idea how to manage this :slight_smile: I need recurring invoices with two items (“Konzessionen” and “Stimmen”) where the quantity of the items is based on fields in the Customer. Manually it`s no problem like so (other Triggers are working too):

frappe.ui.form.on(‘Sales Invoice’, {
updateForm: function (frm){
frappe.call({
method: “frappe.client.get_value”,
args: {“doctype”: “Customer”, “filters”: {“name”: frm.doc.customer},
“fieldname”: [‘konzessionen’, ‘stimmen’]},
callback: function® {
var stimmen = r.message.stimmen;
var konzessionen = r.message.konzessionen
$.each(frm.doc.items || [], function(i, d) {
if (d.item_code == 1) {
frappe.model.set_value(d.doctype, d.name, “qty”, konzessionen )
} else if (d.item_code == 2) {
frappe.model.set_value(d.doctype, d.name, “qty”, stimmen )
}

    	});
    }
});
},
refresh(frm) {
   frm.events.updateForm(frm);
},

})

But when the invoices are automatically created as recurring invoices the needed fields are not updated. I tried all the Triggers from

but no one is working: the recurring invoices are just plain copies of the original, no fields updated.
Any idea how to get this working? Some trigger to update fields in recurring invoices before safed as drafts?

Thanks a lot!!!

All the best
Maik