From cce8d5083a1928e7e62437fe644129c06e36ce0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Tue, 1 Jan 2013 18:32:05 +0100 Subject: [PATCH] Use the right date to find period in set_number --- invoice.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/invoice.py b/invoice.py index 0d663599e4..5c837b575f 100644 --- a/invoice.py +++ b/invoice.py @@ -904,8 +904,9 @@ class Invoice(Workflow, ModelSQL, ModelView): if self.type in ('in_invoice', 'in_credit_note'): test_state = False + accounting_date = self.accounting_date or self.invoice_date period_id = Period.find(self.company.id, - date=self.invoice_date, test_state=test_state) + date=accounting_date, test_state=test_state) period = Period(period_id) sequence_id = getattr(period, self.type + '_sequence').id if not sequence_id: