[ADD] l10n_ar: use 5 digits pos number instead of 4
The law itself said that you can use 4 or 5 digits, but some customers complains that they want 5 (for eg. 00001) because some suppliers reject the invoice if only 4 digits (that is wrong, but suppliers do anything to avoid paying). We've check and AFIP online invoices use 5 digits always. So, to satisfy customers/suppliers and make code simpler, we think using 5 digits is a better option. X-original-commit: a475de89568c8274bb556d672948b25a95996599
This commit is contained in:
@@ -185,5 +185,4 @@ class AccountJournal(models.Model):
|
||||
we add or not a prefix to identify sales journal.
|
||||
"""
|
||||
if self.type == 'sale' and self.l10n_ar_afip_pos_number:
|
||||
pos_num = str(self.l10n_ar_afip_pos_number)
|
||||
self.code = pos_num if len(pos_num) > 4 else _('S') + "%04d" % self.l10n_ar_afip_pos_number
|
||||
self.code = "%05i" % self.l10n_ar_afip_pos_number
|
||||
|
||||
@@ -38,7 +38,7 @@ class L10nLatamDocumentType(models.Model):
|
||||
if self.country_id != self.env.ref('base.ar'):
|
||||
return values
|
||||
|
||||
values.update({'padding': 8, 'implementation': 'no_gap', 'prefix': "%04i-" % (journal.l10n_ar_afip_pos_number),
|
||||
values.update({'padding': 8, 'implementation': 'no_gap', 'prefix': "%05i-" % (journal.l10n_ar_afip_pos_number),
|
||||
'l10n_latam_journal_id': journal.id})
|
||||
if journal.l10n_ar_share_sequences:
|
||||
values.update({'name': '%s - Letter %s Documents' % (journal.name, self.l10n_ar_letter),
|
||||
@@ -85,9 +85,7 @@ class L10nLatamDocumentType(models.Model):
|
||||
failed = True
|
||||
elif len(number) > 8 or not number.isdigit():
|
||||
failed = True
|
||||
if len(pos) == 5 and pos[0] == '0':
|
||||
pos = pos[1:]
|
||||
document_number = '{:>04s}-{:>08s}'.format(pos, number)
|
||||
document_number = '{:>05s}-{:>08s}'.format(pos, number)
|
||||
if failed:
|
||||
raise UserError(msg % (document_number, self.name, _(
|
||||
'The document number must be entered with a dash (-) and a maximum of 5 characters for the first part'
|
||||
|
||||
Reference in New Issue
Block a user