[FIX] account: invoice computed reference supports sequence suffix

Set a suffix on the sequence that will determines an invoice's move's name

Validate an invoice

Before this commit, there was a traceback because the regex that matches the invoice number
did not match anything due to the suffix

After this commit, it works as expected

OPW 1903326

closes odoo/odoo#28241
This commit is contained in:
Lucas Perais (lpe)
2018-10-29 10:02:01 +00:00
parent 497dfb6917
commit d94e8a06d1
+3 -1
View File
@@ -395,7 +395,9 @@ class AccountInvoice(models.Model):
def _get_computed_reference(self):
self.ensure_one()
if self.company_id.invoice_reference_type == 'invoice_number':
identification_number = int(re.match('.*?([0-9]+)$', self.number).group(1))
seq_suffix = self.journal_id.sequence_id.suffix or ''
regex_number = '.*?([0-9]+)%s$' % seq_suffix
identification_number = int(re.match(regex_number, self.number).group(1))
prefix = self.number
else:
#self.company_id.invoice_reference_type == 'partner'