l10n-dominicana icon indicating copy to clipboard operation
l10n-dominicana copied to clipboard

[13.0][IMP] l10n_do_accounting: avoid contraint validation of unique sequence if invoice is not from same year

Open evaldez89 opened this issue 3 years ago • 2 comments

When a company generates a large number of fiscal sequences, the current constraint on method _check_unique_sequence_number located at l10n_do_accounting\models\account_move.py:203 might become a bug by not letting the user generate a new sequence.

Steps to Reproduce Steps to reproduce the behavior:

  1. User generates several invoices over the years to the a recurrent partner
  2. Since the sequences can be restarted to 01 again
  3. When it does, there is a possibility of the user generating an invoice for a partner when the next number is one already used for the same partner in prior years

Expected behavior Improve the method _check_unique_sequence_number to consider the invoice year when validating if and invoice with that sequence number already exists. By doing this, a user could generate a invoice for the same partner, with the same sequence number as long as the sequence is from another year.

evaldez89 avatar Sep 30 '21 23:09 evaldez89

Thanks @evaldez89

I took the time to do some research about this use case and it turns out that DGII do not allows a taxpayer to re-use a sequence based on the period (year) per se, but the sequence running out of digits. Being more specific, eight and ten for B and E series respectively.

In other words, issuing one invoice per second, it would take 3 years to deplete all serie B and 317 years for serie E. I think we can use this as a reference.

Can we improve the query so it considers each amount of years for both B and E series?

Cc: @andrp92

jose-pcg avatar Oct 01 '21 19:10 jose-pcg

ping!

akevinieron avatar Dec 30 '22 16:12 akevinieron