diff --git a/addons/account/i18n/account.pot b/addons/account/i18n/account.pot index 0b7b1461634..81687316647 100644 --- a/addons/account/i18n/account.pot +++ b/addons/account/i18n/account.pot @@ -9674,6 +9674,12 @@ msgstr "" msgid "You have" msgstr "" +#. module: account +#: code:addons/account/models/account_payment.py:360 +#, python-format +msgid "You have to define a sequence for %s in your company." +msgstr "" + #. module: account #: code:addons/account/wizard/account_report_general_ledger.py:21 #, python-format diff --git a/addons/account/models/account_payment.py b/addons/account/models/account_payment.py index 4a49bb3b5f9..fcc2dbd0319 100644 --- a/addons/account/models/account_payment.py +++ b/addons/account/models/account_payment.py @@ -356,6 +356,8 @@ class account_payment(models.Model): if rec.payment_type == 'outbound': sequence_code = 'account.payment.supplier.invoice' rec.name = self.env['ir.sequence'].with_context(ir_sequence_date=rec.payment_date).next_by_code(sequence_code) + if not rec.name and self.payment_type != 'transfer': + raise UserError(_("You have to define a sequence for %s in your company.") % (sequence_code,)) # Create the journal entry amount = rec.amount * (rec.payment_type in ('outbound', 'transfer') and 1 or -1)