From d2cbfc9283f00db1f26b30af3083b105d283f25f Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Wed, 30 Sep 2015 10:37:46 +0200 Subject: [PATCH] [FIX] account_check_printing: set next number only if sequence When a payment method is created, the field check_sequence_id is defined only at the time of the create (_create_check_sequence). This method fails since the check_sequence_id is not created yet. --- addons/account_check_printing/account_journal.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/account_check_printing/account_journal.py b/addons/account_check_printing/account_journal.py index 1d10d358498..03ad48bd8cf 100644 --- a/addons/account_check_printing/account_journal.py +++ b/addons/account_check_printing/account_journal.py @@ -24,7 +24,8 @@ class AccountJournal(models.Model): if self.check_next_number < self.check_sequence_id.number_next_actual: raise ValidationError(_("The last check number was %s. In order to avoid a check being rejected " "by the bank, you can only use a greater number." % self.check_sequence_id.number_next_actual)) - self.check_sequence_id.sudo().number_next_actual = self.check_next_number + if self.check_sequence_id: + self.check_sequence_id.sudo().number_next_actual = self.check_next_number check_manual_sequencing = fields.Boolean('Manual Numbering', default=False, help="Check this option if your pre-printed checks are not numbered.")