[Vtigercrm-developers] feature: create all invoices of a recurring salesorder ahead of time

Rubén A. Estrada Orozco rulotec1 at gmail.com
Mon Apr 18 00:34:34 GMT 2022


On Thu, Apr 14, 2022 at 3:36 AM Martin Allen <martin.allen at exe-squared.co.uk>
wrote:

>
>
> @Ruben A. Estrada <gitlab at code.vtiger.com> If you have created all the
> Invoices in advance, does this prevent the vtigercron from creating them
> again, when it gets to the recurring date for the next invoice? Looking at
> your merge request I can’t see anything that identifies if the invoice was
> created already? (Admittedly I cant see if you are altering the recurring
> invoice data after creating them manually… but presume you must be doing
> something like that, as you cant manually create them a second time)?
>

Martin, yes, I've taken care of that. There is a table
called vtiger_invoice_recurring_info which stores the date when the last
invoice in the series was created. When creating all of them in one shot
with the new feature, that field gets updated so when the cron runs, it'll
know there is no invoice to be created (see:
RecurringInvoice::saveNextInvoiceCreationDate()). In fact I refactored the
whole "Recurring Invoice" cron service so that the cron and my feature both
use the same class "RecurringInvoice" to do the job. The code was quite old
and messy and I believe it's a little bit better now.

About the comments by everyone else in this thread, I'm aware there are
country to country differences which might make this feature not useful to
your specific country. But at the very least, if you use the recurring
invoice feature of vtiger, you can get an idea of how many and when the
next invoices are going to be created (just hit cancel when the modal opens
up). In my particular case (Mexico), an Invoice only becomes valid/official
after doing a "digital signature process" involving certificates, private
keys, etc (I have an extension for doing just that:
https://simplesistemas.com/extensiones/facturacion-electronica-cfdi-para-vtiger).
If an invoice does not get signed, it doesn't officially exist.  Also, I
think my MR should be accepted just because of the refactoring of the
Recurring Invoice cron job.

Nice week everyone!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.vtigercrm.com/pipermail/vtigercrm-developers/attachments/20220417/48d2a5bf/attachment.html>


More information about the vtigercrm-developers mailing list