Make invoice reference not readonly for posted invoices

Currently the invoice reference is only writable when the invoice is in draft state.
On the other hand, the sale reference is writable on all states.

Why is such difference in both fields as they have the same meaning?

We use the invoice reference to enter the supplier invoice number, as this field is number when send to the Spanish electronic Invoice

We’ve found some issues as the users sometimes miss to set such field before posting the invoice and they can not edit them after posting the invoice.

I’m wondering if it makes sense to allow to update the reference on posted or paid invoices. What do you think? I’m not sure if there is any reason to prevent it.

Why not for supplier invoice but for customer invoice as the reference is displayed on the report, it can not be updated except maybe for these case Allow admin to refresh invoice report cache (!302) · Merge requests · Tryton / Tryton · GitLab

Do not understand what do you mean in customer invoice case. Should we make editable or we should only make editable with the linked merged request? Or we should keep it as readonly?

I do not know but a valid solution should be found for the report cache.

We made the reference field required for supplier invoices if they are in posted state. Every supplier invoice should have a reference set. This way you can prevent that somebody is missing to enter it.

So we keep it readonly for customer invoices if the report cache is the reason why it is readonly.

Indeed this will be a good solution which will prevent the issue. I can not imagine any case where the supplier invoice should not have a reference, as you always have the supplier number to be used as reference.

Users may want to fill a supplier invoice for something that is not actually an invoice but have same behavior. So I do not think we must have such requirement in standard.

If it has the same behaviour as an invoice won’t it have a number to identify it? In such chase the reference field can be also filled with the number so it is not an issue to make it required.

Could you provide an example of a case where it is not possible to provide a reference for the invoice?

For example an employee expense.
But that’s not the point, we should not make required a field that is not needed to be required by the process.

1 Like

An employee expense should not be booked using an invoice but using directly an account move.
You can have a move template for that.
Also we have Expense reimbursement. Even on the first post of this topic you say:

Why it is not required? When you book an invoice you must identify it, so this means including the supplier invoice number on the reference. Otherwise it is not possible to identify exactly the invoice.

Unfortunately I found one (weak) argument to not make it required. One could argument that the reference is not need if the document that is the base for the supplier invoice is attached to the record as an attachment. On the other hand IMHO it may be still good practice to enter a reference even for this case.

There are also the self-invoice case, where the customer create the invoice for the supplier.

Indeed it will prevent to create and post invoice for commissions.

Which is the problem with self invoice? The customer creates the invoice and this invoice will have a number, so this number can be used as reference when encoded as supplier invoice.

Do not understand. If the commissionrt is a supplier and should invoice you, you can not know the invoice date in advance. So you can not post it until the final invoice is send by the commissioner with the right invoice date.

Of course but the binary content is not searchable, so you can not identify the invoice if you do not see the reference. Also, we can not guarantee that an attachment is the document representing the invoice, one can attach any document that is not unrelated.

Indeed I recomend to everyone to do both process: Set the reference and attach the invoice as attachment. But the attachment may be a mather of taste.

We do usually as @timitos and define reference field required for posting supplier invoices.

Note that in Spain the reference cannot be modified for supplier posted invoices because it is the identification of invoice in SII web portal, so if reference changes the invoice is manage as a new different invoice.

For me this feature is not really support yet. The invoice should be marked as a self billing case as the invoice report of an outgoing invoice must not be used and the invoice report of the customer needs to be used/stored instead. And if this marker has been added the states for the reference field could be adapted for these cases.

On the legal level sending out the local invoice report for such a self billing case could result in an additional sales tax demand as there would be two documents that declare taxes then.

I will like to implement a solution for this issue for the upcoming 7.0 series.

TBH, for me the best solution is to make the field required for the supplier invoices, but I can live without that if we allow to update it after the invoice is posted.

Can we agree on which should be the right behaviour so I can implement it? @ced you have the last word here, could you take an decision on what needs to be implemented? There is no hurry for now.

Thanks in advance!

The reference field can be made editable for any state but only if the invoice report is not cached.
When the feature to refresh cache is implemented it may be good to be able to change its content during the procedure.
The reference can not be made required (for self-invoice like commission).

I just filled Allow to edit suplier invoices references on non draft state (!554) · Merge requests · Tryton / Tryton · GitLab which implements this!