Include payment

How do I make the include payment check box ticked when making an invoice from a sales order?
Have added 1 to the default value of is pos that works for new invoices but when I make an invoice from an order it the is pos is not checked automatically

You can write a custom script for this:

  • Its simplest version could set this on validate event irrespective of any condition. Useful only if you don’t deal in credit transactions.

  • Another version could first check if the first item of the items table has a sales_order field which is not empty.

  • You can also try to see if it works on the refresh event.

You have an example? Have searched for on example of a custom script haven’t found one. Would you mind assisting me with an example?

https://erpnext.org/docs/user/manual/en/customize-erpnext/custom-scripts/custom-script-examples