From d94e8a06d1cdff1a4f67bb4ae35000113080be02 Mon Sep 17 00:00:00 2001 From: "Lucas Perais (lpe)" Date: Mon, 29 Oct 2018 10:02:01 +0000 Subject: [PATCH] [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 --- addons/account/models/account_invoice.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/addons/account/models/account_invoice.py b/addons/account/models/account_invoice.py index 6b1778cec76..e897f96abd7 100644 --- a/addons/account/models/account_invoice.py +++ b/addons/account/models/account_invoice.py @@ -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'