diff --git a/CHANGELOG b/CHANGELOG index f2fb50c070..10b0ea3b4c 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,4 @@ +* Use accounting date to format invoice number * Add invoice payment method * Show number and reference in invoice rec_name * Remove support for Python 2.7 diff --git a/invoice.py b/invoice.py index 08459aac40..742d9f397d 100644 --- a/invoice.py +++ b/invoice.py @@ -1005,8 +1005,9 @@ class Invoice(Workflow, ModelSQL, ModelView, TaxableMixin): else: pattern = pattern.copy() + accounting_date = self.accounting_date or self.invoice_date period_id = Period.find( - self.company.id, date=self.accounting_date or self.invoice_date, + self.company.id, date=accounting_date, test_state=self.type != 'in') period = Period(period_id) @@ -1031,7 +1032,7 @@ class Invoice(Workflow, ModelSQL, ModelView, TaxableMixin): 'invoice': self.rec_name, 'fiscalyear': fiscalyear.rec_name, }) - with Transaction().set_context(date=self.invoice_date): + with Transaction().set_context(date=accounting_date): return Sequence.get_id(sequence.id) @classmethod