Payment terms based on shipment (or another) date

Actually maturity dates on invoices are computed using payment term and based on invoice date. But we have customers who want to compute it based on shipment date. This is normally the case when the invoice is delayed a lot with respect shipment.
I’ve been reviewing code and it will not be difficult to add a custom module to implement it, but imho it could be interesting to add on core.

Opinions?

In case multiple shipments grouped in a invoice what is considered shipment date?

So IIUC you are proposing to adding a select box to allow the user to choose the date used for computing the deltas. By default this checkbox will only have the invoice date but when the account_inovice_stock module is activated it will have an extra option to use the shipment date.

Normally the maximum [1]. This matches with FechaOperacion of Spain SII.
But could exists two options (max and min).

That is.

I do not see the point. If you base the invoicing on the shipment than it means that you create the invoice at the time the shipment is done so the invoice date will be the same as the shipment date.

The process with supplier is the following:

  • payment terms are negotiated 30d after receive items.
  • the supplier sends items and customer receive it.
  • the customer confirms to supplier the products received, the quantities and in some cases the prices to be invoiced.
  • after that supplier post and send the invoice. Note that this action and the previous one can be delayed many days/weeks [1].
  • the customer receive the invoice and post it defining in “invoice_date” the date defined on supplier invoice.

[1] In Spain there is a legal limit of 1month.

So it is not related at all with the shipment but just the invoice date. Everything is there in Tryton to support this.

sorry but I don’t see how.

As you can confirm the reception of the invoice only when the customer confirm it. You just have to post the invoice at this confirmation. This way the invoice date correspond to the reception date.

But in some cases it could happen that the invoice date can not be set in the past if other invoices have been posted with a date after. So it may be useful to have an optional field payment_term_date which is used to compute the terms if filled instead of the invoice date. But we should probably have a warning in case this date creates a term in the past.

The examples is about a supplier invoice. In this case we cannot define a invoice date different of the given by supplier.

Some kind of configuration in payment term will be interesting as described @pokoli to set “payment_term_date” when creating an invoice. In this way users can define terms “30d after invoice date” or “30d after shipment date” on parties.

It does not matter both cases work the same.

I do not agree because it makes no sense. The invoice can only rely on itself to compute the terms. “After shipment date” means nothing for an invoice.

There should be a mechanism to propose users the “payment_term_date”. IMHO The feature is incomplete if the have to input date manually on each invoice of a Party with this kind of negotiated payment term.

You can set the payment_term_date with the last effective_date of the related shipments once posting the invoice if not set.

That’s clear … but how to determine when set date or not with last shipment effective_date?

This is something you should tell us. How is this negotiated in your case? For each customer (independently of the payment term used) or depening on the payment term?

Indeed I did it a couple of times … :thinking:

It is depending on payment term. For this reason I mentioned examples such as “30d after invoice date” or “30d after shipment date” (theses are descriptive names for payment terms).

But what happens if a customer uses a shorter payment term for a specific sale? Which date should be used? The invoice or the shipment?

I mean if you agree to always use the shipment date no mather the payment term it should be something defined on the party but if you agree to use a diferent date depending on the term it should be defined on the payment term.

I think the most flexible option is define it on the payment term.

For me there is an issue in the division of responsibility. The payment term can not be responsible of the starting date of its computation because it does not have any link to other document. And more over invoices are not always related to any shipment.
So for me it will be good to have in standard a payment_term_date on invoice which override the default starting date. This will also solve a common issue for supplier invoice which is that companies do not always now how the term is computed and so this will allow to just fill the term date (without any payment term).
By default in standard the payment_term_date is empty but it is easily to customize the purchase or sale to fill it with whatever people want.
But nothing more should be added in standard.

I’ve filled Issue 9956: Allow to define the date used to compute payment term date - Tryton issue tracker with an implementation of this feature.