Dear Nicolas
Your requirement is very similar to one of mines (mine's a bit more general). I've been asked to have payment terms that works as follows:
With
X->Number of days of delay
N->A day of month
Candidate date=current date+X days
Final date= The next Nth day of the month that follows candidate date
For example, 30 days, on the 15th
X->30
N->15
This needs to work on the payment schedule level, so you could have 50%, 30 days, on the 15th, and 50%, 60 days, on the 15th
After investigating the functionality present in iDempiere, I came to the conclusion that none of the available options allowed me to fulfill my requirements. The fixed due date doesn't take a number of days as an argument for the calculation, only a month offset (so, it's "in two months, on the Nth", not "in 60 days, on the Nth", and on top of that, AFAIK, doesn't work for payments with payment schedules.
I decided to create a module, but I found it's non-trivial to do so. The relevant code for schedules is in the MInvoicePathSchedule class, under the MInvoicePaySchedule (MInvoice invoice, MPaySchedule paySchedule) constructor. However, it is not possible to override this constructor via a model factory, as you can only override the standard constructors defined in IModelFactory interface. In the end, I'm trying to implement the functionality via an EventHandler, adjusting the due date in the PO_AFTER_NEW event. My implementation is unfinished, and needs some refactoring anyway if it's going to be used outside of the company I work for (We're end users, not implementors, we simply decided that iDempiere was the most suitable alternative for our needs, and proceeded to adapt it where necessary), but I would be happy to point you to how I did it if I ever get it working to my satisfaction. If you solve the problem before I do, I would appreciate if you would share how you did it.