From 7c8a46be2cd61e06d243713b120749d2c38c5a82 Mon Sep 17 00:00:00 2001 From: Cedric Snauwaert Date: Tue, 12 May 2015 15:19:24 +0200 Subject: [PATCH] [FIX] account_invoice: raise exception in case we try to create an account invoice with no account_id (probably no CoA installed) --- addons/account/account_invoice.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/addons/account/account_invoice.py b/addons/account/account_invoice.py index 3352da495ad..dd8d65531c6 100644 --- a/addons/account/account_invoice.py +++ b/addons/account/account_invoice.py @@ -308,6 +308,8 @@ class AccountInvoice(models.Model): @api.model def create(self, vals): + if not vals.get('account_id',False): + raise UserError(_('Configuration error!\nCould not find any account to create the invoice, are you sure you have a chart of account installed?')) return super(AccountInvoice, self.with_context(mail_create_nolog=True)).create(vals) @api.model