diff --git a/invoice.py b/invoice.py index 729cd3d14d..4b04f15afe 100644 --- a/invoice.py +++ b/invoice.py @@ -909,15 +909,15 @@ class Invoice(Workflow, ModelSQL, ModelView): period_id = Period.find(self.company.id, date=accounting_date, test_state=test_state) period = Period(period_id) - sequence_id = period.get_invoice_sequence(self.type).id - if not sequence_id: + sequence = period.get_invoice_sequence(self.type) + if not sequence: self.raise_user_error('no_invoice_sequence', { 'invoice': self.rec_name, 'period': period.rec_name, }) with Transaction().set_context( date=self.invoice_date or Date.today()): - number = Sequence.get_id(sequence_id) + number = Sequence.get_id(sequence.id) vals = {'number': number} if (not self.invoice_date and self.type in ('out_invoice', 'out_credit_note')):