Hello,
I am trying to write my own calculation logic for the items in an invoice. I've found this official Espo documentation: https://docs.espocrm.com/development...-calculations/
which I've followed. The implementation of the serverside calculation according to the documentation works fine. However without the client side calculation, the user would have to save the edited items everytime to see an update in the amount.
A bit of background:
for an invoice there are two different types of items: a normal item and a maintenance-item. for an invoice item ive created a custom field called "isMaintenance". if this custom boolean field is ticket, the item does not count towards the total amount, but towards the "shipping" amount (since we dont need the shipping field, I've repurposed it to hold the total amount of all the maintenance items.)
the grand total amount then is the total amount + maintenance (shipping)
now everytime I change a price/quantity of an item, the "normal" amount gets recalculated on client side. however the shipping/maintenance amount does not get calculated, probably because it was not meant to be based off of items.
Thats what i was trying to fix with a custom calculaion-handler. I've wrote a handler, referenced it in the ...clientDef/Invoice.json file but only get the following error in my browser console:
"Uncaught (in promise) Error: Could not fetch asset 'client/custom/modules/sales/lib/transpiled/src/invoice-calculation-handler.js?r=1756810231'."
It seems that the calculation-handler does not get transpiled. However I already wrote 2 dynamic-custom-handler which are in the same directory and they are working fine, so I assume the transpilation for them must've worked.
Any help towards that problem would be appreciated
I am trying to write my own calculation logic for the items in an invoice. I've found this official Espo documentation: https://docs.espocrm.com/development...-calculations/
which I've followed. The implementation of the serverside calculation according to the documentation works fine. However without the client side calculation, the user would have to save the edited items everytime to see an update in the amount.
A bit of background:
for an invoice there are two different types of items: a normal item and a maintenance-item. for an invoice item ive created a custom field called "isMaintenance". if this custom boolean field is ticket, the item does not count towards the total amount, but towards the "shipping" amount (since we dont need the shipping field, I've repurposed it to hold the total amount of all the maintenance items.)
the grand total amount then is the total amount + maintenance (shipping)
now everytime I change a price/quantity of an item, the "normal" amount gets recalculated on client side. however the shipping/maintenance amount does not get calculated, probably because it was not meant to be based off of items.
Thats what i was trying to fix with a custom calculaion-handler. I've wrote a handler, referenced it in the ...clientDef/Invoice.json file but only get the following error in my browser console:
"Uncaught (in promise) Error: Could not fetch asset 'client/custom/modules/sales/lib/transpiled/src/invoice-calculation-handler.js?r=1756810231'."
It seems that the calculation-handler does not get transpiled. However I already wrote 2 dynamic-custom-handler which are in the same directory and they are working fine, so I assume the transpilation for them must've worked.
Any help towards that problem would be appreciated
