Community mailing list archives

Re: Invoice can be deleted but not recreated

Eficent Business and IT Consulting Services, S.L.
- 04/22/2015 11:57:06

On Wed, Apr 22, 2015 at 5:48 PM, Dominique Chabord <> wrote:
2015-04-22 17:18 GMT+02:00 Jordi Ballester Alomar <>:
> Well, but that's a very bad think, because the system is letting you do
> something for which there's no reversal possible.

yes, either I miss something in Odoo since ten years or we are in this
bad case. Not sure anyway I fully understodd Eva's point.
> What I mean is, if I create an standalone invoice and then I delete it.

> There's a possible reversal or restoration to the previous state, which is
> to create the invoice again.

This is the essence of a draft. Good so far.

> But if I create an invoice from an approved purchase order, and I delete the
> invoice, that order is left in a status "Purchase Order" for which I can't
> do anything. I cannot restore the previous state in any possible way.

Because the "draft" is not a draft. It is a suggestion by the workflow
managed like draft by Odoo.
Not only for invoices.

> These situations should be prevented. Possibly by making sure that an
> invoice cannot be deleted once it has been referenced.

This would be a deep change in Odoo. What if you just modify the
invoice ? The basic workflow is at stake, I think.
Not sure why it would be a big change. When the user attempts to delete, the system checks if there's a PO that references this invoice. If there is, you stop the user from doing so. 

And then you can apply this same behavior for stock moves. That is, if a stock move references an invoice.

Probably there are other processes where this can occur. But it seems to me that this one can be fixed with a single module... or I'm missing something here.
> I'm not sure if that's a bug.

If I make no mistake, it is a historical feature or a limitation of
the framework.
I remember this was globally fixed in a "well known fork" and it was a
big change. There, all suggestions issued by the workflow which
haven't been committed, can be reissued from fresh situation (and they
actually are iif the situation has evolved). This makes a big
difference in all applications.
A different thing would be when you have created the invoice, and you realize that you didn't want to, maybe because you'd like to split the invoice. In that case I'd agree with you that the workflow would be affected and the thing to do would then be to have a reversal mechanism, instead of a preventive check that doesn't let you delete invoices. 
>And if it's not, I'd suggest that we create a
> module to prevent this from happening and publish it to the OCA.

Not sure you can  fix it across all the erp with a module, but may be
it might fix the specific point of the draft invoice.

> Regards,
> Jordi.
> On Wed, Apr 22, 2015 at 5:09 PM, Dominique Chabord
> <> wrote:
>> hello,
>> if I understand correctly, the problem is a known native problem. Odoo
>> doesn't make any difference between a handmade draft and a suggestion
>> made by the system which should be recalculated automatically in case
>> you delete it. This is true in all the applications since Tinyerp 2.0.
>> Never delete any draft created by the system.
>> regards

Post to: