diff --git a/addons/account/i18n/account.pot b/addons/account/i18n/account.pot index 314d9b06797..bece24f1d9d 100644 --- a/addons/account/i18n/account.pot +++ b/addons/account/i18n/account.pot @@ -10214,6 +10214,12 @@ msgstr "" msgid "Period Comparison" msgstr "" +#. module: account +#: code:addons/account/models/account_account.py:0 +#, python-format +msgid "Please create new accounts from the Chart of Accounts menu." +msgstr "" + #. module: account #: code:addons/account/models/account_payment.py:0 #, python-format diff --git a/addons/account/models/account_account.py b/addons/account/models/account_account.py index 24e76802de8..921c777cdf0 100644 --- a/addons/account/models/account_account.py +++ b/addons/account/models/account_account.py @@ -6,7 +6,7 @@ from bisect import bisect_left from collections import defaultdict import re -ACCOUNT_REGEX = re.compile(r'(?:(\S*\d+\S*)\s)?(.*)') +ACCOUNT_REGEX = re.compile(r'(?:(\S*\d+\S*))?(.*)') ACCOUNT_CODE_REGEX = re.compile(r'^[A-Za-z0-9.]+$') class AccountAccount(models.Model): @@ -690,7 +690,7 @@ class AccountAccount(models.Model): if 'import_file' in self.env.context: code, name = self._split_code_name(name) return self.create({'code': code, 'name': name}).name_get()[0] - raise ValueError(_("The values for the created account need to be verified.")) + raise UserError(_("Please create new accounts from the Chart of Accounts menu.")) def write(self, vals): # Do not allow changing the company_id when account_move_line already exist diff --git a/addons/account/tests/test_account_account.py b/addons/account/tests/test_account_account.py index 2ec0976fffc..63205796606 100644 --- a/addons/account/tests/test_account_account.py +++ b/addons/account/tests/test_account_account.py @@ -159,7 +159,7 @@ class TestAccountAccount(AccountTestInvoicingCommon): """name_create should only be possible when importing Code and Name should be split """ - with self.assertRaises(ValueError): + with self.assertRaises(UserError): self.env['account.account'].name_create('550003 Existing Account') account_id = self.env['account.account'].with_context(import_file=True).name_create('550003 Existing Account')[0] account = self.env['account.account'].browse(account_id) diff --git a/addons/stock_account/views/product_views.xml b/addons/stock_account/views/product_views.xml index dad42d09084..07d8098fee2 100644 --- a/addons/stock_account/views/product_views.xml +++ b/addons/stock_account/views/product_views.xml @@ -36,8 +36,8 @@ - - + +
Set other input/output accounts on specific