A custom function creating invoice in zoho books, from zoho crm deals is not working anymore

A custom function creating invoice in zoho books, from zoho crm deals is not working anymore

Hello everyone,

We had made a custom function creating an invoice in zoho books, from the deals selected in zoho crm deals.
It was working perfectly fine, but all of a sudden, it is not working anymore.

Does anyone have an idea of the problem ?
I re-synchronized the data between books and crm to be sure it was okay. 
The organisation ID is okay.
The only difference now, is that we deleted the superadmin user and we replaced him by an other superadmin user. May it be the source of the problem ? 

Here is the code :

organization_id = "XXXX";
deals_id_list = deals_list.toList("|||");
return_message_all = "";
line_items = List();
for each  deals_id in deals_id_list
{
item_map = Map();
deal = zoho.crm.getRecordById("Deals",deals_id);
if(deal.get("Account_Name") == "null")
{
return "Nom de compte inexistant";
}
crm_customer_id = deal.get("Account_Name").get("id");
info crm_customer_id;
searchParam = {"zcrm_account_id":crm_customer_id};
customer = zoho.books.getRecords("Contacts",organization_id,searchParam,"iprovebooksconnect").get("contacts");
info customer;
customer_id = customer.toMap().get("contact_id");
crm_item_id = deal.get("Prestation_vendue").get("id").toString();
searchParam2 = {"zcrm_product_id":crm_item_id};
item = zoho.books.getRecords("Items",organization_id,searchParam2,"iprovebooksconnect").get("items");
info item;
item_id = item.toMap().get("item_id");
item_name = item.toMap().get("name");
item_map.put("item_id",item_id);
item_map.put("description",deal.get("Deal_Name"));
item_map.put("quantity",deal.get("Quantit_produits_h"));
line_items.add(item_map);
return_message_all = return_message_all + item_name + " ajouté" + " - ";
}
facture = Map();
facture.put("customer_id",customer_id);
facture.put("line_items",line_items);
invoice = zoho.books.createRecord("Invoices",organization_id,facture,"iprovebooksconnect");
info invoice;
invoice_nb = invoice.get("invoice").get("invoice_number");
for each  deals_id in deals_id_list
{
data = Map();
data.put("Stage","Facturé");
data.put("Numéro_de_facture_associé",invoice_nb);
data.put("Date_de_facturation",today);
data.put("Etat_de_l_affaire","Terminé");
zoho.crm.updateRecord("Deals",deals_id,data);
}
return_message_all = return_message_all + "Facture créée";
return return_message_all;


Thanks a lot in advance for the help,