[FIX] l10n_ar: proper compare document numbers in vendor bills #41196
Description of the issue/feature this PR addresses:
When creating vendor bills, it was considering this two numbers as different but actually are the same invoice number
To avoid this we remove the zero to the left always if the pos number > 4.
Current behavior before PR:
It validate both invoices but it should not, because the document number is the same and can not be used twice for the same vendor.
Desired behavior after PR is merged:
With the change we made now 01234-00000001 is saved as 1234-00000001, so now when try to validate an invoice with the same document number will raise the uniqueness error.
When creating vendor bills, it was considering this two numbers as different but actually are the same invoice number * 01234-00000001 + 1234-00000001 To avoid this we remove the zero to the left always if the pos number > 4.
@jco-odoo this will happen: 00123-00000001 will transform the number 0123-00000001
It really do not depends on the quantity of 0 to lthe left, will depend of the length of the number before the dash. This number should have 4 o 5 digits long. We only ensure that is the number is 5 digits longs that all the numbers are representative, if not we remove the zero to left in order to represent the number as a 4 digit number.