You can add the standard function IsCreditNote in the field configuration of your app.
Use this function to check whether the document is an invoice or a credit memo based on the net amount of the line.
If the amount on the line is negative, it is a credit memo. If the amount is positive, it is an invoice.
The IsCreditNote function is based on the following logic:
-
If it is a credit memo:
-
If the amount is greater than or equal to 0: true
-
Otherwise: false
-
-
If it is something other than a credit memo:
-
If the amount is less than 0: true
-
Otherwise: false
-